From 96b2060319d75956730080df92321812864722df Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 9 Mar 2021 05:11:08 +0000 Subject: [PATCH] CodeGen from PR 12969 in Azure/azure-rest-api-specs [Hub Generated] Review request for Microsoft.DevTestLab to add version stable/2018-09-15 (#12969) * Microsoft.DevTestLabs - Fix OpenApi Spec Correctness and Completeness Issues * Fix ResourceGroup Token * Remove Unreferenced Example * Fix Prettier Issues * Remove generated list api for service runners --- eng/versioning/version_client.txt | 1 + pom.xml | 3 +- .../CHANGELOG.md | 5 + .../README.md | 99 + .../azure-resourcemanager-devtestlabs/pom.xml | 67 + .../devtestlabs/DevTestLabsManager.java | 504 ++ .../fluent/ArmTemplatesClient.java | 94 + .../fluent/ArtifactSourcesClient.java | 179 + .../devtestlabs/fluent/ArtifactsClient.java | 142 + .../devtestlabs/fluent/CostsClient.java | 77 + .../fluent/CustomImagesClient.java | 242 + .../devtestlabs/fluent/DevTestLabsClient.java | 221 + .../devtestlabs/fluent/DisksClient.java | 435 ++ .../fluent/EnvironmentsClient.java | 274 + .../devtestlabs/fluent/FormulasClient.java | 212 + .../fluent/GalleryImagesClient.java | 52 + .../fluent/GlobalSchedulesClient.java | 301 + .../devtestlabs/fluent/LabsClient.java | 561 ++ .../fluent/NotificationChannelsClient.java | 219 + .../devtestlabs/fluent/OperationsClient.java | 41 + .../devtestlabs/fluent/PoliciesClient.java | 201 + .../devtestlabs/fluent/PolicySetsClient.java | 52 + .../fluent/ProviderOperationsClient.java | 36 + .../devtestlabs/fluent/SchedulesClient.java | 265 + .../devtestlabs/fluent/SecretsClient.java | 227 + .../fluent/ServiceFabricSchedulesClient.java | 315 ++ .../fluent/ServiceFabricsClient.java | 432 ++ .../fluent/ServiceRunnersClient.java | 105 + .../devtestlabs/fluent/UsersClient.java | 240 + .../fluent/VirtualMachineSchedulesClient.java | 270 + .../fluent/VirtualMachinesClient.java | 1011 ++++ .../fluent/VirtualNetworksClient.java | 243 + .../models/ApplicableScheduleInner.java | 104 + .../fluent/models/ArmTemplateInfoInner.java | 76 + .../fluent/models/ArmTemplateInner.java | 170 + .../fluent/models/ArtifactInner.java | 163 + .../fluent/models/ArtifactSourceInner.java | 298 + .../fluent/models/CustomImageInner.java | 342 ++ .../devtestlabs/fluent/models/DiskInner.java | 298 + .../fluent/models/DtlEnvironmentInner.java | 162 + .../models/EvaluatePoliciesResponseInner.java | 55 + .../fluent/models/FormulaInner.java | 215 + .../fluent/models/GalleryImageInner.java | 244 + .../GenerateUploadUriResponseInner.java | 50 + .../fluent/models/LabCostInner.java | 265 + .../devtestlabs/fluent/models/LabInner.java | 470 ++ .../fluent/models/LabVhdInner.java | 50 + .../fluent/models/LabVirtualMachineInner.java | 863 +++ .../models/NotificationChannelInner.java | 229 + .../fluent/models/OperationMetadataInner.java | 80 + .../fluent/models/OperationResultInner.java | 107 + .../fluent/models/PolicyInner.java | 252 + .../fluent/models/RdpConnectionInner.java | 50 + .../fluent/models/ScheduleInner.java | 322 ++ .../fluent/models/SecretInner.java | 98 + .../fluent/models/ServiceFabricInner.java | 145 + .../fluent/models/ServiceRunnerInner.java | 70 + .../devtestlabs/fluent/models/UserInner.java | 148 + .../fluent/models/VirtualNetworkInner.java | 220 + .../fluent/models/package-info.java | 6 + .../devtestlabs/fluent/package-info.java | 6 + .../ApplicableScheduleImpl.java | 75 + .../implementation/ArmTemplateImpl.java | 95 + .../implementation/ArmTemplateInfoImpl.java | 36 + .../ArmTemplatesClientImpl.java | 691 +++ .../implementation/ArmTemplatesImpl.java | 89 + .../implementation/ArtifactImpl.java | 87 + .../implementation/ArtifactSourceImpl.java | 267 + .../ArtifactSourcesClientImpl.java | 1193 ++++ .../implementation/ArtifactSourcesImpl.java | 201 + .../implementation/ArtifactsClientImpl.java | 947 ++++ .../implementation/ArtifactsImpl.java | 131 + .../implementation/CostsClientImpl.java | 466 ++ .../devtestlabs/implementation/CostsImpl.java | 117 + .../implementation/CustomImageImpl.java | 282 + .../CustomImagesClientImpl.java | 1392 +++++ .../implementation/CustomImagesImpl.java | 197 + .../DevTestLabsClientBuilder.java | 146 + .../implementation/DevTestLabsClientImpl.java | 629 +++ .../devtestlabs/implementation/DiskImpl.java | 285 + .../implementation/DisksClientImpl.java | 2231 ++++++++ .../devtestlabs/implementation/DisksImpl.java | 265 + .../implementation/DtlEnvironmentImpl.java | 217 + .../EnvironmentsClientImpl.java | 1538 +++++ .../implementation/EnvironmentsImpl.java | 226 + .../EvaluatePoliciesResponseImpl.java | 41 + .../implementation/FormulaImpl.java | 232 + .../implementation/FormulasClientImpl.java | 1295 +++++ .../implementation/FormulasImpl.java | 197 + .../implementation/GalleryImageImpl.java | 89 + .../GalleryImagesClientImpl.java | 414 ++ .../implementation/GalleryImagesImpl.java | 54 + .../GenerateUploadUriResponseImpl.java | 33 + .../GlobalSchedulesClientImpl.java | 1922 +++++++ .../implementation/GlobalSchedulesImpl.java | 191 + .../implementation/LabCostImpl.java | 247 + .../devtestlabs/implementation/LabImpl.java | 375 ++ .../implementation/LabVhdImpl.java | 31 + .../implementation/LabVirtualMachineImpl.java | 585 ++ .../implementation/LabsClientImpl.java | 3181 +++++++++++ .../devtestlabs/implementation/LabsImpl.java | 265 + .../NotificationChannelImpl.java | 258 + .../NotificationChannelsClientImpl.java | 1408 +++++ .../NotificationChannelsImpl.java | 220 + .../implementation/OperationMetadataImpl.java | 37 + .../implementation/OperationResultImpl.java | 42 + .../implementation/OperationsClientImpl.java | 216 + .../implementation/OperationsImpl.java | 59 + .../implementation/PoliciesClientImpl.java | 1306 +++++ .../implementation/PoliciesImpl.java | 229 + .../implementation/PolicyImpl.java | 254 + .../implementation/PolicySetsClientImpl.java | 270 + .../implementation/PolicySetsImpl.java | 70 + .../ProviderOperationsClientImpl.java | 269 + .../ProviderOperationsImpl.java | 46 + .../implementation/RdpConnectionImpl.java | 32 + .../implementation/ScheduleImpl.java | 282 + .../implementation/SchedulesClientImpl.java | 1752 ++++++ .../implementation/SchedulesImpl.java | 157 + .../implementation/SecretImpl.java | 198 + .../implementation/SecretsClientImpl.java | 1405 +++++ .../implementation/SecretsImpl.java | 227 + .../implementation/ServiceFabricImpl.java | 246 + .../ServiceFabricSchedulesClientImpl.java | 1821 ++++++ .../ServiceFabricSchedulesImpl.java | 210 + .../ServiceFabricsClientImpl.java | 2302 ++++++++ .../implementation/ServiceFabricsImpl.java | 276 + .../implementation/ServiceRunnerImpl.java | 175 + .../ServiceRunnersClientImpl.java | 603 ++ .../implementation/ServiceRunnersImpl.java | 181 + .../devtestlabs/implementation/UserImpl.java | 210 + .../implementation/UsersClientImpl.java | 1386 +++++ .../devtestlabs/implementation/UsersImpl.java | 196 + .../devtestlabs/implementation/Utils.java | 204 + .../VirtualMachineSchedulesClientImpl.java | 1628 ++++++ .../VirtualMachineSchedulesImpl.java | 174 + .../VirtualMachinesClientImpl.java | 4925 +++++++++++++++++ .../implementation/VirtualMachinesImpl.java | 368 ++ .../implementation/VirtualNetworkImpl.java | 250 + .../VirtualNetworksClientImpl.java | 1396 +++++ .../implementation/VirtualNetworksImpl.java | 201 + .../implementation/package-info.java | 6 + .../models/ApplicableSchedule.java | 68 + .../models/ApplicableScheduleFragment.java | 33 + .../models/ApplyArtifactsRequest.java | 54 + .../devtestlabs/models/ArmTemplate.java | 112 + .../devtestlabs/models/ArmTemplateInfo.java | 31 + .../devtestlabs/models/ArmTemplateList.java | 81 + .../ArmTemplateParameterProperties.java | 76 + .../devtestlabs/models/ArmTemplates.java | 87 + .../devtestlabs/models/Artifact.java | 110 + .../ArtifactDeploymentStatusProperties.java | 102 + .../models/ArtifactInstallProperties.java | 211 + .../devtestlabs/models/ArtifactList.java | 81 + .../models/ArtifactParameterProperties.java | 76 + .../devtestlabs/models/ArtifactSource.java | 360 ++ .../models/ArtifactSourceFragment.java | 33 + .../models/ArtifactSourceList.java | 81 + .../devtestlabs/models/ArtifactSources.java | 157 + .../devtestlabs/models/Artifacts.java | 131 + .../models/AttachDiskProperties.java | 51 + .../models/AttachNewDataDiskOptions.java | 102 + .../models/BulkCreationParameters.java | 50 + .../devtestlabs/models/ComputeDataDisk.java | 129 + .../models/ComputeVmInstanceViewStatus.java | 102 + .../models/ComputeVmProperties.java | 213 + .../models/CostThresholdProperties.java | 161 + .../models/CostThresholdStatus.java | 34 + .../devtestlabs/models/CostType.java | 37 + .../devtestlabs/models/Costs.java | 72 + .../devtestlabs/models/CustomImage.java | 383 ++ .../models/CustomImageFragment.java | 33 + .../devtestlabs/models/CustomImageList.java | 81 + .../devtestlabs/models/CustomImageOsType.java | 37 + .../models/CustomImagePropertiesCustom.java | 108 + .../models/CustomImagePropertiesFromPlan.java | 106 + .../models/CustomImagePropertiesFromVm.java | 108 + .../devtestlabs/models/CustomImages.java | 155 + .../models/DataDiskProperties.java | 105 + .../models/DataDiskStorageTypeInfo.java | 76 + .../devtestlabs/models/DayDetails.java | 50 + .../models/DetachDataDiskProperties.java | 50 + .../models/DetachDiskProperties.java | 50 + .../devtestlabs/models/Disk.java | 407 ++ .../devtestlabs/models/DiskFragment.java | 33 + .../devtestlabs/models/DiskList.java | 81 + .../devtestlabs/models/Disks.java | 244 + .../devtestlabs/models/DtlEnvironment.java | 262 + .../models/DtlEnvironmentFragment.java | 33 + .../models/DtlEnvironmentList.java | 81 + .../devtestlabs/models/EnableStatus.java | 34 + .../EnvironmentDeploymentProperties.java | 80 + .../models/EnvironmentPermission.java | 34 + .../devtestlabs/models/Environments.java | 162 + .../models/EvaluatePoliciesProperties.java | 128 + .../models/EvaluatePoliciesRequest.java | 54 + .../models/EvaluatePoliciesResponse.java | 25 + .../devtestlabs/models/Event.java | 51 + .../models/ExportResourceUsageParameters.java | 83 + .../devtestlabs/models/ExternalSubnet.java | 76 + .../devtestlabs/models/FileUploadOptions.java | 35 + .../devtestlabs/models/Formula.java | 295 + .../devtestlabs/models/FormulaFragment.java | 33 + .../devtestlabs/models/FormulaList.java | 81 + .../models/FormulaPropertiesFromVm.java | 50 + .../devtestlabs/models/Formulas.java | 157 + .../devtestlabs/models/GalleryImage.java | 110 + .../devtestlabs/models/GalleryImageList.java | 81 + .../models/GalleryImageReference.java | 154 + .../devtestlabs/models/GalleryImages.java | 47 + .../models/GenerateArmTemplateRequest.java | 135 + .../models/GenerateUploadUriParameter.java | 50 + .../models/GenerateUploadUriResponse.java | 24 + .../devtestlabs/models/GlobalSchedules.java | 218 + .../models/HostCachingOptions.java | 37 + .../devtestlabs/models/HourDetails.java | 50 + .../devtestlabs/models/HttpStatusCode.java | 169 + .../models/IdentityProperties.java | 128 + .../ImportLabVirtualMachineRequest.java | 76 + .../devtestlabs/models/InboundNatRule.java | 106 + .../devtestlabs/models/Lab.java | 573 ++ .../models/LabAnnouncementProperties.java | 188 + .../devtestlabs/models/LabCost.java | 377 ++ .../models/LabCostDetailsProperties.java | 103 + .../models/LabCostSummaryProperties.java | 50 + .../devtestlabs/models/LabFragment.java | 33 + .../devtestlabs/models/LabList.java | 81 + .../models/LabResourceCostProperties.java | 258 + .../models/LabSupportProperties.java | 79 + .../devtestlabs/models/LabVhd.java | 24 + .../devtestlabs/models/LabVhdList.java | 81 + .../devtestlabs/models/LabVirtualMachine.java | 958 ++++ .../LabVirtualMachineCreationParameter.java | 759 +++ .../models/LabVirtualMachineFragment.java | 33 + .../models/LabVirtualMachineList.java | 81 + .../devtestlabs/models/Labs.java | 335 ++ .../devtestlabs/models/LinuxOsInfo.java | 53 + .../devtestlabs/models/LinuxOsState.java | 37 + .../models/ManagedIdentityType.java | 40 + .../models/NetworkInterfaceProperties.java | 271 + .../models/NotificationChannel.java | 336 ++ .../models/NotificationChannelEventType.java | 34 + .../models/NotificationChannelFragment.java | 33 + .../models/NotificationChannelList.java | 81 + .../models/NotificationChannels.java | 186 + .../models/NotificationSettings.java | 160 + .../devtestlabs/models/NotifyParameters.java | 76 + .../devtestlabs/models/OperationError.java | 76 + .../devtestlabs/models/OperationMetadata.java | 31 + .../models/OperationMetadataDisplay.java | 128 + .../devtestlabs/models/OperationResult.java | 38 + .../devtestlabs/models/Operations.java | 36 + .../devtestlabs/models/ParameterInfo.java | 76 + .../models/ParametersValueFileInfo.java | 76 + .../PercentageCostThresholdProperties.java | 50 + .../devtestlabs/models/Policies.java | 165 + .../devtestlabs/models/Policy.java | 330 ++ .../models/PolicyEvaluatorType.java | 34 + .../devtestlabs/models/PolicyFactName.java | 58 + .../devtestlabs/models/PolicyFragment.java | 33 + .../devtestlabs/models/PolicyList.java | 81 + .../devtestlabs/models/PolicySetResult.java | 81 + .../devtestlabs/models/PolicySets.java | 46 + .../devtestlabs/models/PolicyStatus.java | 34 + .../devtestlabs/models/PolicyViolation.java | 76 + .../devtestlabs/models/Port.java | 76 + .../devtestlabs/models/PremiumDataDisk.java | 34 + .../models/ProviderOperationResult.java | 70 + .../models/ProviderOperations.java | 31 + .../devtestlabs/models/RdpConnection.java | 24 + .../models/ReportingCycleType.java | 34 + .../ResizeLabVirtualMachineProperties.java | 50 + .../models/RetargetScheduleProperties.java | 79 + .../devtestlabs/models/Schedule.java | 407 ++ .../models/ScheduleCreationParameter.java | 334 ++ .../devtestlabs/models/ScheduleFragment.java | 33 + .../devtestlabs/models/ScheduleList.java | 81 + .../devtestlabs/models/Schedules.java | 216 + .../devtestlabs/models/Secret.java | 225 + .../devtestlabs/models/SecretFragment.java | 33 + .../devtestlabs/models/SecretList.java | 81 + .../devtestlabs/models/Secrets.java | 165 + .../devtestlabs/models/ServiceFabric.java | 312 ++ .../models/ServiceFabricFragment.java | 33 + .../devtestlabs/models/ServiceFabricList.java | 81 + .../models/ServiceFabricSchedules.java | 257 + .../devtestlabs/models/ServiceFabrics.java | 246 + .../devtestlabs/models/ServiceRunner.java | 220 + .../devtestlabs/models/ServiceRunners.java | 117 + .../SharedPublicIpAddressConfiguration.java | 54 + .../devtestlabs/models/SourceControlType.java | 37 + .../devtestlabs/models/StorageType.java | 37 + .../devtestlabs/models/Subnet.java | 105 + .../devtestlabs/models/SubnetOverride.java | 190 + ...netSharedPublicIpAddressConfiguration.java | 54 + .../models/TargetCostProperties.java | 185 + .../devtestlabs/models/TargetCostStatus.java | 34 + .../devtestlabs/models/TransportProtocol.java | 34 + .../devtestlabs/models/UpdateResource.java | 51 + .../models/UsagePermissionType.java | 37 + .../devtestlabs/models/User.java | 250 + .../devtestlabs/models/UserFragment.java | 33 + .../devtestlabs/models/UserIdentity.java | 161 + .../devtestlabs/models/UserList.java | 81 + .../devtestlabs/models/UserSecretStore.java | 76 + .../devtestlabs/models/Users.java | 155 + .../models/VirtualMachineCreationSource.java | 37 + .../models/VirtualMachineSchedules.java | 220 + .../devtestlabs/models/VirtualMachines.java | 521 ++ .../devtestlabs/models/VirtualNetwork.java | 297 + .../models/VirtualNetworkFragment.java | 33 + .../models/VirtualNetworkList.java | 81 + .../devtestlabs/models/VirtualNetworks.java | 155 + .../devtestlabs/models/WeekDetails.java | 80 + .../devtestlabs/models/WindowsOsInfo.java | 53 + .../devtestlabs/models/WindowsOsState.java | 37 + .../devtestlabs/models/package-info.java | 6 + .../devtestlabs/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/devtestlabs/ci.yml | 33 + sdk/devtestlabs/pom.xml | 53 + 321 files changed, 80427 insertions(+), 1 deletion(-) create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/CHANGELOG.md create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/README.md create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManager.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArmTemplatesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactSourcesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CostsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CustomImagesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DevTestLabsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DisksClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/EnvironmentsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/FormulasClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GalleryImagesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GlobalSchedulesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/LabsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/NotificationChannelsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/OperationsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PoliciesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PolicySetsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ProviderOperationsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SchedulesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SecretsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricSchedulesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricsClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceRunnersClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/UsersClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachineSchedulesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachinesClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualNetworksClient.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ApplicableScheduleInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInfoInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactSourceInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/CustomImageInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DiskInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DtlEnvironmentInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/EvaluatePoliciesResponseInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/FormulaInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GalleryImageInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GenerateUploadUriResponseInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabCostInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVhdInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVirtualMachineInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/NotificationChannelInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationMetadataInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationResultInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/PolicyInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/RdpConnectionInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ScheduleInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/SecretInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceFabricInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceRunnerInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/UserInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/VirtualNetworkInner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/package-info.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/package-info.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ApplicableScheduleImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateInfoImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourceImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImageImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientBuilder.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DiskImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DtlEnvironmentImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EvaluatePoliciesResponseImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulaImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImageImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GenerateUploadUriResponseImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabCostImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVhdImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVirtualMachineImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationMetadataImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationResultImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicyImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/RdpConnectionImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ScheduleImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnerImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UserImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/Utils.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworkImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksClientImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksImpl.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/package-info.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableSchedule.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableScheduleFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplyArtifactsRequest.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplate.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateInfo.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateParameterProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplates.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifact.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactDeploymentStatusProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactInstallProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactParameterProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSource.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSources.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifacts.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachDiskProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachNewDataDiskOptions.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/BulkCreationParameters.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeDataDisk.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmInstanceViewStatus.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdStatus.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Costs.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImage.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageOsType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesCustom.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromPlan.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromVm.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImages.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskStorageTypeInfo.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DayDetails.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDataDiskProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDiskProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disk.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disks.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnableStatus.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentDeploymentProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentPermission.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Environments.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesRequest.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesResponse.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Event.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExportResourceUsageParameters.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExternalSubnet.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FileUploadOptions.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formula.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaPropertiesFromVm.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formulas.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImage.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageReference.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImages.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateArmTemplateRequest.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriParameter.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriResponse.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GlobalSchedules.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HostCachingOptions.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HourDetails.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HttpStatusCode.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/IdentityProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ImportLabVirtualMachineRequest.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/InboundNatRule.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Lab.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabAnnouncementProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCost.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostDetailsProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostSummaryProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabResourceCostProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabSupportProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhd.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhdList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachine.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineCreationParameter.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Labs.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsInfo.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsState.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ManagedIdentityType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NetworkInterfaceProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannel.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelEventType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannels.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationSettings.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotifyParameters.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationError.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadata.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadataDisplay.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationResult.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Operations.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParameterInfo.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParametersValueFileInfo.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PercentageCostThresholdProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policies.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policy.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyEvaluatorType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFactName.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySetResult.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySets.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyStatus.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyViolation.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Port.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PremiumDataDisk.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperationResult.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperations.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RdpConnection.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ReportingCycleType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ResizeLabVirtualMachineProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RetargetScheduleProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedule.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleCreationParameter.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedules.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secret.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secrets.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabric.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricSchedules.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabrics.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunner.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunners.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SharedPublicIpAddressConfiguration.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SourceControlType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/StorageType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Subnet.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetOverride.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetSharedPublicIpAddressConfiguration.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostProperties.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostStatus.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TransportProtocol.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UpdateResource.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UsagePermissionType.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/User.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserIdentity.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserSecretStore.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Users.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineCreationSource.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineSchedules.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachines.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetwork.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkFragment.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkList.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworks.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WeekDetails.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsInfo.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsState.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/package-info.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/package-info.java create mode 100644 sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/module-info.java create mode 100644 sdk/devtestlabs/ci.yml create mode 100644 sdk/devtestlabs/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index e6a425f455c2..35cadba5a866 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -210,6 +210,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.2;1.0 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-devtestlabs;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index f511c48002b3..67f8430c79e4 100644 --- a/pom.xml +++ b/pom.xml @@ -593,8 +593,9 @@ sdk/core sdk/cosmos sdk/costmanagement - sdk/deviceupdate sdk/datadog + sdk/deviceupdate + sdk/devtestlabs sdk/digitaltwins sdk/eventgrid sdk/eventhubs diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/CHANGELOG.md b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/CHANGELOG.md new file mode 100644 index 000000000000..8751e648c442 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-09) + +- Azure Resource Manager DevTestLabs client library for Java. This package contains Microsoft Azure SDK for DevTestLabs Management SDK. The DevTest Labs Client. Package tag package-2018-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/README.md b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/README.md new file mode 100644 index 000000000000..5f89892bc43a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager DevTestLabs client library for Java + +Azure Resource Manager DevTestLabs client library for Java. + +This package contains Microsoft Azure SDK for DevTestLabs Management SDK. The DevTest Labs Client. Package tag package-2018-09. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-devtestlabs;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-devtestlabs + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DevTestLabsManager manager = DevTestLabsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml new file mode 100644 index 000000000000..abb1419c478a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-devtestlabs + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for DevTestLabs Management + This package contains Microsoft Azure SDK for DevTestLabs Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The DevTest Labs Client. Package tag package-2018-09. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.14.0 + + + com.azure + azure-core-management + 1.2.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManager.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManager.java new file mode 100644 index 000000000000..bf74681887db --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/DevTestLabsManager.java @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.DevTestLabsClient; +import com.azure.resourcemanager.devtestlabs.implementation.ArmTemplatesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.ArtifactSourcesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.ArtifactsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.CostsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.CustomImagesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.DevTestLabsClientBuilder; +import com.azure.resourcemanager.devtestlabs.implementation.DisksImpl; +import com.azure.resourcemanager.devtestlabs.implementation.EnvironmentsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.FormulasImpl; +import com.azure.resourcemanager.devtestlabs.implementation.GalleryImagesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.GlobalSchedulesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.LabsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.NotificationChannelsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.OperationsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.PoliciesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.PolicySetsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.ProviderOperationsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.SchedulesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.SecretsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.ServiceFabricSchedulesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.ServiceFabricsImpl; +import com.azure.resourcemanager.devtestlabs.implementation.ServiceRunnersImpl; +import com.azure.resourcemanager.devtestlabs.implementation.UsersImpl; +import com.azure.resourcemanager.devtestlabs.implementation.VirtualMachineSchedulesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.VirtualMachinesImpl; +import com.azure.resourcemanager.devtestlabs.implementation.VirtualNetworksImpl; +import com.azure.resourcemanager.devtestlabs.models.ArmTemplates; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSources; +import com.azure.resourcemanager.devtestlabs.models.Artifacts; +import com.azure.resourcemanager.devtestlabs.models.Costs; +import com.azure.resourcemanager.devtestlabs.models.CustomImages; +import com.azure.resourcemanager.devtestlabs.models.Disks; +import com.azure.resourcemanager.devtestlabs.models.Environments; +import com.azure.resourcemanager.devtestlabs.models.Formulas; +import com.azure.resourcemanager.devtestlabs.models.GalleryImages; +import com.azure.resourcemanager.devtestlabs.models.GlobalSchedules; +import com.azure.resourcemanager.devtestlabs.models.Labs; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannels; +import com.azure.resourcemanager.devtestlabs.models.Operations; +import com.azure.resourcemanager.devtestlabs.models.Policies; +import com.azure.resourcemanager.devtestlabs.models.PolicySets; +import com.azure.resourcemanager.devtestlabs.models.ProviderOperations; +import com.azure.resourcemanager.devtestlabs.models.Schedules; +import com.azure.resourcemanager.devtestlabs.models.Secrets; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabricSchedules; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabrics; +import com.azure.resourcemanager.devtestlabs.models.ServiceRunners; +import com.azure.resourcemanager.devtestlabs.models.Users; +import com.azure.resourcemanager.devtestlabs.models.VirtualMachineSchedules; +import com.azure.resourcemanager.devtestlabs.models.VirtualMachines; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetworks; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to DevTestLabsManager. The DevTest Labs Client. */ +public final class DevTestLabsManager { + private ProviderOperations providerOperations; + + private Labs labs; + + private Operations operations; + + private GlobalSchedules globalSchedules; + + private ArtifactSources artifactSources; + + private ArmTemplates armTemplates; + + private Artifacts artifacts; + + private Costs costs; + + private CustomImages customImages; + + private Formulas formulas; + + private GalleryImages galleryImages; + + private NotificationChannels notificationChannels; + + private PolicySets policySets; + + private Policies policies; + + private Schedules schedules; + + private ServiceRunners serviceRunners; + + private Users users; + + private Disks disks; + + private Environments environments; + + private Secrets secrets; + + private ServiceFabrics serviceFabrics; + + private ServiceFabricSchedules serviceFabricSchedules; + + private VirtualMachines virtualMachines; + + private VirtualMachineSchedules virtualMachineSchedules; + + private VirtualNetworks virtualNetworks; + + private final DevTestLabsClient clientObject; + + private DevTestLabsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new DevTestLabsClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of DevTestLabs service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DevTestLabs service API instance. + */ + public static DevTestLabsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create DevTestLabsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DevTestLabsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of DevTestLabs service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DevTestLabs service API instance. + */ + public DevTestLabsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.devtestlabs") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DevTestLabsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ProviderOperations. */ + public ProviderOperations providerOperations() { + if (this.providerOperations == null) { + this.providerOperations = new ProviderOperationsImpl(clientObject.getProviderOperations(), this); + } + return providerOperations; + } + + /** @return Resource collection API of Labs. */ + public Labs labs() { + if (this.labs == null) { + this.labs = new LabsImpl(clientObject.getLabs(), this); + } + return labs; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of GlobalSchedules. */ + public GlobalSchedules globalSchedules() { + if (this.globalSchedules == null) { + this.globalSchedules = new GlobalSchedulesImpl(clientObject.getGlobalSchedules(), this); + } + return globalSchedules; + } + + /** @return Resource collection API of ArtifactSources. */ + public ArtifactSources artifactSources() { + if (this.artifactSources == null) { + this.artifactSources = new ArtifactSourcesImpl(clientObject.getArtifactSources(), this); + } + return artifactSources; + } + + /** @return Resource collection API of ArmTemplates. */ + public ArmTemplates armTemplates() { + if (this.armTemplates == null) { + this.armTemplates = new ArmTemplatesImpl(clientObject.getArmTemplates(), this); + } + return armTemplates; + } + + /** @return Resource collection API of Artifacts. */ + public Artifacts artifacts() { + if (this.artifacts == null) { + this.artifacts = new ArtifactsImpl(clientObject.getArtifacts(), this); + } + return artifacts; + } + + /** @return Resource collection API of Costs. */ + public Costs costs() { + if (this.costs == null) { + this.costs = new CostsImpl(clientObject.getCosts(), this); + } + return costs; + } + + /** @return Resource collection API of CustomImages. */ + public CustomImages customImages() { + if (this.customImages == null) { + this.customImages = new CustomImagesImpl(clientObject.getCustomImages(), this); + } + return customImages; + } + + /** @return Resource collection API of Formulas. */ + public Formulas formulas() { + if (this.formulas == null) { + this.formulas = new FormulasImpl(clientObject.getFormulas(), this); + } + return formulas; + } + + /** @return Resource collection API of GalleryImages. */ + public GalleryImages galleryImages() { + if (this.galleryImages == null) { + this.galleryImages = new GalleryImagesImpl(clientObject.getGalleryImages(), this); + } + return galleryImages; + } + + /** @return Resource collection API of NotificationChannels. */ + public NotificationChannels notificationChannels() { + if (this.notificationChannels == null) { + this.notificationChannels = new NotificationChannelsImpl(clientObject.getNotificationChannels(), this); + } + return notificationChannels; + } + + /** @return Resource collection API of PolicySets. */ + public PolicySets policySets() { + if (this.policySets == null) { + this.policySets = new PolicySetsImpl(clientObject.getPolicySets(), this); + } + return policySets; + } + + /** @return Resource collection API of Policies. */ + public Policies policies() { + if (this.policies == null) { + this.policies = new PoliciesImpl(clientObject.getPolicies(), this); + } + return policies; + } + + /** @return Resource collection API of Schedules. */ + public Schedules schedules() { + if (this.schedules == null) { + this.schedules = new SchedulesImpl(clientObject.getSchedules(), this); + } + return schedules; + } + + /** @return Resource collection API of ServiceRunners. */ + public ServiceRunners serviceRunners() { + if (this.serviceRunners == null) { + this.serviceRunners = new ServiceRunnersImpl(clientObject.getServiceRunners(), this); + } + return serviceRunners; + } + + /** @return Resource collection API of Users. */ + public Users users() { + if (this.users == null) { + this.users = new UsersImpl(clientObject.getUsers(), this); + } + return users; + } + + /** @return Resource collection API of Disks. */ + public Disks disks() { + if (this.disks == null) { + this.disks = new DisksImpl(clientObject.getDisks(), this); + } + return disks; + } + + /** @return Resource collection API of Environments. */ + public Environments environments() { + if (this.environments == null) { + this.environments = new EnvironmentsImpl(clientObject.getEnvironments(), this); + } + return environments; + } + + /** @return Resource collection API of Secrets. */ + public Secrets secrets() { + if (this.secrets == null) { + this.secrets = new SecretsImpl(clientObject.getSecrets(), this); + } + return secrets; + } + + /** @return Resource collection API of ServiceFabrics. */ + public ServiceFabrics serviceFabrics() { + if (this.serviceFabrics == null) { + this.serviceFabrics = new ServiceFabricsImpl(clientObject.getServiceFabrics(), this); + } + return serviceFabrics; + } + + /** @return Resource collection API of ServiceFabricSchedules. */ + public ServiceFabricSchedules serviceFabricSchedules() { + if (this.serviceFabricSchedules == null) { + this.serviceFabricSchedules = + new ServiceFabricSchedulesImpl(clientObject.getServiceFabricSchedules(), this); + } + return serviceFabricSchedules; + } + + /** @return Resource collection API of VirtualMachines. */ + public VirtualMachines virtualMachines() { + if (this.virtualMachines == null) { + this.virtualMachines = new VirtualMachinesImpl(clientObject.getVirtualMachines(), this); + } + return virtualMachines; + } + + /** @return Resource collection API of VirtualMachineSchedules. */ + public VirtualMachineSchedules virtualMachineSchedules() { + if (this.virtualMachineSchedules == null) { + this.virtualMachineSchedules = + new VirtualMachineSchedulesImpl(clientObject.getVirtualMachineSchedules(), this); + } + return virtualMachineSchedules; + } + + /** @return Resource collection API of VirtualNetworks. */ + public VirtualNetworks virtualNetworks() { + if (this.virtualNetworks == null) { + this.virtualNetworks = new VirtualNetworksImpl(clientObject.getVirtualNetworks(), this); + } + return virtualNetworks; + } + + /** + * @return Wrapped service client DevTestLabsClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public DevTestLabsClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArmTemplatesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArmTemplatesClient.java new file mode 100644 index 000000000000..14fabcf6ad45 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArmTemplatesClient.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInner; + +/** An instance of this class provides access to all the operations defined in ArmTemplatesClient. */ +public interface ArmTemplatesClient { + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String artifactSourceName); + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArmTemplateInner get(String resourceGroupName, String labName, String artifactSourceName, String name); + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactSourcesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactSourcesClient.java new file mode 100644 index 000000000000..c0dc5ca47d10 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactSourcesClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSourceFragment; + +/** An instance of this class provides access to all the operations defined in ArtifactSourcesClient. */ +public interface ArtifactSourcesClient { + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArtifactSourceInner get(String resourceGroupName, String labName, String name); + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArtifactSourceInner createOrUpdate( + String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource); + + /** + * Create or replace an existing artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource, Context context); + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArtifactSourceInner update( + String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource); + + /** + * Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactsClient.java new file mode 100644 index 000000000000..84683b96e417 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ArtifactsClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInfoInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactInner; +import com.azure.resourcemanager.devtestlabs.models.GenerateArmTemplateRequest; + +/** An instance of this class provides access to all the operations defined in ArtifactsClient. */ +public interface ArtifactsClient { + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String artifactSourceName); + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArtifactInner get(String resourceGroupName, String labName, String artifactSourceName, String name); + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context); + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArmTemplateInfoInner generateArmTemplate( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest); + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateArmTemplateWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CostsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CostsClient.java new file mode 100644 index 000000000000..08f46abf1cd6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CostsClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabCostInner; + +/** An instance of this class provides access to all the operations defined in CostsClient. */ +public interface CostsClient { + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabCostInner get(String resourceGroupName, String labName, String name); + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a cost item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabCostInner createOrUpdate(String resourceGroupName, String labName, String name, LabCostInner labCost); + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a cost item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, LabCostInner labCost, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CustomImagesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CustomImagesClient.java new file mode 100644 index 000000000000..f62f57f8cb68 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/CustomImagesClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.CustomImageInner; +import com.azure.resourcemanager.devtestlabs.models.CustomImageFragment; + +/** An instance of this class provides access to all the operations defined in CustomImagesClient. */ +public interface CustomImagesClient { + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomImageInner get(String resourceGroupName, String labName, String name); + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CustomImageInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage); + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, CustomImageInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage, Context context); + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomImageInner createOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage); + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomImageInner createOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage, Context context); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of custom images. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomImageInner update(String resourceGroupName, String labName, String name, CustomImageFragment customImage); + + /** + * Allows modifying tags of custom images. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String name, CustomImageFragment customImage, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DevTestLabsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DevTestLabsClient.java new file mode 100644 index 000000000000..04b690fea67d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DevTestLabsClient.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for DevTestLabsClient class. */ +public interface DevTestLabsClient { + /** + * Gets The subscription ID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ProviderOperationsClient object to access its operations. + * + * @return the ProviderOperationsClient object. + */ + ProviderOperationsClient getProviderOperations(); + + /** + * Gets the LabsClient object to access its operations. + * + * @return the LabsClient object. + */ + LabsClient getLabs(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the GlobalSchedulesClient object to access its operations. + * + * @return the GlobalSchedulesClient object. + */ + GlobalSchedulesClient getGlobalSchedules(); + + /** + * Gets the ArtifactSourcesClient object to access its operations. + * + * @return the ArtifactSourcesClient object. + */ + ArtifactSourcesClient getArtifactSources(); + + /** + * Gets the ArmTemplatesClient object to access its operations. + * + * @return the ArmTemplatesClient object. + */ + ArmTemplatesClient getArmTemplates(); + + /** + * Gets the ArtifactsClient object to access its operations. + * + * @return the ArtifactsClient object. + */ + ArtifactsClient getArtifacts(); + + /** + * Gets the CostsClient object to access its operations. + * + * @return the CostsClient object. + */ + CostsClient getCosts(); + + /** + * Gets the CustomImagesClient object to access its operations. + * + * @return the CustomImagesClient object. + */ + CustomImagesClient getCustomImages(); + + /** + * Gets the FormulasClient object to access its operations. + * + * @return the FormulasClient object. + */ + FormulasClient getFormulas(); + + /** + * Gets the GalleryImagesClient object to access its operations. + * + * @return the GalleryImagesClient object. + */ + GalleryImagesClient getGalleryImages(); + + /** + * Gets the NotificationChannelsClient object to access its operations. + * + * @return the NotificationChannelsClient object. + */ + NotificationChannelsClient getNotificationChannels(); + + /** + * Gets the PolicySetsClient object to access its operations. + * + * @return the PolicySetsClient object. + */ + PolicySetsClient getPolicySets(); + + /** + * Gets the PoliciesClient object to access its operations. + * + * @return the PoliciesClient object. + */ + PoliciesClient getPolicies(); + + /** + * Gets the SchedulesClient object to access its operations. + * + * @return the SchedulesClient object. + */ + SchedulesClient getSchedules(); + + /** + * Gets the ServiceRunnersClient object to access its operations. + * + * @return the ServiceRunnersClient object. + */ + ServiceRunnersClient getServiceRunners(); + + /** + * Gets the UsersClient object to access its operations. + * + * @return the UsersClient object. + */ + UsersClient getUsers(); + + /** + * Gets the DisksClient object to access its operations. + * + * @return the DisksClient object. + */ + DisksClient getDisks(); + + /** + * Gets the EnvironmentsClient object to access its operations. + * + * @return the EnvironmentsClient object. + */ + EnvironmentsClient getEnvironments(); + + /** + * Gets the SecretsClient object to access its operations. + * + * @return the SecretsClient object. + */ + SecretsClient getSecrets(); + + /** + * Gets the ServiceFabricsClient object to access its operations. + * + * @return the ServiceFabricsClient object. + */ + ServiceFabricsClient getServiceFabrics(); + + /** + * Gets the ServiceFabricSchedulesClient object to access its operations. + * + * @return the ServiceFabricSchedulesClient object. + */ + ServiceFabricSchedulesClient getServiceFabricSchedules(); + + /** + * Gets the VirtualMachinesClient object to access its operations. + * + * @return the VirtualMachinesClient object. + */ + VirtualMachinesClient getVirtualMachines(); + + /** + * Gets the VirtualMachineSchedulesClient object to access its operations. + * + * @return the VirtualMachineSchedulesClient object. + */ + VirtualMachineSchedulesClient getVirtualMachineSchedules(); + + /** + * Gets the VirtualNetworksClient object to access its operations. + * + * @return the VirtualNetworksClient object. + */ + VirtualNetworksClient getVirtualNetworks(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DisksClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DisksClient.java new file mode 100644 index 000000000000..4e6fda42b3e6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/DisksClient.java @@ -0,0 +1,435 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.DiskInner; +import com.azure.resourcemanager.devtestlabs.models.AttachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DiskFragment; + +/** An instance of this class provides access to all the operations defined in DisksClient. */ +public interface DisksClient { + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner get(String resourceGroupName, String labName, String username, String name); + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, DiskInner disk); + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, DiskInner disk, Context context); + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner createOrUpdate(String resourceGroupName, String labName, String username, String name, DiskInner disk); + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, DiskInner disk, Context context); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Allows modifying tags of disks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskInner update(String resourceGroupName, String labName, String username, String name, DiskFragment disk); + + /** + * Allows modifying tags of disks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String username, String name, DiskFragment disk, Context context); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginAttach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginAttach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDetach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDetach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/EnvironmentsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/EnvironmentsClient.java new file mode 100644 index 000000000000..c7cc0d54c506 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/EnvironmentsClient.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.DtlEnvironmentInner; +import com.azure.resourcemanager.devtestlabs.models.DtlEnvironmentFragment; + +/** An instance of this class provides access to all the operations defined in EnvironmentsClient. */ +public interface EnvironmentsClient { + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DtlEnvironmentInner get(String resourceGroupName, String labName, String username, String name); + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DtlEnvironmentInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentInner dtlEnvironment); + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DtlEnvironmentInner> beginCreateOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentInner dtlEnvironment, + Context context); + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DtlEnvironmentInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentInner dtlEnvironment); + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DtlEnvironmentInner createOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentInner dtlEnvironment, + Context context); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Allows modifying tags of environments. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DtlEnvironmentInner update( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentFragment dtlEnvironment); + + /** + * Allows modifying tags of environments. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentFragment dtlEnvironment, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/FormulasClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/FormulasClient.java new file mode 100644 index 000000000000..e5897892f1d3 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/FormulasClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.FormulaInner; +import com.azure.resourcemanager.devtestlabs.models.FormulaFragment; + +/** An instance of this class provides access to all the operations defined in FormulasClient. */ +public interface FormulasClient { + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FormulaInner get(String resourceGroupName, String labName, String name); + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FormulaInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, FormulaInner formula); + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FormulaInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, FormulaInner formula, Context context); + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FormulaInner createOrUpdate(String resourceGroupName, String labName, String name, FormulaInner formula); + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FormulaInner createOrUpdate( + String resourceGroupName, String labName, String name, FormulaInner formula, Context context); + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of formulas. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FormulaInner update(String resourceGroupName, String labName, String name, FormulaFragment formula); + + /** + * Allows modifying tags of formulas. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String name, FormulaFragment formula, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GalleryImagesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GalleryImagesClient.java new file mode 100644 index 000000000000..4dde1cab7c18 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GalleryImagesClient.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageInner; + +/** An instance of this class provides access to all the operations defined in GalleryImagesClient. */ +public interface GalleryImagesClient { + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GlobalSchedulesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GlobalSchedulesClient.java new file mode 100644 index 000000000000..2056c0c2030a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/GlobalSchedulesClient.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.RetargetScheduleProperties; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; + +/** An instance of this class provides access to all the operations defined in GlobalSchedulesClient. */ +public interface GlobalSchedulesClient { + /** + * List schedules in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, String filter, Integer top, String orderby, Context context); + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner getByResourceGroup(String resourceGroupName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String name, String expand, Context context); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner createOrUpdate(String resourceGroupName, String name, ScheduleInner schedule); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String name, ScheduleInner schedule, Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String name, Context context); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner update(String resourceGroupName, String name, ScheduleFragment schedule); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String name, ScheduleFragment schedule, Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute(String resourceGroupName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute(String resourceGroupName, String name, Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String name, Context context); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRetarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRetarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void retarget(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void retarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/LabsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/LabsClient.java new file mode 100644 index 000000000000..7c67e3a3e40d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/LabsClient.java @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.GenerateUploadUriResponseInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVhdInner; +import com.azure.resourcemanager.devtestlabs.models.ExportResourceUsageParameters; +import com.azure.resourcemanager.devtestlabs.models.GenerateUploadUriParameter; +import com.azure.resourcemanager.devtestlabs.models.ImportLabVirtualMachineRequest; +import com.azure.resourcemanager.devtestlabs.models.LabFragment; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineCreationParameter; + +/** An instance of this class provides access to all the operations defined in LabsClient. */ +public interface LabsClient { + /** + * List labs in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, String filter, Integer top, String orderby, Context context); + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context); + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabInner getByResourceGroup(String resourceGroupName, String name); + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String name, String expand, Context context); + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LabInner> beginCreateOrUpdate(String resourceGroupName, String name, LabInner lab); + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LabInner> beginCreateOrUpdate( + String resourceGroupName, String name, LabInner lab, Context context); + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabInner createOrUpdate(String resourceGroupName, String name, LabInner lab); + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabInner createOrUpdate(String resourceGroupName, String name, LabInner lab, Context context); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String name); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String name, Context context); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String name); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String name, Context context); + + /** + * Allows modifying tags of labs. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabInner update(String resourceGroupName, String name, LabFragment lab); + + /** + * Allows modifying tags of labs. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String name, LabFragment lab, Context context); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginClaimAnyVm(String resourceGroupName, String name); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginClaimAnyVm(String resourceGroupName, String name, Context context); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void claimAnyVm(String resourceGroupName, String name); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void claimAnyVm(String resourceGroupName, String name, Context context); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCreateEnvironment( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCreateEnvironment( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void createEnvironment( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void createEnvironment( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExportResourceUsage( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExportResourceUsage( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void exportResourceUsage( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void exportResourceUsage( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context); + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GenerateUploadUriResponseInner generateUploadUri( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter); + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response generateUploadUriWithResponse( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter, Context context); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginImportVirtualMachine( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginImportVirtualMachine( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void importVirtualMachine( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void importVirtualMachine( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context); + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listVhds(String resourceGroupName, String name); + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listVhds(String resourceGroupName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/NotificationChannelsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/NotificationChannelsClient.java new file mode 100644 index 000000000000..2cdf8ee32c5e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/NotificationChannelsClient.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.NotificationChannelInner; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannelFragment; +import com.azure.resourcemanager.devtestlabs.models.NotifyParameters; + +/** An instance of this class provides access to all the operations defined in NotificationChannelsClient. */ +public interface NotificationChannelsClient { + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotificationChannelInner get(String resourceGroupName, String labName, String name); + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotificationChannelInner createOrUpdate( + String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel); + + /** + * Create or replace an existing notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String name, + NotificationChannelInner notificationChannel, + Context context); + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of notification channels. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NotificationChannelInner update( + String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel); + + /** + * Allows modifying tags of notification channels. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String labName, + String name, + NotificationChannelFragment notificationChannel, + Context context); + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void notify(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters); + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response notifyWithResponse( + String resourceGroupName, String labName, String name, NotifyParameters notifyParameters, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/OperationsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/OperationsClient.java new file mode 100644 index 000000000000..de71e11a3351 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/OperationsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationResultInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationResultInner get(String locationName, String name); + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PoliciesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PoliciesClient.java new file mode 100644 index 000000000000..375754a907f0 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PoliciesClient.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.PolicyInner; +import com.azure.resourcemanager.devtestlabs.models.PolicyFragment; + +/** An instance of this class provides access to all the operations defined in PoliciesClient. */ +public interface PoliciesClient { + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String policySetName); + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PolicyInner get(String resourceGroupName, String labName, String policySetName, String name); + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String policySetName, String name, String expand, Context context); + + /** + * Create or replace an existing policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PolicyInner createOrUpdate( + String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy); + + /** + * Create or replace an existing policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String policySetName, + String name, + PolicyInner policy, + Context context); + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String policySetName, String name); + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String labName, String policySetName, String name, Context context); + + /** + * Allows modifying tags of policies. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PolicyInner update( + String resourceGroupName, String labName, String policySetName, String name, PolicyFragment policy); + + /** + * Allows modifying tags of policies. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String labName, + String policySetName, + String name, + PolicyFragment policy, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PolicySetsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PolicySetsClient.java new file mode 100644 index 000000000000..41aec72bb87e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/PolicySetsClient.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.EvaluatePoliciesResponseInner; +import com.azure.resourcemanager.devtestlabs.models.EvaluatePoliciesRequest; + +/** An instance of this class provides access to all the operations defined in PolicySetsClient. */ +public interface PolicySetsClient { + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EvaluatePoliciesResponseInner evaluatePolicies( + String resourceGroupName, String labName, String name, EvaluatePoliciesRequest evaluatePoliciesRequest); + + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response evaluatePoliciesWithResponse( + String resourceGroupName, + String labName, + String name, + EvaluatePoliciesRequest evaluatePoliciesRequest, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ProviderOperationsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ProviderOperationsClient.java new file mode 100644 index 000000000000..8b5762ace47c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ProviderOperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner; + +/** An instance of this class provides access to all the operations defined in ProviderOperationsClient. */ +public interface ProviderOperationsClient { + /** + * Result of the request to list REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Result of the request to list REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SchedulesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SchedulesClient.java new file mode 100644 index 000000000000..ea32206bbdd6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SchedulesClient.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; + +/** An instance of this class provides access to all the operations defined in SchedulesClient. */ +public interface SchedulesClient { + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner get(String resourceGroupName, String labName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner createOrUpdate(String resourceGroupName, String labName, String name, ScheduleInner schedule); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ScheduleInner schedule, Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner update(String resourceGroupName, String labName, String name, ScheduleFragment schedule); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String name, ScheduleFragment schedule, Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute(String resourceGroupName, String labName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String name, Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String labName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String labName, String name, Context context); + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listApplicable(String resourceGroupName, String labName, String name); + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listApplicable(String resourceGroupName, String labName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SecretsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SecretsClient.java new file mode 100644 index 000000000000..4eefb92a8939 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/SecretsClient.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.SecretInner; +import com.azure.resourcemanager.devtestlabs.models.SecretFragment; + +/** An instance of this class provides access to all the operations defined in SecretsClient. */ +public interface SecretsClient { + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretInner get(String resourceGroupName, String labName, String username, String name); + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SecretInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret); + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, SecretInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret, Context context); + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret); + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret, Context context); + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Allows modifying tags of secrets. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecretInner update(String resourceGroupName, String labName, String username, String name, SecretFragment secret); + + /** + * Allows modifying tags of secrets. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String username, String name, SecretFragment secret, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricSchedulesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricSchedulesClient.java new file mode 100644 index 000000000000..76f59363278b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricSchedulesClient.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; + +/** An instance of this class provides access to all the operations defined in ServiceFabricSchedulesClient. */ +public interface ServiceFabricSchedulesClient { + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String labName, String username, String serviceFabricName); + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner get(String resourceGroupName, String labName, String username, String serviceFabricName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + String expand, + Context context); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner createOrUpdate( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule, + Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String serviceFabricName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner update( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule, + Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String username, String serviceFabricName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String labName, String username, String serviceFabricName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricsClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricsClient.java new file mode 100644 index 000000000000..dfd47c899d69 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceFabricsClient.java @@ -0,0 +1,432 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceFabricInner; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabricFragment; + +/** An instance of this class provides access to all the operations defined in ServiceFabricsClient. */ +public interface ServiceFabricsClient { + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceFabricInner get(String resourceGroupName, String labName, String username, String name); + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServiceFabricInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, ServiceFabricInner serviceFabric); + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServiceFabricInner> beginCreateOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricInner serviceFabric, + Context context); + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceFabricInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, ServiceFabricInner serviceFabric); + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceFabricInner createOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricInner serviceFabric, + Context context); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceFabricInner update( + String resourceGroupName, String labName, String username, String name, ServiceFabricFragment serviceFabric); + + /** + * Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricFragment serviceFabric, + Context context); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicableScheduleInner listApplicableSchedules( + String resourceGroupName, String labName, String username, String name); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart( + String resourceGroupName, String labName, String username, String name); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String labName, String username, String name); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStop( + String resourceGroupName, String labName, String username, String name); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStop( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String labName, String username, String name); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String labName, String username, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceRunnersClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceRunnersClient.java new file mode 100644 index 000000000000..bd2b2736a4cb --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/ServiceRunnersClient.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceRunnerInner; + +/** An instance of this class provides access to all the operations defined in ServiceRunnersClient. */ +public interface ServiceRunnersClient { + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceRunnerInner get(String resourceGroupName, String labName, String name); + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, Context context); + + /** + * Create or replace an existing service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a managed identity to execute DevTest lab services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceRunnerInner createOrUpdate( + String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner); + + /** + * Create or replace an existing service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a managed identity to execute DevTest lab services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner, Context context); + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/UsersClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/UsersClient.java new file mode 100644 index 000000000000..4b11461cecb0 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/UsersClient.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.UserInner; +import com.azure.resourcemanager.devtestlabs.models.UserFragment; + +/** An instance of this class provides access to all the operations defined in UsersClient. */ +public interface UsersClient { + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UserInner get(String resourceGroupName, String labName, String name); + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, UserInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, UserInner user); + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, UserInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, UserInner user, Context context); + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UserInner createOrUpdate(String resourceGroupName, String labName, String name, UserInner user); + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UserInner createOrUpdate(String resourceGroupName, String labName, String name, UserInner user, Context context); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of user profiles. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UserInner update(String resourceGroupName, String labName, String name, UserFragment user); + + /** + * Allows modifying tags of user profiles. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String name, UserFragment user, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachineSchedulesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachineSchedulesClient.java new file mode 100644 index 000000000000..f65bbd0104c7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachineSchedulesClient.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; + +/** An instance of this class provides access to all the operations defined in VirtualMachineSchedulesClient. */ +public interface VirtualMachineSchedulesClient { + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName, String virtualMachineName); + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner get(String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + String expand, + Context context); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner createOrUpdate( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleInner schedule, + Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduleInner update( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleFragment schedule, + Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void execute(String resourceGroupName, String labName, String virtualMachineName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachinesClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachinesClient.java new file mode 100644 index 000000000000..317f3a8544ea --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualMachinesClient.java @@ -0,0 +1,1011 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVirtualMachineInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.RdpConnectionInner; +import com.azure.resourcemanager.devtestlabs.models.ApplyArtifactsRequest; +import com.azure.resourcemanager.devtestlabs.models.DataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineFragment; +import com.azure.resourcemanager.devtestlabs.models.ResizeLabVirtualMachineProperties; + +/** An instance of this class provides access to all the operations defined in VirtualMachinesClient. */ +public interface VirtualMachinesClient { + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabVirtualMachineInner get(String resourceGroupName, String labName, String name); + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LabVirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine); + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, LabVirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineInner labVirtualMachine, + Context context); + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabVirtualMachineInner createOrUpdate( + String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine); + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabVirtualMachineInner createOrUpdate( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineInner labVirtualMachine, + Context context); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LabVirtualMachineInner update( + String resourceGroupName, String labName, String name, LabVirtualMachineFragment labVirtualMachine); + + /** + * Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineFragment labVirtualMachine, + Context context); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginAddDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginAddDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void addDataDisk(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void addDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginApplyArtifacts( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginApplyArtifacts( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void applyArtifacts( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void applyArtifacts( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginClaim(String resourceGroupName, String labName, String name); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginClaim( + String resourceGroupName, String labName, String name, Context context); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void claim(String resourceGroupName, String labName, String name); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void claim(String resourceGroupName, String labName, String name, Context context); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDetachDataDisk( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDetachDataDisk( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void detachDataDisk( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void detachDataDisk( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context); + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RdpConnectionInner getRdpFileContents(String resourceGroupName, String labName, String name); + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getRdpFileContentsWithResponse( + String resourceGroupName, String labName, String name, Context context); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicableScheduleInner listApplicableSchedules(String resourceGroupName, String labName, String name); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String name, Context context); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRedeploy(String resourceGroupName, String labName, String name); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRedeploy( + String resourceGroupName, String labName, String name, Context context); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void redeploy(String resourceGroupName, String labName, String name); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void redeploy(String resourceGroupName, String labName, String name, Context context); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginResize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginResize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRestart(String resourceGroupName, String labName, String name); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRestart( + String resourceGroupName, String labName, String name, Context context); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String labName, String name); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String labName, String name, Context context); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart(String resourceGroupName, String labName, String name); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart( + String resourceGroupName, String labName, String name, Context context); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String labName, String name); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String labName, String name, Context context); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStop(String resourceGroupName, String labName, String name); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStop( + String resourceGroupName, String labName, String name, Context context); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String labName, String name); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String labName, String name, Context context); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTransferDisks(String resourceGroupName, String labName, String name); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginTransferDisks( + String resourceGroupName, String labName, String name, Context context); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void transferDisks(String resourceGroupName, String labName, String name); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void transferDisks(String resourceGroupName, String labName, String name, Context context); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginUnClaim(String resourceGroupName, String labName, String name); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginUnClaim( + String resourceGroupName, String labName, String name, Context context); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void unClaim(String resourceGroupName, String labName, String name); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void unClaim(String resourceGroupName, String labName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualNetworksClient.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualNetworksClient.java new file mode 100644 index 000000000000..aa4dc054554c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/VirtualNetworksClient.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetworkFragment; + +/** An instance of this class provides access to all the operations defined in VirtualNetworksClient. */ +public interface VirtualNetworksClient { + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String labName); + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner get(String resourceGroupName, String labName, String name); + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork); + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, Context context); + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner createOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork); + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner createOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, Context context); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkInner update( + String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork); + + /** + * Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ApplicableScheduleInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ApplicableScheduleInner.java new file mode 100644 index 000000000000..1fb9d099da1c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ApplicableScheduleInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Schedules applicable to a virtual machine. The schedules may have been defined on a VM or on lab level. */ +@JsonFlatten +@Fluent +public class ApplicableScheduleInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicableScheduleInner.class); + + /* + * The auto-shutdown schedule, if one has been set at the lab or lab + * resource level. + */ + @JsonProperty(value = "properties.labVmsShutdown") + private ScheduleInner labVmsShutdown; + + /* + * The auto-startup schedule, if one has been set at the lab or lab + * resource level. + */ + @JsonProperty(value = "properties.labVmsStartup") + private ScheduleInner labVmsStartup; + + /** + * Get the labVmsShutdown property: The auto-shutdown schedule, if one has been set at the lab or lab resource + * level. + * + * @return the labVmsShutdown value. + */ + public ScheduleInner labVmsShutdown() { + return this.labVmsShutdown; + } + + /** + * Set the labVmsShutdown property: The auto-shutdown schedule, if one has been set at the lab or lab resource + * level. + * + * @param labVmsShutdown the labVmsShutdown value to set. + * @return the ApplicableScheduleInner object itself. + */ + public ApplicableScheduleInner withLabVmsShutdown(ScheduleInner labVmsShutdown) { + this.labVmsShutdown = labVmsShutdown; + return this; + } + + /** + * Get the labVmsStartup property: The auto-startup schedule, if one has been set at the lab or lab resource level. + * + * @return the labVmsStartup value. + */ + public ScheduleInner labVmsStartup() { + return this.labVmsStartup; + } + + /** + * Set the labVmsStartup property: The auto-startup schedule, if one has been set at the lab or lab resource level. + * + * @param labVmsStartup the labVmsStartup value to set. + * @return the ApplicableScheduleInner object itself. + */ + public ApplicableScheduleInner withLabVmsStartup(ScheduleInner labVmsStartup) { + this.labVmsStartup = labVmsStartup; + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicableScheduleInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicableScheduleInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (labVmsShutdown() != null) { + labVmsShutdown().validate(); + } + if (labVmsStartup() != null) { + labVmsStartup().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInfoInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInfoInner.java new file mode 100644 index 000000000000..d751614cb14c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInfoInner.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a generated ARM template. */ +@Fluent +public final class ArmTemplateInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmTemplateInfoInner.class); + + /* + * The template's contents. + */ + @JsonProperty(value = "template") + private Object template; + + /* + * The parameters of the ARM template. + */ + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * Get the template property: The template's contents. + * + * @return the template value. + */ + public Object template() { + return this.template; + } + + /** + * Set the template property: The template's contents. + * + * @param template the template value to set. + * @return the ArmTemplateInfoInner object itself. + */ + public ArmTemplateInfoInner withTemplate(Object template) { + this.template = template; + return this; + } + + /** + * Get the parameters property: The parameters of the ARM template. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters of the ARM template. + * + * @param parameters the parameters value to set. + * @return the ArmTemplateInfoInner object itself. + */ + public ArmTemplateInfoInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInner.java new file mode 100644 index 000000000000..fa6c94a5a485 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArmTemplateInner.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.ParametersValueFileInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An Azure Resource Manager template. */ +@JsonFlatten +@Immutable +public class ArmTemplateInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmTemplateInner.class); + + /* + * The display name of the ARM template. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The description of the ARM template. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The publisher of the ARM template. + */ + @JsonProperty(value = "properties.publisher", access = JsonProperty.Access.WRITE_ONLY) + private String publisher; + + /* + * The URI to the icon of the ARM template. + */ + @JsonProperty(value = "properties.icon", access = JsonProperty.Access.WRITE_ONLY) + private String icon; + + /* + * The contents of the ARM template. + */ + @JsonProperty(value = "properties.contents", access = JsonProperty.Access.WRITE_ONLY) + private Object contents; + + /* + * The creation date of the armTemplate. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * File name and parameter values information from all + * azuredeploy.*.parameters.json for the ARM template. + */ + @JsonProperty(value = "properties.parametersValueFilesInfo", access = JsonProperty.Access.WRITE_ONLY) + private List parametersValueFilesInfo; + + /* + * Whether or not ARM template is enabled for use by lab user. + */ + @JsonProperty(value = "properties.enabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean enabled; + + /** + * Get the displayName property: The display name of the ARM template. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the description property: The description of the ARM template. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the publisher property: The publisher of the ARM template. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the icon property: The URI to the icon of the ARM template. + * + * @return the icon value. + */ + public String icon() { + return this.icon; + } + + /** + * Get the contents property: The contents of the ARM template. + * + * @return the contents value. + */ + public Object contents() { + return this.contents; + } + + /** + * Get the createdDate property: The creation date of the armTemplate. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the parametersValueFilesInfo property: File name and parameter values information from all + * azuredeploy.*.parameters.json for the ARM template. + * + * @return the parametersValueFilesInfo value. + */ + public List parametersValueFilesInfo() { + return this.parametersValueFilesInfo; + } + + /** + * Get the enabled property: Whether or not ARM template is enabled for use by lab user. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** {@inheritDoc} */ + @Override + public ArmTemplateInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ArmTemplateInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parametersValueFilesInfo() != null) { + parametersValueFilesInfo().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactInner.java new file mode 100644 index 000000000000..337b3537e162 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactInner.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An artifact. */ +@JsonFlatten +@Immutable +public class ArtifactInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactInner.class); + + /* + * The artifact's title. + */ + @JsonProperty(value = "properties.title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /* + * The artifact's description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The artifact's publisher. + */ + @JsonProperty(value = "properties.publisher", access = JsonProperty.Access.WRITE_ONLY) + private String publisher; + + /* + * The file path to the artifact. + */ + @JsonProperty(value = "properties.filePath", access = JsonProperty.Access.WRITE_ONLY) + private String filePath; + + /* + * The URI to the artifact icon. + */ + @JsonProperty(value = "properties.icon", access = JsonProperty.Access.WRITE_ONLY) + private String icon; + + /* + * The artifact's target OS. + */ + @JsonProperty(value = "properties.targetOsType", access = JsonProperty.Access.WRITE_ONLY) + private String targetOsType; + + /* + * The artifact's parameters. + */ + @JsonProperty(value = "properties.parameters", access = JsonProperty.Access.WRITE_ONLY) + private Object parameters; + + /* + * The artifact's creation date. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /** + * Get the title property: The artifact's title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Get the description property: The artifact's description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the publisher property: The artifact's publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the filePath property: The file path to the artifact. + * + * @return the filePath value. + */ + public String filePath() { + return this.filePath; + } + + /** + * Get the icon property: The URI to the artifact icon. + * + * @return the icon value. + */ + public String icon() { + return this.icon; + } + + /** + * Get the targetOsType property: The artifact's target OS. + * + * @return the targetOsType value. + */ + public String targetOsType() { + return this.targetOsType; + } + + /** + * Get the parameters property: The artifact's parameters. + * + * @return the parameters value. + */ + public Object parameters() { + return this.parameters; + } + + /** + * Get the createdDate property: The artifact's creation date. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** {@inheritDoc} */ + @Override + public ArtifactInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ArtifactInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactSourceInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactSourceInner.java new file mode 100644 index 000000000000..eea399ba1661 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ArtifactSourceInner.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.EnableStatus; +import com.azure.resourcemanager.devtestlabs.models.SourceControlType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Properties of an artifact source. */ +@JsonFlatten +@Fluent +public class ArtifactSourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourceInner.class); + + /* + * The artifact source's display name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * The artifact source's URI. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /* + * The artifact source's type. + */ + @JsonProperty(value = "properties.sourceType") + private SourceControlType sourceType; + + /* + * The folder containing artifacts. + */ + @JsonProperty(value = "properties.folderPath") + private String folderPath; + + /* + * The folder containing Azure Resource Manager templates. + */ + @JsonProperty(value = "properties.armTemplateFolderPath") + private String armTemplateFolderPath; + + /* + * The artifact source's branch reference. + */ + @JsonProperty(value = "properties.branchRef") + private String branchRef; + + /* + * The security token to authenticate to the artifact source. + */ + @JsonProperty(value = "properties.securityToken") + private String securityToken; + + /* + * Indicates if the artifact source is enabled (values: Enabled, Disabled). + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /* + * The artifact source's creation date. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the displayName property: The artifact source's display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The artifact source's display name. + * + * @param displayName the displayName value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the uri property: The artifact source's URI. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The artifact source's URI. + * + * @param uri the uri value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the sourceType property: The artifact source's type. + * + * @return the sourceType value. + */ + public SourceControlType sourceType() { + return this.sourceType; + } + + /** + * Set the sourceType property: The artifact source's type. + * + * @param sourceType the sourceType value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withSourceType(SourceControlType sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get the folderPath property: The folder containing artifacts. + * + * @return the folderPath value. + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Set the folderPath property: The folder containing artifacts. + * + * @param folderPath the folderPath value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the armTemplateFolderPath property: The folder containing Azure Resource Manager templates. + * + * @return the armTemplateFolderPath value. + */ + public String armTemplateFolderPath() { + return this.armTemplateFolderPath; + } + + /** + * Set the armTemplateFolderPath property: The folder containing Azure Resource Manager templates. + * + * @param armTemplateFolderPath the armTemplateFolderPath value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withArmTemplateFolderPath(String armTemplateFolderPath) { + this.armTemplateFolderPath = armTemplateFolderPath; + return this; + } + + /** + * Get the branchRef property: The artifact source's branch reference. + * + * @return the branchRef value. + */ + public String branchRef() { + return this.branchRef; + } + + /** + * Set the branchRef property: The artifact source's branch reference. + * + * @param branchRef the branchRef value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withBranchRef(String branchRef) { + this.branchRef = branchRef; + return this; + } + + /** + * Get the securityToken property: The security token to authenticate to the artifact source. + * + * @return the securityToken value. + */ + public String securityToken() { + return this.securityToken; + } + + /** + * Set the securityToken property: The security token to authenticate to the artifact source. + * + * @param securityToken the securityToken value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withSecurityToken(String securityToken) { + this.securityToken = securityToken; + return this; + } + + /** + * Get the status property: Indicates if the artifact source is enabled (values: Enabled, Disabled). + * + * @return the status value. + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates if the artifact source is enabled (values: Enabled, Disabled). + * + * @param status the status value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withStatus(EnableStatus status) { + this.status = status; + return this; + } + + /** + * Get the createdDate property: The artifact source's creation date. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public ArtifactSourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ArtifactSourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/CustomImageInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/CustomImageInner.java new file mode 100644 index 000000000000..4c183a014e1d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/CustomImageInner.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesCustom; +import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesFromPlan; +import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesFromVm; +import com.azure.resourcemanager.devtestlabs.models.DataDiskStorageTypeInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** A custom image. */ +@JsonFlatten +@Fluent +public class CustomImageInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomImageInner.class); + + /* + * The virtual machine from which the image is to be created. + */ + @JsonProperty(value = "properties.vm") + private CustomImagePropertiesFromVm vm; + + /* + * The VHD from which the image is to be created. + */ + @JsonProperty(value = "properties.vhd") + private CustomImagePropertiesCustom vhd; + + /* + * The description of the custom image. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The author of the custom image. + */ + @JsonProperty(value = "properties.author") + private String author; + + /* + * The creation date of the custom image. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The Managed Image Id backing the custom image. + */ + @JsonProperty(value = "properties.managedImageId") + private String managedImageId; + + /* + * The Managed Snapshot Id backing the custom image. + */ + @JsonProperty(value = "properties.managedSnapshotId") + private String managedSnapshotId; + + /* + * Storage information about the data disks present in the custom image + */ + @JsonProperty(value = "properties.dataDiskStorageInfo") + private List dataDiskStorageInfo; + + /* + * Storage information about the plan related to this custom image + */ + @JsonProperty(value = "properties.customImagePlan") + private CustomImagePropertiesFromPlan customImagePlan; + + /* + * Whether or not the custom images underlying offer/plan has been enabled + * for programmatic deployment + */ + @JsonProperty(value = "properties.isPlanAuthorized") + private Boolean isPlanAuthorized; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the vm property: The virtual machine from which the image is to be created. + * + * @return the vm value. + */ + public CustomImagePropertiesFromVm vm() { + return this.vm; + } + + /** + * Set the vm property: The virtual machine from which the image is to be created. + * + * @param vm the vm value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withVm(CustomImagePropertiesFromVm vm) { + this.vm = vm; + return this; + } + + /** + * Get the vhd property: The VHD from which the image is to be created. + * + * @return the vhd value. + */ + public CustomImagePropertiesCustom vhd() { + return this.vhd; + } + + /** + * Set the vhd property: The VHD from which the image is to be created. + * + * @param vhd the vhd value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withVhd(CustomImagePropertiesCustom vhd) { + this.vhd = vhd; + return this; + } + + /** + * Get the description property: The description of the custom image. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the custom image. + * + * @param description the description value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the author property: The author of the custom image. + * + * @return the author value. + */ + public String author() { + return this.author; + } + + /** + * Set the author property: The author of the custom image. + * + * @param author the author value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withAuthor(String author) { + this.author = author; + return this; + } + + /** + * Get the creationDate property: The creation date of the custom image. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the managedImageId property: The Managed Image Id backing the custom image. + * + * @return the managedImageId value. + */ + public String managedImageId() { + return this.managedImageId; + } + + /** + * Set the managedImageId property: The Managed Image Id backing the custom image. + * + * @param managedImageId the managedImageId value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withManagedImageId(String managedImageId) { + this.managedImageId = managedImageId; + return this; + } + + /** + * Get the managedSnapshotId property: The Managed Snapshot Id backing the custom image. + * + * @return the managedSnapshotId value. + */ + public String managedSnapshotId() { + return this.managedSnapshotId; + } + + /** + * Set the managedSnapshotId property: The Managed Snapshot Id backing the custom image. + * + * @param managedSnapshotId the managedSnapshotId value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withManagedSnapshotId(String managedSnapshotId) { + this.managedSnapshotId = managedSnapshotId; + return this; + } + + /** + * Get the dataDiskStorageInfo property: Storage information about the data disks present in the custom image. + * + * @return the dataDiskStorageInfo value. + */ + public List dataDiskStorageInfo() { + return this.dataDiskStorageInfo; + } + + /** + * Set the dataDiskStorageInfo property: Storage information about the data disks present in the custom image. + * + * @param dataDiskStorageInfo the dataDiskStorageInfo value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withDataDiskStorageInfo(List dataDiskStorageInfo) { + this.dataDiskStorageInfo = dataDiskStorageInfo; + return this; + } + + /** + * Get the customImagePlan property: Storage information about the plan related to this custom image. + * + * @return the customImagePlan value. + */ + public CustomImagePropertiesFromPlan customImagePlan() { + return this.customImagePlan; + } + + /** + * Set the customImagePlan property: Storage information about the plan related to this custom image. + * + * @param customImagePlan the customImagePlan value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withCustomImagePlan(CustomImagePropertiesFromPlan customImagePlan) { + this.customImagePlan = customImagePlan; + return this; + } + + /** + * Get the isPlanAuthorized property: Whether or not the custom images underlying offer/plan has been enabled for + * programmatic deployment. + * + * @return the isPlanAuthorized value. + */ + public Boolean isPlanAuthorized() { + return this.isPlanAuthorized; + } + + /** + * Set the isPlanAuthorized property: Whether or not the custom images underlying offer/plan has been enabled for + * programmatic deployment. + * + * @param isPlanAuthorized the isPlanAuthorized value to set. + * @return the CustomImageInner object itself. + */ + public CustomImageInner withIsPlanAuthorized(Boolean isPlanAuthorized) { + this.isPlanAuthorized = isPlanAuthorized; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public CustomImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public CustomImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vm() != null) { + vm().validate(); + } + if (vhd() != null) { + vhd().validate(); + } + if (dataDiskStorageInfo() != null) { + dataDiskStorageInfo().forEach(e -> e.validate()); + } + if (customImagePlan() != null) { + customImagePlan().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DiskInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DiskInner.java new file mode 100644 index 000000000000..e0846e50558f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DiskInner.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.StorageType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A Disk. */ +@JsonFlatten +@Fluent +public class DiskInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskInner.class); + + /* + * The storage type for the disk (i.e. Standard, Premium). + */ + @JsonProperty(value = "properties.diskType") + private StorageType diskType; + + /* + * The size of the disk in Gibibytes. + */ + @JsonProperty(value = "properties.diskSizeGiB") + private Integer diskSizeGiB; + + /* + * The resource ID of the VM to which this disk is leased. + */ + @JsonProperty(value = "properties.leasedByLabVmId") + private String leasedByLabVmId; + + /* + * When backed by a blob, the name of the VHD blob without extension. + */ + @JsonProperty(value = "properties.diskBlobName") + private String diskBlobName; + + /* + * When backed by a blob, the URI of underlying blob. + */ + @JsonProperty(value = "properties.diskUri") + private String diskUri; + + /* + * When backed by a blob, the storage account where the blob is. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /* + * The creation date of the disk. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + */ + @JsonProperty(value = "properties.hostCaching") + private String hostCaching; + + /* + * When backed by managed disk, this is the ID of the compute disk + * resource. + */ + @JsonProperty(value = "properties.managedDiskId") + private String managedDiskId; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the diskType property: The storage type for the disk (i.e. Standard, Premium). + * + * @return the diskType value. + */ + public StorageType diskType() { + return this.diskType; + } + + /** + * Set the diskType property: The storage type for the disk (i.e. Standard, Premium). + * + * @param diskType the diskType value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskType(StorageType diskType) { + this.diskType = diskType; + return this; + } + + /** + * Get the diskSizeGiB property: The size of the disk in Gibibytes. + * + * @return the diskSizeGiB value. + */ + public Integer diskSizeGiB() { + return this.diskSizeGiB; + } + + /** + * Set the diskSizeGiB property: The size of the disk in Gibibytes. + * + * @param diskSizeGiB the diskSizeGiB value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskSizeGiB(Integer diskSizeGiB) { + this.diskSizeGiB = diskSizeGiB; + return this; + } + + /** + * Get the leasedByLabVmId property: The resource ID of the VM to which this disk is leased. + * + * @return the leasedByLabVmId value. + */ + public String leasedByLabVmId() { + return this.leasedByLabVmId; + } + + /** + * Set the leasedByLabVmId property: The resource ID of the VM to which this disk is leased. + * + * @param leasedByLabVmId the leasedByLabVmId value to set. + * @return the DiskInner object itself. + */ + public DiskInner withLeasedByLabVmId(String leasedByLabVmId) { + this.leasedByLabVmId = leasedByLabVmId; + return this; + } + + /** + * Get the diskBlobName property: When backed by a blob, the name of the VHD blob without extension. + * + * @return the diskBlobName value. + */ + public String diskBlobName() { + return this.diskBlobName; + } + + /** + * Set the diskBlobName property: When backed by a blob, the name of the VHD blob without extension. + * + * @param diskBlobName the diskBlobName value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskBlobName(String diskBlobName) { + this.diskBlobName = diskBlobName; + return this; + } + + /** + * Get the diskUri property: When backed by a blob, the URI of underlying blob. + * + * @return the diskUri value. + */ + public String diskUri() { + return this.diskUri; + } + + /** + * Set the diskUri property: When backed by a blob, the URI of underlying blob. + * + * @param diskUri the diskUri value to set. + * @return the DiskInner object itself. + */ + public DiskInner withDiskUri(String diskUri) { + this.diskUri = diskUri; + return this; + } + + /** + * Get the storageAccountId property: When backed by a blob, the storage account where the blob is. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: When backed by a blob, the storage account where the blob is. + * + * @param storageAccountId the storageAccountId value to set. + * @return the DiskInner object itself. + */ + public DiskInner withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the createdDate property: The creation date of the disk. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the hostCaching property: The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + * + * @return the hostCaching value. + */ + public String hostCaching() { + return this.hostCaching; + } + + /** + * Set the hostCaching property: The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + * + * @param hostCaching the hostCaching value to set. + * @return the DiskInner object itself. + */ + public DiskInner withHostCaching(String hostCaching) { + this.hostCaching = hostCaching; + return this; + } + + /** + * Get the managedDiskId property: When backed by managed disk, this is the ID of the compute disk resource. + * + * @return the managedDiskId value. + */ + public String managedDiskId() { + return this.managedDiskId; + } + + /** + * Set the managedDiskId property: When backed by managed disk, this is the ID of the compute disk resource. + * + * @param managedDiskId the managedDiskId value to set. + * @return the DiskInner object itself. + */ + public DiskInner withManagedDiskId(String managedDiskId) { + this.managedDiskId = managedDiskId; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public DiskInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DiskInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DtlEnvironmentInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DtlEnvironmentInner.java new file mode 100644 index 000000000000..024dc79df197 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/DtlEnvironmentInner.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.EnvironmentDeploymentProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An environment, which is essentially an ARM template deployment. */ +@JsonFlatten +@Fluent +public class DtlEnvironmentInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DtlEnvironmentInner.class); + + /* + * The deployment properties of the environment. + */ + @JsonProperty(value = "properties.deploymentProperties") + private EnvironmentDeploymentProperties deploymentProperties; + + /* + * The display name of the Azure Resource Manager template that produced + * the environment. + */ + @JsonProperty(value = "properties.armTemplateDisplayName") + private String armTemplateDisplayName; + + /* + * The identifier of the resource group containing the environment's + * resources. + */ + @JsonProperty(value = "properties.resourceGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroupId; + + /* + * The creator of the environment. + */ + @JsonProperty(value = "properties.createdByUser", access = JsonProperty.Access.WRITE_ONLY) + private String createdByUser; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the deploymentProperties property: The deployment properties of the environment. + * + * @return the deploymentProperties value. + */ + public EnvironmentDeploymentProperties deploymentProperties() { + return this.deploymentProperties; + } + + /** + * Set the deploymentProperties property: The deployment properties of the environment. + * + * @param deploymentProperties the deploymentProperties value to set. + * @return the DtlEnvironmentInner object itself. + */ + public DtlEnvironmentInner withDeploymentProperties(EnvironmentDeploymentProperties deploymentProperties) { + this.deploymentProperties = deploymentProperties; + return this; + } + + /** + * Get the armTemplateDisplayName property: The display name of the Azure Resource Manager template that produced + * the environment. + * + * @return the armTemplateDisplayName value. + */ + public String armTemplateDisplayName() { + return this.armTemplateDisplayName; + } + + /** + * Set the armTemplateDisplayName property: The display name of the Azure Resource Manager template that produced + * the environment. + * + * @param armTemplateDisplayName the armTemplateDisplayName value to set. + * @return the DtlEnvironmentInner object itself. + */ + public DtlEnvironmentInner withArmTemplateDisplayName(String armTemplateDisplayName) { + this.armTemplateDisplayName = armTemplateDisplayName; + return this; + } + + /** + * Get the resourceGroupId property: The identifier of the resource group containing the environment's resources. + * + * @return the resourceGroupId value. + */ + public String resourceGroupId() { + return this.resourceGroupId; + } + + /** + * Get the createdByUser property: The creator of the environment. + * + * @return the createdByUser value. + */ + public String createdByUser() { + return this.createdByUser; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public DtlEnvironmentInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DtlEnvironmentInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deploymentProperties() != null) { + deploymentProperties().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/EvaluatePoliciesResponseInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/EvaluatePoliciesResponseInner.java new file mode 100644 index 000000000000..0c048e7821f4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/EvaluatePoliciesResponseInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.PolicySetResult; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response body for evaluating a policy set. */ +@Fluent +public final class EvaluatePoliciesResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EvaluatePoliciesResponseInner.class); + + /* + * Results of evaluating a policy set. + */ + @JsonProperty(value = "results") + private List results; + + /** + * Get the results property: Results of evaluating a policy set. + * + * @return the results value. + */ + public List results() { + return this.results; + } + + /** + * Set the results property: Results of evaluating a policy set. + * + * @param results the results value to set. + * @return the EvaluatePoliciesResponseInner object itself. + */ + public EvaluatePoliciesResponseInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() != null) { + results().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/FormulaInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/FormulaInner.java new file mode 100644 index 000000000000..6d92f275805c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/FormulaInner.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.FormulaPropertiesFromVm; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineCreationParameter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A formula for creating a VM, specifying an image base and other parameters. */ +@JsonFlatten +@Fluent +public class FormulaInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FormulaInner.class); + + /* + * The description of the formula. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The author of the formula. + */ + @JsonProperty(value = "properties.author", access = JsonProperty.Access.WRITE_ONLY) + private String author; + + /* + * The OS type of the formula. + */ + @JsonProperty(value = "properties.osType") + private String osType; + + /* + * The creation date of the formula. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /* + * The content of the formula. + */ + @JsonProperty(value = "properties.formulaContent") + private LabVirtualMachineCreationParameter formulaContent; + + /* + * Information about a VM from which a formula is to be created. + */ + @JsonProperty(value = "properties.vm") + private FormulaPropertiesFromVm vm; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the description property: The description of the formula. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the formula. + * + * @param description the description value to set. + * @return the FormulaInner object itself. + */ + public FormulaInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the author property: The author of the formula. + * + * @return the author value. + */ + public String author() { + return this.author; + } + + /** + * Get the osType property: The OS type of the formula. + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Set the osType property: The OS type of the formula. + * + * @param osType the osType value to set. + * @return the FormulaInner object itself. + */ + public FormulaInner withOsType(String osType) { + this.osType = osType; + return this; + } + + /** + * Get the creationDate property: The creation date of the formula. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the formulaContent property: The content of the formula. + * + * @return the formulaContent value. + */ + public LabVirtualMachineCreationParameter formulaContent() { + return this.formulaContent; + } + + /** + * Set the formulaContent property: The content of the formula. + * + * @param formulaContent the formulaContent value to set. + * @return the FormulaInner object itself. + */ + public FormulaInner withFormulaContent(LabVirtualMachineCreationParameter formulaContent) { + this.formulaContent = formulaContent; + return this; + } + + /** + * Get the vm property: Information about a VM from which a formula is to be created. + * + * @return the vm value. + */ + public FormulaPropertiesFromVm vm() { + return this.vm; + } + + /** + * Set the vm property: Information about a VM from which a formula is to be created. + * + * @param vm the vm value to set. + * @return the FormulaInner object itself. + */ + public FormulaInner withVm(FormulaPropertiesFromVm vm) { + this.vm = vm; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public FormulaInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public FormulaInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (formulaContent() != null) { + formulaContent().validate(); + } + if (vm() != null) { + vm().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GalleryImageInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GalleryImageInner.java new file mode 100644 index 000000000000..3c8655bfdb48 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GalleryImageInner.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.GalleryImageReference; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A gallery image. */ +@JsonFlatten +@Fluent +public class GalleryImageInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageInner.class); + + /* + * The author of the gallery image. + */ + @JsonProperty(value = "properties.author") + private String author; + + /* + * The creation date of the gallery image. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The description of the gallery image. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The image reference of the gallery image. + */ + @JsonProperty(value = "properties.imageReference") + private GalleryImageReference imageReference; + + /* + * The icon of the gallery image. + */ + @JsonProperty(value = "properties.icon") + private String icon; + + /* + * Indicates whether this gallery image is enabled. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /* + * The third party plan that applies to this image + */ + @JsonProperty(value = "properties.planId") + private String planId; + + /* + * Indicates if the plan has been authorized for programmatic deployment. + */ + @JsonProperty(value = "properties.isPlanAuthorized") + private Boolean isPlanAuthorized; + + /** + * Get the author property: The author of the gallery image. + * + * @return the author value. + */ + public String author() { + return this.author; + } + + /** + * Set the author property: The author of the gallery image. + * + * @param author the author value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withAuthor(String author) { + this.author = author; + return this; + } + + /** + * Get the createdDate property: The creation date of the gallery image. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the description property: The description of the gallery image. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the gallery image. + * + * @param description the description value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the imageReference property: The image reference of the gallery image. + * + * @return the imageReference value. + */ + public GalleryImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: The image reference of the gallery image. + * + * @param imageReference the imageReference value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withImageReference(GalleryImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the icon property: The icon of the gallery image. + * + * @return the icon value. + */ + public String icon() { + return this.icon; + } + + /** + * Set the icon property: The icon of the gallery image. + * + * @param icon the icon value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withIcon(String icon) { + this.icon = icon; + return this; + } + + /** + * Get the enabled property: Indicates whether this gallery image is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this gallery image is enabled. + * + * @param enabled the enabled value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the planId property: The third party plan that applies to this image. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: The third party plan that applies to this image. + * + * @param planId the planId value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the isPlanAuthorized property: Indicates if the plan has been authorized for programmatic deployment. + * + * @return the isPlanAuthorized value. + */ + public Boolean isPlanAuthorized() { + return this.isPlanAuthorized; + } + + /** + * Set the isPlanAuthorized property: Indicates if the plan has been authorized for programmatic deployment. + * + * @param isPlanAuthorized the isPlanAuthorized value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withIsPlanAuthorized(Boolean isPlanAuthorized) { + this.isPlanAuthorized = isPlanAuthorized; + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public GalleryImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageReference() != null) { + imageReference().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GenerateUploadUriResponseInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GenerateUploadUriResponseInner.java new file mode 100644 index 000000000000..2a7b846f654c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/GenerateUploadUriResponseInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response body for generating an upload URI. */ +@Fluent +public final class GenerateUploadUriResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GenerateUploadUriResponseInner.class); + + /* + * The upload URI for the VHD. + */ + @JsonProperty(value = "uploadUri") + private String uploadUri; + + /** + * Get the uploadUri property: The upload URI for the VHD. + * + * @return the uploadUri value. + */ + public String uploadUri() { + return this.uploadUri; + } + + /** + * Set the uploadUri property: The upload URI for the VHD. + * + * @param uploadUri the uploadUri value to set. + * @return the GenerateUploadUriResponseInner object itself. + */ + public GenerateUploadUriResponseInner withUploadUri(String uploadUri) { + this.uploadUri = uploadUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabCostInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabCostInner.java new file mode 100644 index 000000000000..21455ba7d8d2 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabCostInner.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.LabCostDetailsProperties; +import com.azure.resourcemanager.devtestlabs.models.LabCostSummaryProperties; +import com.azure.resourcemanager.devtestlabs.models.LabResourceCostProperties; +import com.azure.resourcemanager.devtestlabs.models.TargetCostProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** A cost item. */ +@JsonFlatten +@Fluent +public class LabCostInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabCostInner.class); + + /* + * The target cost properties + */ + @JsonProperty(value = "properties.targetCost") + private TargetCostProperties targetCost; + + /* + * The lab cost summary component of the cost data. + */ + @JsonProperty(value = "properties.labCostSummary", access = JsonProperty.Access.WRITE_ONLY) + private LabCostSummaryProperties labCostSummary; + + /* + * The lab cost details component of the cost data. + */ + @JsonProperty(value = "properties.labCostDetails", access = JsonProperty.Access.WRITE_ONLY) + private List labCostDetails; + + /* + * The resource cost component of the cost data. + */ + @JsonProperty(value = "properties.resourceCosts", access = JsonProperty.Access.WRITE_ONLY) + private List resourceCosts; + + /* + * The currency code of the cost. + */ + @JsonProperty(value = "properties.currencyCode") + private String currencyCode; + + /* + * The start time of the cost data. + */ + @JsonProperty(value = "properties.startDateTime") + private OffsetDateTime startDateTime; + + /* + * The end time of the cost data. + */ + @JsonProperty(value = "properties.endDateTime") + private OffsetDateTime endDateTime; + + /* + * The creation date of the cost. + */ + @JsonProperty(value = "properties.createdDate") + private OffsetDateTime createdDate; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the targetCost property: The target cost properties. + * + * @return the targetCost value. + */ + public TargetCostProperties targetCost() { + return this.targetCost; + } + + /** + * Set the targetCost property: The target cost properties. + * + * @param targetCost the targetCost value to set. + * @return the LabCostInner object itself. + */ + public LabCostInner withTargetCost(TargetCostProperties targetCost) { + this.targetCost = targetCost; + return this; + } + + /** + * Get the labCostSummary property: The lab cost summary component of the cost data. + * + * @return the labCostSummary value. + */ + public LabCostSummaryProperties labCostSummary() { + return this.labCostSummary; + } + + /** + * Get the labCostDetails property: The lab cost details component of the cost data. + * + * @return the labCostDetails value. + */ + public List labCostDetails() { + return this.labCostDetails; + } + + /** + * Get the resourceCosts property: The resource cost component of the cost data. + * + * @return the resourceCosts value. + */ + public List resourceCosts() { + return this.resourceCosts; + } + + /** + * Get the currencyCode property: The currency code of the cost. + * + * @return the currencyCode value. + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currencyCode property: The currency code of the cost. + * + * @param currencyCode the currencyCode value to set. + * @return the LabCostInner object itself. + */ + public LabCostInner withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the startDateTime property: The start time of the cost data. + * + * @return the startDateTime value. + */ + public OffsetDateTime startDateTime() { + return this.startDateTime; + } + + /** + * Set the startDateTime property: The start time of the cost data. + * + * @param startDateTime the startDateTime value to set. + * @return the LabCostInner object itself. + */ + public LabCostInner withStartDateTime(OffsetDateTime startDateTime) { + this.startDateTime = startDateTime; + return this; + } + + /** + * Get the endDateTime property: The end time of the cost data. + * + * @return the endDateTime value. + */ + public OffsetDateTime endDateTime() { + return this.endDateTime; + } + + /** + * Set the endDateTime property: The end time of the cost data. + * + * @param endDateTime the endDateTime value to set. + * @return the LabCostInner object itself. + */ + public LabCostInner withEndDateTime(OffsetDateTime endDateTime) { + this.endDateTime = endDateTime; + return this; + } + + /** + * Get the createdDate property: The creation date of the cost. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Set the createdDate property: The creation date of the cost. + * + * @param createdDate the createdDate value to set. + * @return the LabCostInner object itself. + */ + public LabCostInner withCreatedDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public LabCostInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public LabCostInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetCost() != null) { + targetCost().validate(); + } + if (labCostSummary() != null) { + labCostSummary().validate(); + } + if (labCostDetails() != null) { + labCostDetails().forEach(e -> e.validate()); + } + if (resourceCosts() != null) { + resourceCosts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabInner.java new file mode 100644 index 000000000000..f69209b3665a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabInner.java @@ -0,0 +1,470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.EnvironmentPermission; +import com.azure.resourcemanager.devtestlabs.models.LabAnnouncementProperties; +import com.azure.resourcemanager.devtestlabs.models.LabSupportProperties; +import com.azure.resourcemanager.devtestlabs.models.PremiumDataDisk; +import com.azure.resourcemanager.devtestlabs.models.StorageType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** A lab. */ +@JsonFlatten +@Fluent +public class LabInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabInner.class); + + /* + * The lab's default storage account. + */ + @JsonProperty(value = "properties.defaultStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String defaultStorageAccount; + + /* + * The lab's default premium storage account. + */ + @JsonProperty(value = "properties.defaultPremiumStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String defaultPremiumStorageAccount; + + /* + * The lab's artifact storage account. + */ + @JsonProperty(value = "properties.artifactsStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String artifactsStorageAccount; + + /* + * The lab's premium data disk storage account. + */ + @JsonProperty(value = "properties.premiumDataDiskStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String premiumDataDiskStorageAccount; + + /* + * The lab's Key vault. + */ + @JsonProperty(value = "properties.vaultName", access = JsonProperty.Access.WRITE_ONLY) + private String vaultName; + + /* + * Type of storage used by the lab. It can be either Premium or Standard. + * Default is Premium. + */ + @JsonProperty(value = "properties.labStorageType") + private StorageType labStorageType; + + /* + * 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(value = "properties.mandatoryArtifactsResourceIdsLinux") + private List mandatoryArtifactsResourceIdsLinux; + + /* + * 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(value = "properties.mandatoryArtifactsResourceIdsWindows") + private List mandatoryArtifactsResourceIdsWindows; + + /* + * The creation date of the lab. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * 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. + */ + @JsonProperty(value = "properties.premiumDataDisks") + private PremiumDataDisk premiumDataDisks; + + /* + * The access rights to be granted to the user when provisioning an + * environment + */ + @JsonProperty(value = "properties.environmentPermission") + private EnvironmentPermission environmentPermission; + + /* + * The properties of any lab announcement associated with this lab + */ + @JsonProperty(value = "properties.announcement") + private LabAnnouncementProperties announcement; + + /* + * The properties of any lab support message associated with this lab + */ + @JsonProperty(value = "properties.support") + private LabSupportProperties support; + + /* + * The resource group in which all new lab virtual machines will be + * created. To let DevTest Labs manage resource group creation, set this + * value to null. + */ + @JsonProperty(value = "properties.vmCreationResourceGroup", access = JsonProperty.Access.WRITE_ONLY) + private String vmCreationResourceGroup; + + /* + * The public IP address for the lab's load balancer. + */ + @JsonProperty(value = "properties.publicIpId", access = JsonProperty.Access.WRITE_ONLY) + private String publicIpId; + + /* + * The load balancer used to for lab VMs that use shared IP address. + */ + @JsonProperty(value = "properties.loadBalancerId", access = JsonProperty.Access.WRITE_ONLY) + private String loadBalancerId; + + /* + * The Network Security Group attached to the lab VMs Network interfaces to + * restrict open ports. + */ + @JsonProperty(value = "properties.networkSecurityGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String networkSecurityGroupId; + + /* + * Extended properties of the lab used for experimental features + */ + @JsonProperty(value = "properties.extendedProperties") + private Map extendedProperties; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the defaultStorageAccount property: The lab's default storage account. + * + * @return the defaultStorageAccount value. + */ + public String defaultStorageAccount() { + return this.defaultStorageAccount; + } + + /** + * Get the defaultPremiumStorageAccount property: The lab's default premium storage account. + * + * @return the defaultPremiumStorageAccount value. + */ + public String defaultPremiumStorageAccount() { + return this.defaultPremiumStorageAccount; + } + + /** + * Get the artifactsStorageAccount property: The lab's artifact storage account. + * + * @return the artifactsStorageAccount value. + */ + public String artifactsStorageAccount() { + return this.artifactsStorageAccount; + } + + /** + * Get the premiumDataDiskStorageAccount property: The lab's premium data disk storage account. + * + * @return the premiumDataDiskStorageAccount value. + */ + public String premiumDataDiskStorageAccount() { + return this.premiumDataDiskStorageAccount; + } + + /** + * Get the vaultName property: The lab's Key vault. + * + * @return the vaultName value. + */ + public String vaultName() { + return this.vaultName; + } + + /** + * Get the labStorageType property: Type of storage used by the lab. It can be either Premium or Standard. Default + * is Premium. + * + * @return the labStorageType value. + */ + public StorageType labStorageType() { + return this.labStorageType; + } + + /** + * Set the labStorageType property: Type of storage used by the lab. It can be either Premium or Standard. Default + * is Premium. + * + * @param labStorageType the labStorageType value to set. + * @return the LabInner object itself. + */ + public LabInner withLabStorageType(StorageType labStorageType) { + this.labStorageType = labStorageType; + return this; + } + + /** + * Get the mandatoryArtifactsResourceIdsLinux property: 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. + * + * @return the mandatoryArtifactsResourceIdsLinux value. + */ + public List mandatoryArtifactsResourceIdsLinux() { + return this.mandatoryArtifactsResourceIdsLinux; + } + + /** + * Set the mandatoryArtifactsResourceIdsLinux property: 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. + * + * @param mandatoryArtifactsResourceIdsLinux the mandatoryArtifactsResourceIdsLinux value to set. + * @return the LabInner object itself. + */ + public LabInner withMandatoryArtifactsResourceIdsLinux(List mandatoryArtifactsResourceIdsLinux) { + this.mandatoryArtifactsResourceIdsLinux = mandatoryArtifactsResourceIdsLinux; + return this; + } + + /** + * Get the mandatoryArtifactsResourceIdsWindows property: 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. + * + * @return the mandatoryArtifactsResourceIdsWindows value. + */ + public List mandatoryArtifactsResourceIdsWindows() { + return this.mandatoryArtifactsResourceIdsWindows; + } + + /** + * Set the mandatoryArtifactsResourceIdsWindows property: 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. + * + * @param mandatoryArtifactsResourceIdsWindows the mandatoryArtifactsResourceIdsWindows value to set. + * @return the LabInner object itself. + */ + public LabInner withMandatoryArtifactsResourceIdsWindows(List mandatoryArtifactsResourceIdsWindows) { + this.mandatoryArtifactsResourceIdsWindows = mandatoryArtifactsResourceIdsWindows; + return this; + } + + /** + * Get the createdDate property: The creation date of the lab. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the premiumDataDisks property: 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. + * + * @return the premiumDataDisks value. + */ + public PremiumDataDisk premiumDataDisks() { + return this.premiumDataDisks; + } + + /** + * Set the premiumDataDisks property: 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. + * + * @param premiumDataDisks the premiumDataDisks value to set. + * @return the LabInner object itself. + */ + public LabInner withPremiumDataDisks(PremiumDataDisk premiumDataDisks) { + this.premiumDataDisks = premiumDataDisks; + return this; + } + + /** + * Get the environmentPermission property: The access rights to be granted to the user when provisioning an + * environment. + * + * @return the environmentPermission value. + */ + public EnvironmentPermission environmentPermission() { + return this.environmentPermission; + } + + /** + * Set the environmentPermission property: The access rights to be granted to the user when provisioning an + * environment. + * + * @param environmentPermission the environmentPermission value to set. + * @return the LabInner object itself. + */ + public LabInner withEnvironmentPermission(EnvironmentPermission environmentPermission) { + this.environmentPermission = environmentPermission; + return this; + } + + /** + * Get the announcement property: The properties of any lab announcement associated with this lab. + * + * @return the announcement value. + */ + public LabAnnouncementProperties announcement() { + return this.announcement; + } + + /** + * Set the announcement property: The properties of any lab announcement associated with this lab. + * + * @param announcement the announcement value to set. + * @return the LabInner object itself. + */ + public LabInner withAnnouncement(LabAnnouncementProperties announcement) { + this.announcement = announcement; + return this; + } + + /** + * Get the support property: The properties of any lab support message associated with this lab. + * + * @return the support value. + */ + public LabSupportProperties support() { + return this.support; + } + + /** + * Set the support property: The properties of any lab support message associated with this lab. + * + * @param support the support value to set. + * @return the LabInner object itself. + */ + public LabInner withSupport(LabSupportProperties support) { + this.support = support; + return this; + } + + /** + * Get the vmCreationResourceGroup property: The resource group in which all new lab virtual machines will be + * created. To let DevTest Labs manage resource group creation, set this value to null. + * + * @return the vmCreationResourceGroup value. + */ + public String vmCreationResourceGroup() { + return this.vmCreationResourceGroup; + } + + /** + * Get the publicIpId property: The public IP address for the lab's load balancer. + * + * @return the publicIpId value. + */ + public String publicIpId() { + return this.publicIpId; + } + + /** + * Get the loadBalancerId property: The load balancer used to for lab VMs that use shared IP address. + * + * @return the loadBalancerId value. + */ + public String loadBalancerId() { + return this.loadBalancerId; + } + + /** + * Get the networkSecurityGroupId property: The Network Security Group attached to the lab VMs Network interfaces to + * restrict open ports. + * + * @return the networkSecurityGroupId value. + */ + public String networkSecurityGroupId() { + return this.networkSecurityGroupId; + } + + /** + * Get the extendedProperties property: Extended properties of the lab used for experimental features. + * + * @return the extendedProperties value. + */ + public Map extendedProperties() { + return this.extendedProperties; + } + + /** + * Set the extendedProperties property: Extended properties of the lab used for experimental features. + * + * @param extendedProperties the extendedProperties value to set. + * @return the LabInner object itself. + */ + public LabInner withExtendedProperties(Map extendedProperties) { + this.extendedProperties = extendedProperties; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public LabInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public LabInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (announcement() != null) { + announcement().validate(); + } + if (support() != null) { + support().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVhdInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVhdInner.java new file mode 100644 index 000000000000..e7e6ad2935c7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVhdInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a VHD in the lab. */ +@Fluent +public final class LabVhdInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabVhdInner.class); + + /* + * The URI to the VHD. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: The URI to the VHD. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The URI to the VHD. + * + * @param id the id value to set. + * @return the LabVhdInner object itself. + */ + public LabVhdInner withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVirtualMachineInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVirtualMachineInner.java new file mode 100644 index 000000000000..5bad56a004e4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/LabVirtualMachineInner.java @@ -0,0 +1,863 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.ArtifactDeploymentStatusProperties; +import com.azure.resourcemanager.devtestlabs.models.ArtifactInstallProperties; +import com.azure.resourcemanager.devtestlabs.models.ComputeVmProperties; +import com.azure.resourcemanager.devtestlabs.models.DataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.GalleryImageReference; +import com.azure.resourcemanager.devtestlabs.models.NetworkInterfaceProperties; +import com.azure.resourcemanager.devtestlabs.models.ScheduleCreationParameter; +import com.azure.resourcemanager.devtestlabs.models.VirtualMachineCreationSource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** A virtual machine. */ +@JsonFlatten +@Fluent +public class LabVirtualMachineInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabVirtualMachineInner.class); + + /* + * The notes of the virtual machine. + */ + @JsonProperty(value = "properties.notes") + private String notes; + + /* + * The object identifier of the owner of the virtual machine. + */ + @JsonProperty(value = "properties.ownerObjectId") + private String ownerObjectId; + + /* + * The user principal name of the virtual machine owner. + */ + @JsonProperty(value = "properties.ownerUserPrincipalName") + private String ownerUserPrincipalName; + + /* + * The object identifier of the creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUserId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByUserId; + + /* + * The email address of creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUser", access = JsonProperty.Access.WRITE_ONLY) + private String createdByUser; + + /* + * The creation date of the virtual machine. + */ + @JsonProperty(value = "properties.createdDate") + private OffsetDateTime createdDate; + + /* + * The resource identifier (Microsoft.Compute) of the virtual machine. + */ + @JsonProperty(value = "properties.computeId", access = JsonProperty.Access.WRITE_ONLY) + private String computeId; + + /* + * The custom image identifier of the virtual machine. + */ + @JsonProperty(value = "properties.customImageId") + private String customImageId; + + /* + * The OS type of the virtual machine. + */ + @JsonProperty(value = "properties.osType", access = JsonProperty.Access.WRITE_ONLY) + private String osType; + + /* + * The size of the virtual machine. + */ + @JsonProperty(value = "properties.size") + private String size; + + /* + * The user name of the virtual machine. + */ + @JsonProperty(value = "properties.userName") + private String username; + + /* + * The password of the virtual machine administrator. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * The SSH key of the virtual machine administrator. + */ + @JsonProperty(value = "properties.sshKey") + private String sshKey; + + /* + * Indicates whether this virtual machine uses an SSH key for + * authentication. + */ + @JsonProperty(value = "properties.isAuthenticationWithSshKey") + private Boolean isAuthenticationWithSshKey; + + /* + * The fully-qualified domain name of the virtual machine. + */ + @JsonProperty(value = "properties.fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /* + * The lab subnet name of the virtual machine. + */ + @JsonProperty(value = "properties.labSubnetName") + private String labSubnetName; + + /* + * The lab virtual network identifier of the virtual machine. + */ + @JsonProperty(value = "properties.labVirtualNetworkId") + private String labVirtualNetworkId; + + /* + * Indicates whether the virtual machine is to be created without a public + * IP address. + */ + @JsonProperty(value = "properties.disallowPublicIpAddress") + private Boolean disallowPublicIpAddress; + + /* + * The artifacts to be installed on the virtual machine. + */ + @JsonProperty(value = "properties.artifacts") + private List artifacts; + + /* + * The artifact deployment status for the virtual machine. + */ + @JsonProperty(value = "properties.artifactDeploymentStatus", access = JsonProperty.Access.WRITE_ONLY) + private ArtifactDeploymentStatusProperties artifactDeploymentStatus; + + /* + * The Microsoft Azure Marketplace image reference of the virtual machine. + */ + @JsonProperty(value = "properties.galleryImageReference") + private GalleryImageReference galleryImageReference; + + /* + * The id of the plan associated with the virtual machine image + */ + @JsonProperty(value = "properties.planId") + private String planId; + + /* + * The compute virtual machine properties. + */ + @JsonProperty(value = "properties.computeVm", access = JsonProperty.Access.WRITE_ONLY) + private ComputeVmProperties computeVm; + + /* + * The network interface properties. + */ + @JsonProperty(value = "properties.networkInterface") + private NetworkInterfaceProperties networkInterface; + + /* + * The applicable schedule for the virtual machine. + */ + @JsonProperty(value = "properties.applicableSchedule", access = JsonProperty.Access.WRITE_ONLY) + private ApplicableScheduleInner applicableSchedule; + + /* + * The expiration date for VM. + */ + @JsonProperty(value = "properties.expirationDate") + private OffsetDateTime expirationDate; + + /* + * Indicates whether another user can take ownership of the virtual machine + */ + @JsonProperty(value = "properties.allowClaim") + private Boolean allowClaim; + + /* + * Storage type to use for virtual machine (i.e. Standard, Premium). + */ + @JsonProperty(value = "properties.storageType") + private String storageType; + + /* + * Tells source of creation of lab virtual machine. Output property only. + */ + @JsonProperty(value = "properties.virtualMachineCreationSource", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineCreationSource virtualMachineCreationSource; + + /* + * The resource ID of the environment that contains this virtual machine, + * if any. + */ + @JsonProperty(value = "properties.environmentId") + private String environmentId; + + /* + * New or existing data disks to attach to the virtual machine after + * creation + */ + @JsonProperty(value = "properties.dataDiskParameters") + private List dataDiskParameters; + + /* + * Virtual Machine schedules to be created + */ + @JsonProperty(value = "properties.scheduleParameters") + private List scheduleParameters; + + /* + * Last known compute power state captured in DTL + */ + @JsonProperty(value = "properties.lastKnownPowerState", access = JsonProperty.Access.WRITE_ONLY) + private String lastKnownPowerState; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the notes property: The notes of the virtual machine. + * + * @return the notes value. + */ + public String notes() { + return this.notes; + } + + /** + * Set the notes property: The notes of the virtual machine. + * + * @param notes the notes value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withNotes(String notes) { + this.notes = notes; + return this; + } + + /** + * Get the ownerObjectId property: The object identifier of the owner of the virtual machine. + * + * @return the ownerObjectId value. + */ + public String ownerObjectId() { + return this.ownerObjectId; + } + + /** + * Set the ownerObjectId property: The object identifier of the owner of the virtual machine. + * + * @param ownerObjectId the ownerObjectId value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withOwnerObjectId(String ownerObjectId) { + this.ownerObjectId = ownerObjectId; + return this; + } + + /** + * Get the ownerUserPrincipalName property: The user principal name of the virtual machine owner. + * + * @return the ownerUserPrincipalName value. + */ + public String ownerUserPrincipalName() { + return this.ownerUserPrincipalName; + } + + /** + * Set the ownerUserPrincipalName property: The user principal name of the virtual machine owner. + * + * @param ownerUserPrincipalName the ownerUserPrincipalName value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withOwnerUserPrincipalName(String ownerUserPrincipalName) { + this.ownerUserPrincipalName = ownerUserPrincipalName; + return this; + } + + /** + * Get the createdByUserId property: The object identifier of the creator of the virtual machine. + * + * @return the createdByUserId value. + */ + public String createdByUserId() { + return this.createdByUserId; + } + + /** + * Get the createdByUser property: The email address of creator of the virtual machine. + * + * @return the createdByUser value. + */ + public String createdByUser() { + return this.createdByUser; + } + + /** + * Get the createdDate property: The creation date of the virtual machine. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Set the createdDate property: The creation date of the virtual machine. + * + * @param createdDate the createdDate value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withCreatedDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the computeId property: The resource identifier (Microsoft.Compute) of the virtual machine. + * + * @return the computeId value. + */ + public String computeId() { + return this.computeId; + } + + /** + * Get the customImageId property: The custom image identifier of the virtual machine. + * + * @return the customImageId value. + */ + public String customImageId() { + return this.customImageId; + } + + /** + * Set the customImageId property: The custom image identifier of the virtual machine. + * + * @param customImageId the customImageId value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withCustomImageId(String customImageId) { + this.customImageId = customImageId; + return this; + } + + /** + * Get the osType property: The OS type of the virtual machine. + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Get the size property: The size of the virtual machine. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The size of the virtual machine. + * + * @param size the size value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the username property: The user name of the virtual machine. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name of the virtual machine. + * + * @param username the username value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password of the virtual machine administrator. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password of the virtual machine administrator. + * + * @param password the password value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the sshKey property: The SSH key of the virtual machine administrator. + * + * @return the sshKey value. + */ + public String sshKey() { + return this.sshKey; + } + + /** + * Set the sshKey property: The SSH key of the virtual machine administrator. + * + * @param sshKey the sshKey value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withSshKey(String sshKey) { + this.sshKey = sshKey; + return this; + } + + /** + * Get the isAuthenticationWithSshKey property: Indicates whether this virtual machine uses an SSH key for + * authentication. + * + * @return the isAuthenticationWithSshKey value. + */ + public Boolean isAuthenticationWithSshKey() { + return this.isAuthenticationWithSshKey; + } + + /** + * Set the isAuthenticationWithSshKey property: Indicates whether this virtual machine uses an SSH key for + * authentication. + * + * @param isAuthenticationWithSshKey the isAuthenticationWithSshKey value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey) { + this.isAuthenticationWithSshKey = isAuthenticationWithSshKey; + return this; + } + + /** + * Get the fqdn property: The fully-qualified domain name of the virtual machine. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Get the labSubnetName property: The lab subnet name of the virtual machine. + * + * @return the labSubnetName value. + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set the labSubnetName property: The lab subnet name of the virtual machine. + * + * @param labSubnetName the labSubnetName value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get the labVirtualNetworkId property: The lab virtual network identifier of the virtual machine. + * + * @return the labVirtualNetworkId value. + */ + public String labVirtualNetworkId() { + return this.labVirtualNetworkId; + } + + /** + * Set the labVirtualNetworkId property: The lab virtual network identifier of the virtual machine. + * + * @param labVirtualNetworkId the labVirtualNetworkId value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withLabVirtualNetworkId(String labVirtualNetworkId) { + this.labVirtualNetworkId = labVirtualNetworkId; + return this; + } + + /** + * Get the disallowPublicIpAddress property: Indicates whether the virtual machine is to be created without a public + * IP address. + * + * @return the disallowPublicIpAddress value. + */ + public Boolean disallowPublicIpAddress() { + return this.disallowPublicIpAddress; + } + + /** + * Set the disallowPublicIpAddress property: Indicates whether the virtual machine is to be created without a public + * IP address. + * + * @param disallowPublicIpAddress the disallowPublicIpAddress value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withDisallowPublicIpAddress(Boolean disallowPublicIpAddress) { + this.disallowPublicIpAddress = disallowPublicIpAddress; + return this; + } + + /** + * Get the artifacts property: The artifacts to be installed on the virtual machine. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Set the artifacts property: The artifacts to be installed on the virtual machine. + * + * @param artifacts the artifacts value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withArtifacts(List artifacts) { + this.artifacts = artifacts; + return this; + } + + /** + * Get the artifactDeploymentStatus property: The artifact deployment status for the virtual machine. + * + * @return the artifactDeploymentStatus value. + */ + public ArtifactDeploymentStatusProperties artifactDeploymentStatus() { + return this.artifactDeploymentStatus; + } + + /** + * Get the galleryImageReference property: The Microsoft Azure Marketplace image reference of the virtual machine. + * + * @return the galleryImageReference value. + */ + public GalleryImageReference galleryImageReference() { + return this.galleryImageReference; + } + + /** + * Set the galleryImageReference property: The Microsoft Azure Marketplace image reference of the virtual machine. + * + * @param galleryImageReference the galleryImageReference value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withGalleryImageReference(GalleryImageReference galleryImageReference) { + this.galleryImageReference = galleryImageReference; + return this; + } + + /** + * Get the planId property: The id of the plan associated with the virtual machine image. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: The id of the plan associated with the virtual machine image. + * + * @param planId the planId value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the computeVm property: The compute virtual machine properties. + * + * @return the computeVm value. + */ + public ComputeVmProperties computeVm() { + return this.computeVm; + } + + /** + * Get the networkInterface property: The network interface properties. + * + * @return the networkInterface value. + */ + public NetworkInterfaceProperties networkInterface() { + return this.networkInterface; + } + + /** + * Set the networkInterface property: The network interface properties. + * + * @param networkInterface the networkInterface value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withNetworkInterface(NetworkInterfaceProperties networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Get the applicableSchedule property: The applicable schedule for the virtual machine. + * + * @return the applicableSchedule value. + */ + public ApplicableScheduleInner applicableSchedule() { + return this.applicableSchedule; + } + + /** + * Get the expirationDate property: The expiration date for VM. + * + * @return the expirationDate value. + */ + public OffsetDateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set the expirationDate property: The expiration date for VM. + * + * @param expirationDate the expirationDate value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withExpirationDate(OffsetDateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get the allowClaim property: Indicates whether another user can take ownership of the virtual machine. + * + * @return the allowClaim value. + */ + public Boolean allowClaim() { + return this.allowClaim; + } + + /** + * Set the allowClaim property: Indicates whether another user can take ownership of the virtual machine. + * + * @param allowClaim the allowClaim value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withAllowClaim(Boolean allowClaim) { + this.allowClaim = allowClaim; + return this; + } + + /** + * Get the storageType property: Storage type to use for virtual machine (i.e. Standard, Premium). + * + * @return the storageType value. + */ + public String storageType() { + return this.storageType; + } + + /** + * Set the storageType property: Storage type to use for virtual machine (i.e. Standard, Premium). + * + * @param storageType the storageType value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withStorageType(String storageType) { + this.storageType = storageType; + return this; + } + + /** + * Get the virtualMachineCreationSource property: Tells source of creation of lab virtual machine. Output property + * only. + * + * @return the virtualMachineCreationSource value. + */ + public VirtualMachineCreationSource virtualMachineCreationSource() { + return this.virtualMachineCreationSource; + } + + /** + * Get the environmentId property: The resource ID of the environment that contains this virtual machine, if any. + * + * @return the environmentId value. + */ + public String environmentId() { + return this.environmentId; + } + + /** + * Set the environmentId property: The resource ID of the environment that contains this virtual machine, if any. + * + * @param environmentId the environmentId value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withEnvironmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Get the dataDiskParameters property: New or existing data disks to attach to the virtual machine after creation. + * + * @return the dataDiskParameters value. + */ + public List dataDiskParameters() { + return this.dataDiskParameters; + } + + /** + * Set the dataDiskParameters property: New or existing data disks to attach to the virtual machine after creation. + * + * @param dataDiskParameters the dataDiskParameters value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withDataDiskParameters(List dataDiskParameters) { + this.dataDiskParameters = dataDiskParameters; + return this; + } + + /** + * Get the scheduleParameters property: Virtual Machine schedules to be created. + * + * @return the scheduleParameters value. + */ + public List scheduleParameters() { + return this.scheduleParameters; + } + + /** + * Set the scheduleParameters property: Virtual Machine schedules to be created. + * + * @param scheduleParameters the scheduleParameters value to set. + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withScheduleParameters(List scheduleParameters) { + this.scheduleParameters = scheduleParameters; + return this; + } + + /** + * Get the lastKnownPowerState property: Last known compute power state captured in DTL. + * + * @return the lastKnownPowerState value. + */ + public String lastKnownPowerState() { + return this.lastKnownPowerState; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public LabVirtualMachineInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public LabVirtualMachineInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (artifacts() != null) { + artifacts().forEach(e -> e.validate()); + } + if (artifactDeploymentStatus() != null) { + artifactDeploymentStatus().validate(); + } + if (galleryImageReference() != null) { + galleryImageReference().validate(); + } + if (computeVm() != null) { + computeVm().validate(); + } + if (networkInterface() != null) { + networkInterface().validate(); + } + if (applicableSchedule() != null) { + applicableSchedule().validate(); + } + if (dataDiskParameters() != null) { + dataDiskParameters().forEach(e -> e.validate()); + } + if (scheduleParameters() != null) { + scheduleParameters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/NotificationChannelInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/NotificationChannelInner.java new file mode 100644 index 000000000000..a58c1b1518d5 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/NotificationChannelInner.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.Event; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** A notification. */ +@JsonFlatten +@Fluent +public class NotificationChannelInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotificationChannelInner.class); + + /* + * The webhook URL to send notifications to. + */ + @JsonProperty(value = "properties.webHookUrl") + private String webhookUrl; + + /* + * The email recipient to send notifications to (can be a list of + * semi-colon separated email addresses). + */ + @JsonProperty(value = "properties.emailRecipient") + private String emailRecipient; + + /* + * The locale to use when sending a notification (fallback for unsupported + * languages is EN). + */ + @JsonProperty(value = "properties.notificationLocale") + private String notificationLocale; + + /* + * Description of notification. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The list of event for which this notification is enabled. + */ + @JsonProperty(value = "properties.events") + private List events; + + /* + * The creation date of the notification channel. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the webhookUrl property: The webhook URL to send notifications to. + * + * @return the webhookUrl value. + */ + public String webhookUrl() { + return this.webhookUrl; + } + + /** + * Set the webhookUrl property: The webhook URL to send notifications to. + * + * @param webhookUrl the webhookUrl value to set. + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withWebhookUrl(String webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + + /** + * Get the emailRecipient property: The email recipient to send notifications to (can be a list of semi-colon + * separated email addresses). + * + * @return the emailRecipient value. + */ + public String emailRecipient() { + return this.emailRecipient; + } + + /** + * Set the emailRecipient property: The email recipient to send notifications to (can be a list of semi-colon + * separated email addresses). + * + * @param emailRecipient the emailRecipient value to set. + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withEmailRecipient(String emailRecipient) { + this.emailRecipient = emailRecipient; + return this; + } + + /** + * Get the notificationLocale property: The locale to use when sending a notification (fallback for unsupported + * languages is EN). + * + * @return the notificationLocale value. + */ + public String notificationLocale() { + return this.notificationLocale; + } + + /** + * Set the notificationLocale property: The locale to use when sending a notification (fallback for unsupported + * languages is EN). + * + * @param notificationLocale the notificationLocale value to set. + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withNotificationLocale(String notificationLocale) { + this.notificationLocale = notificationLocale; + return this; + } + + /** + * Get the description property: Description of notification. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of notification. + * + * @param description the description value to set. + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the events property: The list of event for which this notification is enabled. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Set the events property: The list of event for which this notification is enabled. + * + * @param events the events value to set. + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withEvents(List events) { + this.events = events; + return this; + } + + /** + * Get the createdDate property: The creation date of the notification channel. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public NotificationChannelInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public NotificationChannelInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (events() != null) { + events().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationMetadataInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationMetadataInner.java new file mode 100644 index 000000000000..2f38d31f0b55 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationMetadataInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.OperationMetadataDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The REST API operation supported by DevTestLab ResourceProvider. */ +@Fluent +public final class OperationMetadataInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationMetadataInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that describes the operations + */ + @JsonProperty(value = "display") + private OperationMetadataDisplay display; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationMetadataInner object itself. + */ + public OperationMetadataInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that describes the operations. + * + * @return the display value. + */ + public OperationMetadataDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that describes the operations. + * + * @param display the display value to set. + * @return the OperationMetadataInner object itself. + */ + public OperationMetadataInner withDisplay(OperationMetadataDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationResultInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationResultInner.java new file mode 100644 index 000000000000..ab919833b35c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/OperationResultInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.HttpStatusCode; +import com.azure.resourcemanager.devtestlabs.models.OperationError; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Operation Result. */ +@Fluent +public final class OperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationResultInner.class); + + /* + * The operation status. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The status code for the operation. + */ + @JsonProperty(value = "statusCode") + private HttpStatusCode statusCode; + + /* + * Error details for the operation in case of a failure. + */ + @JsonProperty(value = "error") + private OperationError error; + + /** + * Get the status property: The operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The operation status. + * + * @param status the status value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the statusCode property: The status code for the operation. + * + * @return the statusCode value. + */ + public HttpStatusCode statusCode() { + return this.statusCode; + } + + /** + * Set the statusCode property: The status code for the operation. + * + * @param statusCode the statusCode value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withStatusCode(HttpStatusCode statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * Get the error property: Error details for the operation in case of a failure. + * + * @return the error value. + */ + public OperationError error() { + return this.error; + } + + /** + * Set the error property: Error details for the operation in case of a failure. + * + * @param error the error value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withError(OperationError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/PolicyInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/PolicyInner.java new file mode 100644 index 000000000000..c8ede6a5a05e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/PolicyInner.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.PolicyEvaluatorType; +import com.azure.resourcemanager.devtestlabs.models.PolicyFactName; +import com.azure.resourcemanager.devtestlabs.models.PolicyStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A Policy. */ +@JsonFlatten +@Fluent +public class PolicyInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyInner.class); + + /* + * The description of the policy. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The status of the policy. + */ + @JsonProperty(value = "properties.status") + private PolicyStatus status; + + /* + * The fact name of the policy (e.g. LabVmCount, LabVmSize, + * MaxVmsAllowedPerLab, etc. + */ + @JsonProperty(value = "properties.factName") + private PolicyFactName factName; + + /* + * The fact data of the policy. + */ + @JsonProperty(value = "properties.factData") + private String factData; + + /* + * The threshold of the policy (i.e. a number for MaxValuePolicy, and a + * JSON array of values for AllowedValuesPolicy). + */ + @JsonProperty(value = "properties.threshold") + private String threshold; + + /* + * The evaluator type of the policy (i.e. AllowedValuesPolicy, + * MaxValuePolicy). + */ + @JsonProperty(value = "properties.evaluatorType") + private PolicyEvaluatorType evaluatorType; + + /* + * The creation date of the policy. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the description property: The description of the policy. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the policy. + * + * @param description the description value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the status property: The status of the policy. + * + * @return the status value. + */ + public PolicyStatus status() { + return this.status; + } + + /** + * Set the status property: The status of the policy. + * + * @param status the status value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withStatus(PolicyStatus status) { + this.status = status; + return this; + } + + /** + * Get the factName property: The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. + * + * @return the factName value. + */ + public PolicyFactName factName() { + return this.factName; + } + + /** + * Set the factName property: The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. + * + * @param factName the factName value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withFactName(PolicyFactName factName) { + this.factName = factName; + return this; + } + + /** + * Get the factData property: The fact data of the policy. + * + * @return the factData value. + */ + public String factData() { + return this.factData; + } + + /** + * Set the factData property: The fact data of the policy. + * + * @param factData the factData value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withFactData(String factData) { + this.factData = factData; + return this; + } + + /** + * Get the threshold property: The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of + * values for AllowedValuesPolicy). + * + * @return the threshold value. + */ + public String threshold() { + return this.threshold; + } + + /** + * Set the threshold property: The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of + * values for AllowedValuesPolicy). + * + * @param threshold the threshold value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withThreshold(String threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the evaluatorType property: The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). + * + * @return the evaluatorType value. + */ + public PolicyEvaluatorType evaluatorType() { + return this.evaluatorType; + } + + /** + * Set the evaluatorType property: The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). + * + * @param evaluatorType the evaluatorType value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withEvaluatorType(PolicyEvaluatorType evaluatorType) { + this.evaluatorType = evaluatorType; + return this; + } + + /** + * Get the createdDate property: The creation date of the policy. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public PolicyInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public PolicyInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/RdpConnectionInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/RdpConnectionInner.java new file mode 100644 index 000000000000..7ad0a5d049ea --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/RdpConnectionInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a .rdp file. */ +@Fluent +public final class RdpConnectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RdpConnectionInner.class); + + /* + * The contents of the .rdp file + */ + @JsonProperty(value = "contents") + private String contents; + + /** + * Get the contents property: The contents of the .rdp file. + * + * @return the contents value. + */ + public String contents() { + return this.contents; + } + + /** + * Set the contents property: The contents of the .rdp file. + * + * @param contents the contents value to set. + * @return the RdpConnectionInner object itself. + */ + public RdpConnectionInner withContents(String contents) { + this.contents = contents; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ScheduleInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ScheduleInner.java new file mode 100644 index 000000000000..21f71b94a9d1 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ScheduleInner.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.DayDetails; +import com.azure.resourcemanager.devtestlabs.models.EnableStatus; +import com.azure.resourcemanager.devtestlabs.models.HourDetails; +import com.azure.resourcemanager.devtestlabs.models.NotificationSettings; +import com.azure.resourcemanager.devtestlabs.models.WeekDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** A schedule. */ +@JsonFlatten +@Fluent +public class ScheduleInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScheduleInner.class); + + /* + * The status of the schedule (i.e. Enabled, Disabled) + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /* + * The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + */ + @JsonProperty(value = "properties.taskType") + private String taskType; + + /* + * If the schedule will occur only some days of the week, specify the + * weekly recurrence. + */ + @JsonProperty(value = "properties.weeklyRecurrence") + private WeekDetails weeklyRecurrence; + + /* + * If the schedule will occur once each day of the week, specify the daily + * recurrence. + */ + @JsonProperty(value = "properties.dailyRecurrence") + private DayDetails dailyRecurrence; + + /* + * If the schedule will occur multiple times a day, specify the hourly + * recurrence. + */ + @JsonProperty(value = "properties.hourlyRecurrence") + private HourDetails hourlyRecurrence; + + /* + * The time zone ID (e.g. Pacific Standard time). + */ + @JsonProperty(value = "properties.timeZoneId") + private String timeZoneId; + + /* + * Notification settings. + */ + @JsonProperty(value = "properties.notificationSettings") + private NotificationSettings notificationSettings; + + /* + * The creation date of the schedule. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The resource ID to which the schedule belongs + */ + @JsonProperty(value = "properties.targetResourceId") + private String targetResourceId; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the status property: The status of the schedule (i.e. Enabled, Disabled). + * + * @return the status value. + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status property: The status of the schedule (i.e. Enabled, Disabled). + * + * @param status the status value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withStatus(EnableStatus status) { + this.status = status; + return this; + } + + /** + * Get the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @return the taskType value. + */ + public String taskType() { + return this.taskType; + } + + /** + * Set the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @param taskType the taskType value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTaskType(String taskType) { + this.taskType = taskType; + return this; + } + + /** + * Get the weeklyRecurrence property: If the schedule will occur only some days of the week, specify the weekly + * recurrence. + * + * @return the weeklyRecurrence value. + */ + public WeekDetails weeklyRecurrence() { + return this.weeklyRecurrence; + } + + /** + * Set the weeklyRecurrence property: If the schedule will occur only some days of the week, specify the weekly + * recurrence. + * + * @param weeklyRecurrence the weeklyRecurrence value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.weeklyRecurrence = weeklyRecurrence; + return this; + } + + /** + * Get the dailyRecurrence property: If the schedule will occur once each day of the week, specify the daily + * recurrence. + * + * @return the dailyRecurrence value. + */ + public DayDetails dailyRecurrence() { + return this.dailyRecurrence; + } + + /** + * Set the dailyRecurrence property: If the schedule will occur once each day of the week, specify the daily + * recurrence. + * + * @param dailyRecurrence the dailyRecurrence value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withDailyRecurrence(DayDetails dailyRecurrence) { + this.dailyRecurrence = dailyRecurrence; + return this; + } + + /** + * Get the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the hourly + * recurrence. + * + * @return the hourlyRecurrence value. + */ + public HourDetails hourlyRecurrence() { + return this.hourlyRecurrence; + } + + /** + * Set the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the hourly + * recurrence. + * + * @param hourlyRecurrence the hourlyRecurrence value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.hourlyRecurrence = hourlyRecurrence; + return this; + } + + /** + * Get the timeZoneId property: The time zone ID (e.g. Pacific Standard time). + * + * @return the timeZoneId value. + */ + public String timeZoneId() { + return this.timeZoneId; + } + + /** + * Set the timeZoneId property: The time zone ID (e.g. Pacific Standard time). + * + * @param timeZoneId the timeZoneId value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTimeZoneId(String timeZoneId) { + this.timeZoneId = timeZoneId; + return this; + } + + /** + * Get the notificationSettings property: Notification settings. + * + * @return the notificationSettings value. + */ + public NotificationSettings notificationSettings() { + return this.notificationSettings; + } + + /** + * Set the notificationSettings property: Notification settings. + * + * @param notificationSettings the notificationSettings value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withNotificationSettings(NotificationSettings notificationSettings) { + this.notificationSettings = notificationSettings; + return this; + } + + /** + * Get the createdDate property: The creation date of the schedule. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the targetResourceId property: The resource ID to which the schedule belongs. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: The resource ID to which the schedule belongs. + * + * @param targetResourceId the targetResourceId value to set. + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public ScheduleInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScheduleInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (weeklyRecurrence() != null) { + weeklyRecurrence().validate(); + } + if (dailyRecurrence() != null) { + dailyRecurrence().validate(); + } + if (hourlyRecurrence() != null) { + hourlyRecurrence().validate(); + } + if (notificationSettings() != null) { + notificationSettings().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/SecretInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/SecretInner.java new file mode 100644 index 000000000000..3f6f0af07f97 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/SecretInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A secret. */ +@JsonFlatten +@Fluent +public class SecretInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecretInner.class); + + /* + * The value of the secret for secret creation. + */ + @JsonProperty(value = "properties.value") + private String value; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the value property: The value of the secret for secret creation. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the secret for secret creation. + * + * @param value the value value to set. + * @return the SecretInner object itself. + */ + public SecretInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public SecretInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public SecretInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceFabricInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceFabricInner.java new file mode 100644 index 000000000000..fcc1dbed870a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceFabricInner.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A Service Fabric. */ +@JsonFlatten +@Fluent +public class ServiceFabricInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceFabricInner.class); + + /* + * The backing service fabric resource's id + */ + @JsonProperty(value = "properties.externalServiceFabricId") + private String externalServiceFabricId; + + /* + * The resource id of the environment under which the service fabric + * resource is present + */ + @JsonProperty(value = "properties.environmentId") + private String environmentId; + + /* + * The applicable schedule for the virtual machine. + */ + @JsonProperty(value = "properties.applicableSchedule", access = JsonProperty.Access.WRITE_ONLY) + private ApplicableScheduleInner applicableSchedule; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the externalServiceFabricId property: The backing service fabric resource's id. + * + * @return the externalServiceFabricId value. + */ + public String externalServiceFabricId() { + return this.externalServiceFabricId; + } + + /** + * Set the externalServiceFabricId property: The backing service fabric resource's id. + * + * @param externalServiceFabricId the externalServiceFabricId value to set. + * @return the ServiceFabricInner object itself. + */ + public ServiceFabricInner withExternalServiceFabricId(String externalServiceFabricId) { + this.externalServiceFabricId = externalServiceFabricId; + return this; + } + + /** + * Get the environmentId property: The resource id of the environment under which the service fabric resource is + * present. + * + * @return the environmentId value. + */ + public String environmentId() { + return this.environmentId; + } + + /** + * Set the environmentId property: The resource id of the environment under which the service fabric resource is + * present. + * + * @param environmentId the environmentId value to set. + * @return the ServiceFabricInner object itself. + */ + public ServiceFabricInner withEnvironmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Get the applicableSchedule property: The applicable schedule for the virtual machine. + * + * @return the applicableSchedule value. + */ + public ApplicableScheduleInner applicableSchedule() { + return this.applicableSchedule; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public ServiceFabricInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceFabricInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (applicableSchedule() != null) { + applicableSchedule().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceRunnerInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceRunnerInner.java new file mode 100644 index 000000000000..3502af945969 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/ServiceRunnerInner.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.IdentityProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A container for a managed identity to execute DevTest lab services. */ +@Fluent +public final class ServiceRunnerInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceRunnerInner.class); + + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private IdentityProperties identity; + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ServiceRunnerInner object itself. + */ + public ServiceRunnerInner withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceRunnerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceRunnerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/UserInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/UserInner.java new file mode 100644 index 000000000000..a502dbe76746 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/UserInner.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.UserIdentity; +import com.azure.resourcemanager.devtestlabs.models.UserSecretStore; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Profile of a lab user. */ +@JsonFlatten +@Fluent +public class UserInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserInner.class); + + /* + * The identity of the user. + */ + @JsonProperty(value = "properties.identity") + private UserIdentity identity; + + /* + * The secret store of the user. + */ + @JsonProperty(value = "properties.secretStore") + private UserSecretStore secretStore; + + /* + * The creation date of the user profile. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the identity property: The identity of the user. + * + * @return the identity value. + */ + public UserIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the user. + * + * @param identity the identity value to set. + * @return the UserInner object itself. + */ + public UserInner withIdentity(UserIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the secretStore property: The secret store of the user. + * + * @return the secretStore value. + */ + public UserSecretStore secretStore() { + return this.secretStore; + } + + /** + * Set the secretStore property: The secret store of the user. + * + * @param secretStore the secretStore value to set. + * @return the UserInner object itself. + */ + public UserInner withSecretStore(UserSecretStore secretStore) { + this.secretStore = secretStore; + return this; + } + + /** + * Get the createdDate property: The creation date of the user profile. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public UserInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public UserInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (secretStore() != null) { + secretStore().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/VirtualNetworkInner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/VirtualNetworkInner.java new file mode 100644 index 000000000000..80f7fd88eee8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/VirtualNetworkInner.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.models.ExternalSubnet; +import com.azure.resourcemanager.devtestlabs.models.Subnet; +import com.azure.resourcemanager.devtestlabs.models.SubnetOverride; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** A virtual network. */ +@JsonFlatten +@Fluent +public class VirtualNetworkInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkInner.class); + + /* + * The allowed subnets of the virtual network. + */ + @JsonProperty(value = "properties.allowedSubnets") + private List allowedSubnets; + + /* + * The description of the virtual network. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The Microsoft.Network resource identifier of the virtual network. + */ + @JsonProperty(value = "properties.externalProviderResourceId") + private String externalProviderResourceId; + + /* + * The external subnet properties. + */ + @JsonProperty(value = "properties.externalSubnets", access = JsonProperty.Access.WRITE_ONLY) + private List externalSubnets; + + /* + * The subnet overrides of the virtual network. + */ + @JsonProperty(value = "properties.subnetOverrides") + private List subnetOverrides; + + /* + * The creation date of the virtual network. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdDate; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the allowedSubnets property: The allowed subnets of the virtual network. + * + * @return the allowedSubnets value. + */ + public List allowedSubnets() { + return this.allowedSubnets; + } + + /** + * Set the allowedSubnets property: The allowed subnets of the virtual network. + * + * @param allowedSubnets the allowedSubnets value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withAllowedSubnets(List allowedSubnets) { + this.allowedSubnets = allowedSubnets; + return this; + } + + /** + * Get the description property: The description of the virtual network. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the virtual network. + * + * @param description the description value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the externalProviderResourceId property: The Microsoft.Network resource identifier of the virtual network. + * + * @return the externalProviderResourceId value. + */ + public String externalProviderResourceId() { + return this.externalProviderResourceId; + } + + /** + * Set the externalProviderResourceId property: The Microsoft.Network resource identifier of the virtual network. + * + * @param externalProviderResourceId the externalProviderResourceId value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withExternalProviderResourceId(String externalProviderResourceId) { + this.externalProviderResourceId = externalProviderResourceId; + return this; + } + + /** + * Get the externalSubnets property: The external subnet properties. + * + * @return the externalSubnets value. + */ + public List externalSubnets() { + return this.externalSubnets; + } + + /** + * Get the subnetOverrides property: The subnet overrides of the virtual network. + * + * @return the subnetOverrides value. + */ + public List subnetOverrides() { + return this.subnetOverrides; + } + + /** + * Set the subnetOverrides property: The subnet overrides of the virtual network. + * + * @param subnetOverrides the subnetOverrides value to set. + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withSubnetOverrides(List subnetOverrides) { + this.subnetOverrides = subnetOverrides; + return this; + } + + /** + * Get the createdDate property: The creation date of the virtual network. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** {@inheritDoc} */ + @Override + public VirtualNetworkInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public VirtualNetworkInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allowedSubnets() != null) { + allowedSubnets().forEach(e -> e.validate()); + } + if (externalSubnets() != null) { + externalSubnets().forEach(e -> e.validate()); + } + if (subnetOverrides() != null) { + subnetOverrides().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/package-info.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/package-info.java new file mode 100644 index 000000000000..92b8f3801247 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for DevTestLabsClient. The DevTest Labs Client. */ +package com.azure.resourcemanager.devtestlabs.fluent.models; diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/package-info.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/package-info.java new file mode 100644 index 000000000000..008642ccfedd --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for DevTestLabsClient. The DevTest Labs Client. */ +package com.azure.resourcemanager.devtestlabs.fluent; diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ApplicableScheduleImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ApplicableScheduleImpl.java new file mode 100644 index 000000000000..f75cba7df383 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ApplicableScheduleImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.ApplicableSchedule; +import com.azure.resourcemanager.devtestlabs.models.Schedule; +import java.util.Collections; +import java.util.Map; + +public final class ApplicableScheduleImpl implements ApplicableSchedule { + private ApplicableScheduleInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + ApplicableScheduleImpl( + ApplicableScheduleInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Schedule labVmsShutdown() { + ScheduleInner inner = this.innerModel().labVmsShutdown(); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Schedule labVmsStartup() { + ScheduleInner inner = this.innerModel().labVmsStartup(); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApplicableScheduleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateImpl.java new file mode 100644 index 000000000000..64314349669e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateImpl.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInner; +import com.azure.resourcemanager.devtestlabs.models.ArmTemplate; +import com.azure.resourcemanager.devtestlabs.models.ParametersValueFileInfo; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ArmTemplateImpl implements ArmTemplate { + private ArmTemplateInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + ArmTemplateImpl( + ArmTemplateInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String icon() { + return this.innerModel().icon(); + } + + public Object contents() { + return this.innerModel().contents(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public List parametersValueFilesInfo() { + List inner = this.innerModel().parametersValueFilesInfo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public ArmTemplateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateInfoImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateInfoImpl.java new file mode 100644 index 000000000000..d3093ef34532 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplateInfoImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInfoInner; +import com.azure.resourcemanager.devtestlabs.models.ArmTemplateInfo; + +public final class ArmTemplateInfoImpl implements ArmTemplateInfo { + private ArmTemplateInfoInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + ArmTemplateInfoImpl( + ArmTemplateInfoInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Object template() { + return this.innerModel().template(); + } + + public Object parameters() { + return this.innerModel().parameters(); + } + + public ArmTemplateInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesClientImpl.java new file mode 100644 index 000000000000..dd9a8fc323c9 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesClientImpl.java @@ -0,0 +1,691 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ArmTemplatesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInner; +import com.azure.resourcemanager.devtestlabs.models.ArmTemplateList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ArmTemplatesClient. */ +public final class ArmTemplatesClientImpl implements ArmTemplatesClient { + private final ClientLogger logger = new ClientLogger(ArmTemplatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ArmTemplatesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of ArmTemplatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ArmTemplatesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(ArmTemplatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientArmTemplates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientArm") + private interface ArmTemplatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{artifactSourceName}/armtemplates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("artifactSourceName") String artifactSourceName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("artifactSourceName") String artifactSourceName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String artifactSourceName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String artifactSourceName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>( + listAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby)); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby, context)); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String artifactSourceName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArmTemplateInner get(String resourceGroupName, String labName, String artifactSourceName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, artifactSourceName, name, expand).block(); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context) { + return getWithResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesImpl.java new file mode 100644 index 000000000000..16f8a21ed215 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArmTemplatesImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ArmTemplatesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInner; +import com.azure.resourcemanager.devtestlabs.models.ArmTemplate; +import com.azure.resourcemanager.devtestlabs.models.ArmTemplates; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ArmTemplatesImpl implements ArmTemplates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmTemplatesImpl.class); + + private final ArmTemplatesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public ArmTemplatesImpl( + ArmTemplatesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String artifactSourceName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, artifactSourceName); + return Utils.mapPage(inner, inner1 -> new ArmTemplateImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ArmTemplateImpl(inner1, this.manager())); + } + + public ArmTemplate get(String resourceGroupName, String labName, String artifactSourceName, String name) { + ArmTemplateInner inner = this.serviceClient().get(resourceGroupName, labName, artifactSourceName, name); + if (inner != null) { + return new ArmTemplateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, artifactSourceName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ArmTemplateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ArmTemplatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactImpl.java new file mode 100644 index 000000000000..83d9a4843e9c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactInner; +import com.azure.resourcemanager.devtestlabs.models.Artifact; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ArtifactImpl implements Artifact { + private ArtifactInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + ArtifactImpl(ArtifactInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String title() { + return this.innerModel().title(); + } + + public String description() { + return this.innerModel().description(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String filePath() { + return this.innerModel().filePath(); + } + + public String icon() { + return this.innerModel().icon(); + } + + public String targetOsType() { + return this.innerModel().targetOsType(); + } + + public Object parameters() { + return this.innerModel().parameters(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public ArtifactInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourceImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourceImpl.java new file mode 100644 index 000000000000..c75b62607770 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourceImpl.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSource; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSourceFragment; +import com.azure.resourcemanager.devtestlabs.models.EnableStatus; +import com.azure.resourcemanager.devtestlabs.models.SourceControlType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ArtifactSourceImpl implements ArtifactSource, ArtifactSource.Definition, ArtifactSource.Update { + private ArtifactSourceInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public SourceControlType sourceType() { + return this.innerModel().sourceType(); + } + + public String folderPath() { + return this.innerModel().folderPath(); + } + + public String armTemplateFolderPath() { + return this.innerModel().armTemplateFolderPath(); + } + + public String branchRef() { + return this.innerModel().branchRef(); + } + + public String securityToken() { + return this.innerModel().securityToken(); + } + + public EnableStatus status() { + return this.innerModel().status(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ArtifactSourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + private ArtifactSourceFragment updateArtifactSource; + + public ArtifactSourceImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public ArtifactSource create() { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ArtifactSource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), context) + .getValue(); + return this; + } + + ArtifactSourceImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new ArtifactSourceInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public ArtifactSourceImpl update() { + this.updateArtifactSource = new ArtifactSourceFragment(); + return this; + } + + public ArtifactSource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .updateWithResponse(resourceGroupName, labName, name, updateArtifactSource, Context.NONE) + .getValue(); + return this; + } + + public ArtifactSource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .updateWithResponse(resourceGroupName, labName, name, updateArtifactSource, context) + .getValue(); + return this; + } + + ArtifactSourceImpl( + ArtifactSourceInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "artifactsources"); + } + + public ArtifactSource refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public ArtifactSource refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public ArtifactSourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ArtifactSourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ArtifactSourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateArtifactSource.withTags(tags); + return this; + } + } + + public ArtifactSourceImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public ArtifactSourceImpl withUri(String uri) { + this.innerModel().withUri(uri); + return this; + } + + public ArtifactSourceImpl withSourceType(SourceControlType sourceType) { + this.innerModel().withSourceType(sourceType); + return this; + } + + public ArtifactSourceImpl withFolderPath(String folderPath) { + this.innerModel().withFolderPath(folderPath); + return this; + } + + public ArtifactSourceImpl withArmTemplateFolderPath(String armTemplateFolderPath) { + this.innerModel().withArmTemplateFolderPath(armTemplateFolderPath); + return this; + } + + public ArtifactSourceImpl withBranchRef(String branchRef) { + this.innerModel().withBranchRef(branchRef); + return this; + } + + public ArtifactSourceImpl withSecurityToken(String securityToken) { + this.innerModel().withSecurityToken(securityToken); + return this; + } + + public ArtifactSourceImpl withStatus(EnableStatus status) { + this.innerModel().withStatus(status); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesClientImpl.java new file mode 100644 index 000000000000..f487ec327eb8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesClientImpl.java @@ -0,0 +1,1193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ArtifactSourcesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSourceFragment; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSourceList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ArtifactSourcesClient. */ +public final class ArtifactSourcesClientImpl implements ArtifactSourcesClient { + private final ClientLogger logger = new ClientLogger(ArtifactSourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ArtifactSourcesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of ArtifactSourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ArtifactSourcesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(ArtifactSourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientArtifactSources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientArt") + private interface ArtifactSourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ArtifactSourceInner artifactSource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ArtifactSourceFragment artifactSource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArtifactSourceInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (artifactSource == null) { + return Mono.error(new IllegalArgumentException("Parameter artifactSource is required and cannot be null.")); + } else { + artifactSource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + artifactSource, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (artifactSource == null) { + return Mono.error(new IllegalArgumentException("Parameter artifactSource is required and cannot be null.")); + } else { + artifactSource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + artifactSource, + accept, + context); + } + + /** + * Create or replace an existing artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, artifactSource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArtifactSourceInner createOrUpdate( + String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return createOrUpdateAsync(resourceGroupName, labName, name, artifactSource).block(); + } + + /** + * Create or replace an existing artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, artifactSource, context).block(); + } + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, name).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (artifactSource == null) { + return Mono.error(new IllegalArgumentException("Parameter artifactSource is required and cannot be null.")); + } else { + artifactSource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + artifactSource, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (artifactSource == null) { + return Mono.error(new IllegalArgumentException("Parameter artifactSource is required and cannot be null.")); + } else { + artifactSource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + artifactSource, + accept, + context); + } + + /** + * Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource) { + return updateWithResponseAsync(resourceGroupName, labName, name, artifactSource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArtifactSourceInner update( + String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource) { + return updateAsync(resourceGroupName, labName, name, artifactSource).block(); + } + + /** + * Allows modifying tags of artifact sources. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param artifactSource Properties of an artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return properties of an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource, Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, artifactSource, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesImpl.java new file mode 100644 index 000000000000..74e26b05001f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactSourcesImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ArtifactSourcesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSource; +import com.azure.resourcemanager.devtestlabs.models.ArtifactSources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ArtifactSourcesImpl implements ArtifactSources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourcesImpl.class); + + private final ArtifactSourcesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public ArtifactSourcesImpl( + ArtifactSourcesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new ArtifactSourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ArtifactSourceImpl(inner1, this.manager())); + } + + public ArtifactSource get(String resourceGroupName, String labName, String name) { + ArtifactSourceInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new ArtifactSourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ArtifactSourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, name, context); + } + + public ArtifactSource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "artifactsources"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactsources'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "artifactsources"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactsources'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "artifactsources"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactsources'.", id))); + } + this.deleteWithResponse(resourceGroupName, labName, name, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "artifactsources"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactsources'.", id))); + } + return this.deleteWithResponse(resourceGroupName, labName, name, context); + } + + private ArtifactSourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public ArtifactSourceImpl define(String name) { + return new ArtifactSourceImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsClientImpl.java new file mode 100644 index 000000000000..c2ba96d535de --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsClientImpl.java @@ -0,0 +1,947 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ArtifactsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInfoInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactInner; +import com.azure.resourcemanager.devtestlabs.models.ArtifactList; +import com.azure.resourcemanager.devtestlabs.models.GenerateArmTemplateRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ArtifactsClient. */ +public final class ArtifactsClientImpl implements ArtifactsClient { + private final ClientLogger logger = new ClientLogger(ArtifactsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ArtifactsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of ArtifactsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ArtifactsClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(ArtifactsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientArtifacts to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientArt") + private interface ArtifactsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{artifactSourceName}/artifacts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("artifactSourceName") String artifactSourceName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("artifactSourceName") String artifactSourceName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> generateArmTemplate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("artifactSourceName") String artifactSourceName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GenerateArmTemplateRequest generateArmTemplateRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String artifactSourceName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String artifactSourceName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>( + listAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby)); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby, context)); + } + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String artifactSourceName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArtifactInner get(String resourceGroupName, String labName, String artifactSourceName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, artifactSourceName, name, expand).block(); + } + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context) { + return getWithResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand, context).block(); + } + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateArmTemplateWithResponseAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (generateArmTemplateRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter generateArmTemplateRequest is required and cannot be null.")); + } else { + generateArmTemplateRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateArmTemplate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + name, + this.client.getApiVersion(), + generateArmTemplateRequest, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateArmTemplateWithResponseAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (generateArmTemplateRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter generateArmTemplateRequest is required and cannot be null.")); + } else { + generateArmTemplateRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateArmTemplate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + artifactSourceName, + name, + this.client.getApiVersion(), + generateArmTemplateRequest, + accept, + context); + } + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateArmTemplateAsync( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest) { + return generateArmTemplateWithResponseAsync( + resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArmTemplateInfoInner generateArmTemplate( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest) { + return generateArmTemplateAsync( + resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest) + .block(); + } + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateArmTemplateWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest, + Context context) { + return generateArmTemplateWithResponseAsync( + resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsImpl.java new file mode 100644 index 000000000000..ac03443ada82 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ArtifactsImpl.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ArtifactsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInfoInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactInner; +import com.azure.resourcemanager.devtestlabs.models.ArmTemplateInfo; +import com.azure.resourcemanager.devtestlabs.models.Artifact; +import com.azure.resourcemanager.devtestlabs.models.Artifacts; +import com.azure.resourcemanager.devtestlabs.models.GenerateArmTemplateRequest; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ArtifactsImpl implements Artifacts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactsImpl.class); + + private final ArtifactsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public ArtifactsImpl( + ArtifactsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String artifactSourceName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName, artifactSourceName); + return Utils.mapPage(inner, inner1 -> new ArtifactImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ArtifactImpl(inner1, this.manager())); + } + + public Artifact get(String resourceGroupName, String labName, String artifactSourceName, String name) { + ArtifactInner inner = this.serviceClient().get(resourceGroupName, labName, artifactSourceName, name); + if (inner != null) { + return new ArtifactImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, artifactSourceName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ArtifactImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ArmTemplateInfo generateArmTemplate( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest) { + ArmTemplateInfoInner inner = + this + .serviceClient() + .generateArmTemplate(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest); + if (inner != null) { + return new ArmTemplateInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response generateArmTemplateWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest, + Context context) { + Response inner = + this + .serviceClient() + .generateArmTemplateWithResponse( + resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ArmTemplateInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ArtifactsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsClientImpl.java new file mode 100644 index 000000000000..a510c3d635a4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsClientImpl.java @@ -0,0 +1,466 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.CostsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabCostInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CostsClient. */ +public final class CostsClientImpl implements CostsClient { + private final ClientLogger logger = new ClientLogger(CostsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CostsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of CostsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CostsClientImpl(DevTestLabsClientImpl client) { + this.service = RestProxy.create(CostsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientCosts to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientCos") + private interface CostsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/costs/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/costs/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LabCostInner labCost, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabCostInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a cost item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, LabCostInner labCost) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labCost == null) { + return Mono.error(new IllegalArgumentException("Parameter labCost is required and cannot be null.")); + } else { + labCost.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + labCost, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a cost item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, LabCostInner labCost, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labCost == null) { + return Mono.error(new IllegalArgumentException("Parameter labCost is required and cannot be null.")); + } else { + labCost.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + labCost, + accept, + context); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a cost item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, LabCostInner labCost) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, labCost) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a cost item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabCostInner createOrUpdate(String resourceGroupName, String labName, String name, LabCostInner labCost) { + return createOrUpdateAsync(resourceGroupName, labName, name, labCost).block(); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a cost item. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, LabCostInner labCost, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, labCost, context).block(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsImpl.java new file mode 100644 index 000000000000..d0f81cdb7314 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CostsImpl.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.CostsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabCostInner; +import com.azure.resourcemanager.devtestlabs.models.Costs; +import com.azure.resourcemanager.devtestlabs.models.LabCost; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CostsImpl implements Costs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CostsImpl.class); + + private final CostsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public CostsImpl(CostsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public LabCost get(String resourceGroupName, String labName, String name) { + LabCostInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new LabCostImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LabCostImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LabCost getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "costs"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'costs'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "costs"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'costs'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + private CostsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public LabCostImpl define(String name) { + return new LabCostImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImageImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImageImpl.java new file mode 100644 index 000000000000..47c121927ce2 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImageImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.CustomImageInner; +import com.azure.resourcemanager.devtestlabs.models.CustomImage; +import com.azure.resourcemanager.devtestlabs.models.CustomImageFragment; +import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesCustom; +import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesFromPlan; +import com.azure.resourcemanager.devtestlabs.models.CustomImagePropertiesFromVm; +import com.azure.resourcemanager.devtestlabs.models.DataDiskStorageTypeInfo; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CustomImageImpl implements CustomImage, CustomImage.Definition, CustomImage.Update { + private CustomImageInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public CustomImagePropertiesFromVm vm() { + return this.innerModel().vm(); + } + + public CustomImagePropertiesCustom vhd() { + return this.innerModel().vhd(); + } + + public String description() { + return this.innerModel().description(); + } + + public String author() { + return this.innerModel().author(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public String managedImageId() { + return this.innerModel().managedImageId(); + } + + public String managedSnapshotId() { + return this.innerModel().managedSnapshotId(); + } + + public List dataDiskStorageInfo() { + List inner = this.innerModel().dataDiskStorageInfo(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CustomImagePropertiesFromPlan customImagePlan() { + return this.innerModel().customImagePlan(); + } + + public Boolean isPlanAuthorized() { + return this.innerModel().isPlanAuthorized(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public CustomImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + private CustomImageFragment updateCustomImage; + + public CustomImageImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public CustomImage create() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomImages() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), Context.NONE); + return this; + } + + public CustomImage create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomImages() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), context); + return this; + } + + CustomImageImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new CustomImageInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public CustomImageImpl update() { + this.updateCustomImage = new CustomImageFragment(); + return this; + } + + public CustomImage apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCustomImages() + .updateWithResponse(resourceGroupName, labName, name, updateCustomImage, Context.NONE) + .getValue(); + return this; + } + + public CustomImage apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCustomImages() + .updateWithResponse(resourceGroupName, labName, name, updateCustomImage, context) + .getValue(); + return this; + } + + CustomImageImpl( + CustomImageInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "customimages"); + } + + public CustomImage refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCustomImages() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public CustomImage refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCustomImages() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public CustomImageImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CustomImageImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CustomImageImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateCustomImage.withTags(tags); + return this; + } + } + + public CustomImageImpl withVm(CustomImagePropertiesFromVm vm) { + this.innerModel().withVm(vm); + return this; + } + + public CustomImageImpl withVhd(CustomImagePropertiesCustom vhd) { + this.innerModel().withVhd(vhd); + return this; + } + + public CustomImageImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public CustomImageImpl withAuthor(String author) { + this.innerModel().withAuthor(author); + return this; + } + + public CustomImageImpl withManagedImageId(String managedImageId) { + this.innerModel().withManagedImageId(managedImageId); + return this; + } + + public CustomImageImpl withManagedSnapshotId(String managedSnapshotId) { + this.innerModel().withManagedSnapshotId(managedSnapshotId); + return this; + } + + public CustomImageImpl withDataDiskStorageInfo(List dataDiskStorageInfo) { + this.innerModel().withDataDiskStorageInfo(dataDiskStorageInfo); + return this; + } + + public CustomImageImpl withCustomImagePlan(CustomImagePropertiesFromPlan customImagePlan) { + this.innerModel().withCustomImagePlan(customImagePlan); + return this; + } + + public CustomImageImpl withIsPlanAuthorized(Boolean isPlanAuthorized) { + this.innerModel().withIsPlanAuthorized(isPlanAuthorized); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesClientImpl.java new file mode 100644 index 000000000000..2e1ce7a19726 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesClientImpl.java @@ -0,0 +1,1392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.CustomImagesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.CustomImageInner; +import com.azure.resourcemanager.devtestlabs.models.CustomImageFragment; +import com.azure.resourcemanager.devtestlabs.models.CustomImageList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CustomImagesClient. */ +public final class CustomImagesClientImpl implements CustomImagesClient { + private final ClientLogger logger = new ClientLogger(CustomImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CustomImagesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of CustomImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomImagesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(CustomImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientCustomImages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientCus") + private interface CustomImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/customimages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/customimages/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/customimages/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CustomImageInner customImage, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/customimages/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/customimages/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CustomImageFragment customImage, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomImageInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, CustomImageInner customImage) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (customImage == null) { + return Mono.error(new IllegalArgumentException("Parameter customImage is required and cannot be null.")); + } else { + customImage.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + customImage, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, CustomImageInner customImage, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (customImage == null) { + return Mono.error(new IllegalArgumentException("Parameter customImage is required and cannot be null.")); + } else { + customImage.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + customImage, + accept, + context); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CustomImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, CustomImageInner customImage) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, customImage); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CustomImageInner.class, CustomImageInner.class, Context.NONE); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, CustomImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, CustomImageInner customImage, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, customImage, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), CustomImageInner.class, CustomImageInner.class, context); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CustomImageInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, customImage).getSyncPoller(); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, CustomImageInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, customImage, context).getSyncPoller(); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, customImage) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, CustomImageInner customImage, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, customImage, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomImageInner createOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return createOrUpdateAsync(resourceGroupName, labName, name, customImage).block(); + } + + /** + * Create or replace an existing custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomImageInner createOrUpdate( + String resourceGroupName, String labName, String name, CustomImageInner customImage, Context context) { + return createOrUpdateAsync(resourceGroupName, labName, name, customImage, context).block(); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String labName, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name, Context context) { + deleteAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of custom images. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, CustomImageFragment customImage) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (customImage == null) { + return Mono.error(new IllegalArgumentException("Parameter customImage is required and cannot be null.")); + } else { + customImage.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + customImage, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of custom images. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, CustomImageFragment customImage, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (customImage == null) { + return Mono.error(new IllegalArgumentException("Parameter customImage is required and cannot be null.")); + } else { + customImage.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + customImage, + accept, + context); + } + + /** + * Allows modifying tags of custom images. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String name, CustomImageFragment customImage) { + return updateWithResponseAsync(resourceGroupName, labName, name, customImage) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of custom images. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomImageInner update( + String resourceGroupName, String labName, String name, CustomImageFragment customImage) { + return updateAsync(resourceGroupName, labName, name, customImage).block(); + } + + /** + * Allows modifying tags of custom images. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param customImage A custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a custom image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String labName, String name, CustomImageFragment customImage, Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, customImage, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesImpl.java new file mode 100644 index 000000000000..397ca97fa4ed --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/CustomImagesImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.CustomImagesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.CustomImageInner; +import com.azure.resourcemanager.devtestlabs.models.CustomImage; +import com.azure.resourcemanager.devtestlabs.models.CustomImages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CustomImagesImpl implements CustomImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomImagesImpl.class); + + private final CustomImagesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public CustomImagesImpl( + CustomImagesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new CustomImageImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new CustomImageImpl(inner1, this.manager())); + } + + public CustomImage get(String resourceGroupName, String labName, String name) { + CustomImageInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new CustomImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CustomImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public void delete(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, labName, name, context); + } + + public CustomImage getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "customimages"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customimages'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "customimages"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customimages'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "customimages"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customimages'.", id))); + } + this.delete(resourceGroupName, labName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "customimages"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'customimages'.", id))); + } + this.delete(resourceGroupName, labName, name, context); + } + + private CustomImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public CustomImageImpl define(String name) { + return new CustomImageImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientBuilder.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientBuilder.java new file mode 100644 index 000000000000..11293e245425 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the DevTestLabsClientImpl type. */ +@ServiceClientBuilder(serviceClients = {DevTestLabsClientImpl.class}) +public final class DevTestLabsClientBuilder { + /* + * The subscription ID. + */ + private String subscriptionId; + + /** + * Sets The subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the DevTestLabsClientBuilder. + */ + public DevTestLabsClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the DevTestLabsClientBuilder. + */ + public DevTestLabsClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the DevTestLabsClientBuilder. + */ + public DevTestLabsClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the DevTestLabsClientBuilder. + */ + public DevTestLabsClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the DevTestLabsClientBuilder. + */ + public DevTestLabsClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the DevTestLabsClientBuilder. + */ + public DevTestLabsClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DevTestLabsClientImpl with the provided parameters. + * + * @return an instance of DevTestLabsClientImpl. + */ + public DevTestLabsClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + DevTestLabsClientImpl client = + new DevTestLabsClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientImpl.java new file mode 100644 index 000000000000..db91d517d785 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DevTestLabsClientImpl.java @@ -0,0 +1,629 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.devtestlabs.fluent.ArmTemplatesClient; +import com.azure.resourcemanager.devtestlabs.fluent.ArtifactSourcesClient; +import com.azure.resourcemanager.devtestlabs.fluent.ArtifactsClient; +import com.azure.resourcemanager.devtestlabs.fluent.CostsClient; +import com.azure.resourcemanager.devtestlabs.fluent.CustomImagesClient; +import com.azure.resourcemanager.devtestlabs.fluent.DevTestLabsClient; +import com.azure.resourcemanager.devtestlabs.fluent.DisksClient; +import com.azure.resourcemanager.devtestlabs.fluent.EnvironmentsClient; +import com.azure.resourcemanager.devtestlabs.fluent.FormulasClient; +import com.azure.resourcemanager.devtestlabs.fluent.GalleryImagesClient; +import com.azure.resourcemanager.devtestlabs.fluent.GlobalSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.LabsClient; +import com.azure.resourcemanager.devtestlabs.fluent.NotificationChannelsClient; +import com.azure.resourcemanager.devtestlabs.fluent.OperationsClient; +import com.azure.resourcemanager.devtestlabs.fluent.PoliciesClient; +import com.azure.resourcemanager.devtestlabs.fluent.PolicySetsClient; +import com.azure.resourcemanager.devtestlabs.fluent.ProviderOperationsClient; +import com.azure.resourcemanager.devtestlabs.fluent.SchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.SecretsClient; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceFabricSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceFabricsClient; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceRunnersClient; +import com.azure.resourcemanager.devtestlabs.fluent.UsersClient; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualMachineSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualNetworksClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the DevTestLabsClientImpl type. */ +@ServiceClient(builder = DevTestLabsClientBuilder.class) +public final class DevTestLabsClientImpl implements DevTestLabsClient { + private final ClientLogger logger = new ClientLogger(DevTestLabsClientImpl.class); + + /** The subscription ID. */ + private final String subscriptionId; + + /** + * Gets The subscription ID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ProviderOperationsClient object to access its operations. */ + private final ProviderOperationsClient providerOperations; + + /** + * Gets the ProviderOperationsClient object to access its operations. + * + * @return the ProviderOperationsClient object. + */ + public ProviderOperationsClient getProviderOperations() { + return this.providerOperations; + } + + /** The LabsClient object to access its operations. */ + private final LabsClient labs; + + /** + * Gets the LabsClient object to access its operations. + * + * @return the LabsClient object. + */ + public LabsClient getLabs() { + return this.labs; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The GlobalSchedulesClient object to access its operations. */ + private final GlobalSchedulesClient globalSchedules; + + /** + * Gets the GlobalSchedulesClient object to access its operations. + * + * @return the GlobalSchedulesClient object. + */ + public GlobalSchedulesClient getGlobalSchedules() { + return this.globalSchedules; + } + + /** The ArtifactSourcesClient object to access its operations. */ + private final ArtifactSourcesClient artifactSources; + + /** + * Gets the ArtifactSourcesClient object to access its operations. + * + * @return the ArtifactSourcesClient object. + */ + public ArtifactSourcesClient getArtifactSources() { + return this.artifactSources; + } + + /** The ArmTemplatesClient object to access its operations. */ + private final ArmTemplatesClient armTemplates; + + /** + * Gets the ArmTemplatesClient object to access its operations. + * + * @return the ArmTemplatesClient object. + */ + public ArmTemplatesClient getArmTemplates() { + return this.armTemplates; + } + + /** The ArtifactsClient object to access its operations. */ + private final ArtifactsClient artifacts; + + /** + * Gets the ArtifactsClient object to access its operations. + * + * @return the ArtifactsClient object. + */ + public ArtifactsClient getArtifacts() { + return this.artifacts; + } + + /** The CostsClient object to access its operations. */ + private final CostsClient costs; + + /** + * Gets the CostsClient object to access its operations. + * + * @return the CostsClient object. + */ + public CostsClient getCosts() { + return this.costs; + } + + /** The CustomImagesClient object to access its operations. */ + private final CustomImagesClient customImages; + + /** + * Gets the CustomImagesClient object to access its operations. + * + * @return the CustomImagesClient object. + */ + public CustomImagesClient getCustomImages() { + return this.customImages; + } + + /** The FormulasClient object to access its operations. */ + private final FormulasClient formulas; + + /** + * Gets the FormulasClient object to access its operations. + * + * @return the FormulasClient object. + */ + public FormulasClient getFormulas() { + return this.formulas; + } + + /** The GalleryImagesClient object to access its operations. */ + private final GalleryImagesClient galleryImages; + + /** + * Gets the GalleryImagesClient object to access its operations. + * + * @return the GalleryImagesClient object. + */ + public GalleryImagesClient getGalleryImages() { + return this.galleryImages; + } + + /** The NotificationChannelsClient object to access its operations. */ + private final NotificationChannelsClient notificationChannels; + + /** + * Gets the NotificationChannelsClient object to access its operations. + * + * @return the NotificationChannelsClient object. + */ + public NotificationChannelsClient getNotificationChannels() { + return this.notificationChannels; + } + + /** The PolicySetsClient object to access its operations. */ + private final PolicySetsClient policySets; + + /** + * Gets the PolicySetsClient object to access its operations. + * + * @return the PolicySetsClient object. + */ + public PolicySetsClient getPolicySets() { + return this.policySets; + } + + /** The PoliciesClient object to access its operations. */ + private final PoliciesClient policies; + + /** + * Gets the PoliciesClient object to access its operations. + * + * @return the PoliciesClient object. + */ + public PoliciesClient getPolicies() { + return this.policies; + } + + /** The SchedulesClient object to access its operations. */ + private final SchedulesClient schedules; + + /** + * Gets the SchedulesClient object to access its operations. + * + * @return the SchedulesClient object. + */ + public SchedulesClient getSchedules() { + return this.schedules; + } + + /** The ServiceRunnersClient object to access its operations. */ + private final ServiceRunnersClient serviceRunners; + + /** + * Gets the ServiceRunnersClient object to access its operations. + * + * @return the ServiceRunnersClient object. + */ + public ServiceRunnersClient getServiceRunners() { + return this.serviceRunners; + } + + /** The UsersClient object to access its operations. */ + private final UsersClient users; + + /** + * Gets the UsersClient object to access its operations. + * + * @return the UsersClient object. + */ + public UsersClient getUsers() { + return this.users; + } + + /** The DisksClient object to access its operations. */ + private final DisksClient disks; + + /** + * Gets the DisksClient object to access its operations. + * + * @return the DisksClient object. + */ + public DisksClient getDisks() { + return this.disks; + } + + /** The EnvironmentsClient object to access its operations. */ + private final EnvironmentsClient environments; + + /** + * Gets the EnvironmentsClient object to access its operations. + * + * @return the EnvironmentsClient object. + */ + public EnvironmentsClient getEnvironments() { + return this.environments; + } + + /** The SecretsClient object to access its operations. */ + private final SecretsClient secrets; + + /** + * Gets the SecretsClient object to access its operations. + * + * @return the SecretsClient object. + */ + public SecretsClient getSecrets() { + return this.secrets; + } + + /** The ServiceFabricsClient object to access its operations. */ + private final ServiceFabricsClient serviceFabrics; + + /** + * Gets the ServiceFabricsClient object to access its operations. + * + * @return the ServiceFabricsClient object. + */ + public ServiceFabricsClient getServiceFabrics() { + return this.serviceFabrics; + } + + /** The ServiceFabricSchedulesClient object to access its operations. */ + private final ServiceFabricSchedulesClient serviceFabricSchedules; + + /** + * Gets the ServiceFabricSchedulesClient object to access its operations. + * + * @return the ServiceFabricSchedulesClient object. + */ + public ServiceFabricSchedulesClient getServiceFabricSchedules() { + return this.serviceFabricSchedules; + } + + /** The VirtualMachinesClient object to access its operations. */ + private final VirtualMachinesClient virtualMachines; + + /** + * Gets the VirtualMachinesClient object to access its operations. + * + * @return the VirtualMachinesClient object. + */ + public VirtualMachinesClient getVirtualMachines() { + return this.virtualMachines; + } + + /** The VirtualMachineSchedulesClient object to access its operations. */ + private final VirtualMachineSchedulesClient virtualMachineSchedules; + + /** + * Gets the VirtualMachineSchedulesClient object to access its operations. + * + * @return the VirtualMachineSchedulesClient object. + */ + public VirtualMachineSchedulesClient getVirtualMachineSchedules() { + return this.virtualMachineSchedules; + } + + /** The VirtualNetworksClient object to access its operations. */ + private final VirtualNetworksClient virtualNetworks; + + /** + * Gets the VirtualNetworksClient object to access its operations. + * + * @return the VirtualNetworksClient object. + */ + public VirtualNetworksClient getVirtualNetworks() { + return this.virtualNetworks; + } + + /** + * Initializes an instance of DevTestLabsClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The subscription ID. + * @param endpoint server parameter. + */ + DevTestLabsClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2018-09-15"; + this.providerOperations = new ProviderOperationsClientImpl(this); + this.labs = new LabsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.globalSchedules = new GlobalSchedulesClientImpl(this); + this.artifactSources = new ArtifactSourcesClientImpl(this); + this.armTemplates = new ArmTemplatesClientImpl(this); + this.artifacts = new ArtifactsClientImpl(this); + this.costs = new CostsClientImpl(this); + this.customImages = new CustomImagesClientImpl(this); + this.formulas = new FormulasClientImpl(this); + this.galleryImages = new GalleryImagesClientImpl(this); + this.notificationChannels = new NotificationChannelsClientImpl(this); + this.policySets = new PolicySetsClientImpl(this); + this.policies = new PoliciesClientImpl(this); + this.schedules = new SchedulesClientImpl(this); + this.serviceRunners = new ServiceRunnersClientImpl(this); + this.users = new UsersClientImpl(this); + this.disks = new DisksClientImpl(this); + this.environments = new EnvironmentsClientImpl(this); + this.secrets = new SecretsClientImpl(this); + this.serviceFabrics = new ServiceFabricsClientImpl(this); + this.serviceFabricSchedules = new ServiceFabricSchedulesClientImpl(this); + this.virtualMachines = new VirtualMachinesClientImpl(this); + this.virtualMachineSchedules = new VirtualMachineSchedulesClientImpl(this); + this.virtualNetworks = new VirtualNetworksClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DiskImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DiskImpl.java new file mode 100644 index 000000000000..6cc7ec9750ae --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DiskImpl.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.DiskInner; +import com.azure.resourcemanager.devtestlabs.models.AttachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.Disk; +import com.azure.resourcemanager.devtestlabs.models.DiskFragment; +import com.azure.resourcemanager.devtestlabs.models.StorageType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class DiskImpl implements Disk, Disk.Definition, Disk.Update { + private DiskInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public StorageType diskType() { + return this.innerModel().diskType(); + } + + public Integer diskSizeGiB() { + return this.innerModel().diskSizeGiB(); + } + + public String leasedByLabVmId() { + return this.innerModel().leasedByLabVmId(); + } + + public String diskBlobName() { + return this.innerModel().diskBlobName(); + } + + public String diskUri() { + return this.innerModel().diskUri(); + } + + public String storageAccountId() { + return this.innerModel().storageAccountId(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String hostCaching() { + return this.innerModel().hostCaching(); + } + + public String managedDiskId() { + return this.innerModel().managedDiskId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DiskInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String username; + + private String name; + + private DiskFragment updateDisk; + + public DiskImpl withExistingUser(String resourceGroupName, String labName, String username) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.username = username; + return this; + } + + public Disk create() { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), Context.NONE); + return this; + } + + public Disk create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), context); + return this; + } + + DiskImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new DiskInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public DiskImpl update() { + this.updateDisk = new DiskFragment(); + return this; + } + + public Disk apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .updateWithResponse(resourceGroupName, labName, username, name, updateDisk, Context.NONE) + .getValue(); + return this; + } + + public Disk apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .updateWithResponse(resourceGroupName, labName, username, name, updateDisk, context) + .getValue(); + return this; + } + + DiskImpl(DiskInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.username = Utils.getValueFromIdByName(innerObject.id(), "users"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "disks"); + } + + public Disk refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Disk refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getDisks() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, context) + .getValue(); + return this; + } + + public void attach(AttachDiskProperties attachDiskProperties) { + serviceManager.disks().attach(resourceGroupName, labName, username, name, attachDiskProperties); + } + + public void attach(AttachDiskProperties attachDiskProperties, Context context) { + serviceManager.disks().attach(resourceGroupName, labName, username, name, attachDiskProperties, context); + } + + public void detach(DetachDiskProperties detachDiskProperties) { + serviceManager.disks().detach(resourceGroupName, labName, username, name, detachDiskProperties); + } + + public void detach(DetachDiskProperties detachDiskProperties, Context context) { + serviceManager.disks().detach(resourceGroupName, labName, username, name, detachDiskProperties, context); + } + + public DiskImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiskImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiskImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateDisk.withTags(tags); + return this; + } + } + + public DiskImpl withDiskType(StorageType diskType) { + this.innerModel().withDiskType(diskType); + return this; + } + + public DiskImpl withDiskSizeGiB(Integer diskSizeGiB) { + this.innerModel().withDiskSizeGiB(diskSizeGiB); + return this; + } + + public DiskImpl withLeasedByLabVmId(String leasedByLabVmId) { + this.innerModel().withLeasedByLabVmId(leasedByLabVmId); + return this; + } + + public DiskImpl withDiskBlobName(String diskBlobName) { + this.innerModel().withDiskBlobName(diskBlobName); + return this; + } + + public DiskImpl withDiskUri(String diskUri) { + this.innerModel().withDiskUri(diskUri); + return this; + } + + public DiskImpl withStorageAccountId(String storageAccountId) { + this.innerModel().withStorageAccountId(storageAccountId); + return this; + } + + public DiskImpl withHostCaching(String hostCaching) { + this.innerModel().withHostCaching(hostCaching); + return this; + } + + public DiskImpl withManagedDiskId(String managedDiskId) { + this.innerModel().withManagedDiskId(managedDiskId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksClientImpl.java new file mode 100644 index 000000000000..057f297c2e69 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksClientImpl.java @@ -0,0 +1,2231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.DisksClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.DiskInner; +import com.azure.resourcemanager.devtestlabs.models.AttachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DiskFragment; +import com.azure.resourcemanager.devtestlabs.models.DiskList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DisksClient. */ +public final class DisksClientImpl implements DisksClient { + private final ClientLogger logger = new ClientLogger(DisksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DisksService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of DisksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DisksClientImpl(DevTestLabsClientImpl client) { + this.service = RestProxy.create(DisksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientDisks to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientDis") + private interface DisksService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/disks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/disks/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/disks/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskInner disk, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/disks/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/disks/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DiskFragment disk, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/disks/{name}/attach") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> attach( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AttachDiskProperties attachDiskProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/disks/{name}/detach") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> detach( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DetachDiskProperties detachDiskProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, username, expand, filter, top, orderby)); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context)); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner get(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, username, name, expand).block(); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand, context).block(); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, DiskInner disk) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + disk, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, DiskInner disk, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + disk, + accept, + context); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DiskInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, DiskInner disk) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, disk); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskInner.class, DiskInner.class, Context.NONE); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DiskInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, DiskInner disk, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, disk, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskInner.class, DiskInner.class, context); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, DiskInner disk) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, disk).getSyncPoller(); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DiskInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, DiskInner disk, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, disk, context).getSyncPoller(); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, DiskInner disk) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, disk) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, DiskInner disk, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, disk, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, DiskInner disk) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, disk).block(); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, DiskInner disk, Context context) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, disk, context).block(); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String username, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, username, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, labName, username, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name) { + return beginDeleteAsync(resourceGroupName, labName, username, name).getSyncPoller(); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, username, name, context).getSyncPoller(); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String username, String name) { + return beginDeleteAsync(resourceGroupName, labName, username, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, username, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String username, String name) { + deleteAsync(resourceGroupName, labName, username, name).block(); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String username, String name, Context context) { + deleteAsync(resourceGroupName, labName, username, name, context).block(); + } + + /** + * Allows modifying tags of disks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, DiskFragment disk) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + disk, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of disks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, DiskFragment disk, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (disk == null) { + return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null.")); + } else { + disk.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + disk, + accept, + context); + } + + /** + * Allows modifying tags of disks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String username, String name, DiskFragment disk) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, disk) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of disks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskInner update(String resourceGroupName, String labName, String username, String name, DiskFragment disk) { + return updateAsync(resourceGroupName, labName, username, name, disk).block(); + } + + /** + * Allows modifying tags of disks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String labName, String username, String name, DiskFragment disk, Context context) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, disk, context).block(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> attachWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (attachDiskProperties == null) { + return Mono + .error(new IllegalArgumentException("Parameter attachDiskProperties is required and cannot be null.")); + } else { + attachDiskProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .attach( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + attachDiskProperties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> attachWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (attachDiskProperties == null) { + return Mono + .error(new IllegalArgumentException("Parameter attachDiskProperties is required and cannot be null.")); + } else { + attachDiskProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .attach( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + attachDiskProperties, + accept, + context); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginAttachAsync( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties) { + Mono>> mono = + attachWithResponseAsync(resourceGroupName, labName, username, name, attachDiskProperties); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginAttachAsync( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + attachWithResponseAsync(resourceGroupName, labName, username, name, attachDiskProperties, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginAttach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties) { + return beginAttachAsync(resourceGroupName, labName, username, name, attachDiskProperties).getSyncPoller(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginAttach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context) { + return beginAttachAsync(resourceGroupName, labName, username, name, attachDiskProperties, context) + .getSyncPoller(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono attachAsync( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties) { + return beginAttachAsync(resourceGroupName, labName, username, name, attachDiskProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono attachAsync( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context) { + return beginAttachAsync(resourceGroupName, labName, username, name, attachDiskProperties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties) { + attachAsync(resourceGroupName, labName, username, name, attachDiskProperties).block(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context) { + attachAsync(resourceGroupName, labName, username, name, attachDiskProperties, context).block(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> detachWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (detachDiskProperties == null) { + return Mono + .error(new IllegalArgumentException("Parameter detachDiskProperties is required and cannot be null.")); + } else { + detachDiskProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .detach( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + detachDiskProperties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> detachWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (detachDiskProperties == null) { + return Mono + .error(new IllegalArgumentException("Parameter detachDiskProperties is required and cannot be null.")); + } else { + detachDiskProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .detach( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + detachDiskProperties, + accept, + context); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDetachAsync( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties) { + Mono>> mono = + detachWithResponseAsync(resourceGroupName, labName, username, name, detachDiskProperties); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDetachAsync( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + detachWithResponseAsync(resourceGroupName, labName, username, name, detachDiskProperties, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDetach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties) { + return beginDetachAsync(resourceGroupName, labName, username, name, detachDiskProperties).getSyncPoller(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDetach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context) { + return beginDetachAsync(resourceGroupName, labName, username, name, detachDiskProperties, context) + .getSyncPoller(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono detachAsync( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties) { + return beginDetachAsync(resourceGroupName, labName, username, name, detachDiskProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono detachAsync( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context) { + return beginDetachAsync(resourceGroupName, labName, username, name, detachDiskProperties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties) { + detachAsync(resourceGroupName, labName, username, name, detachDiskProperties).block(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context) { + detachAsync(resourceGroupName, labName, username, name, detachDiskProperties, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksImpl.java new file mode 100644 index 000000000000..565a3870f4b4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DisksImpl.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.DisksClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.DiskInner; +import com.azure.resourcemanager.devtestlabs.models.AttachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.Disk; +import com.azure.resourcemanager.devtestlabs.models.Disks; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DisksImpl implements Disks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DisksImpl.class); + + private final DisksClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public DisksImpl(DisksClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String username) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName, username); + return Utils.mapPage(inner, inner1 -> new DiskImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, username, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new DiskImpl(inner1, this.manager())); + } + + public Disk get(String resourceGroupName, String labName, String username, String name) { + DiskInner inner = this.serviceClient().get(resourceGroupName, labName, username, name); + if (inner != null) { + return new DiskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, username, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String username, String name) { + this.serviceClient().delete(resourceGroupName, labName, username, name); + } + + public void delete(String resourceGroupName, String labName, String username, String name, Context context) { + this.serviceClient().delete(resourceGroupName, labName, username, name, context); + } + + public void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties) { + this.serviceClient().attach(resourceGroupName, labName, username, name, attachDiskProperties); + } + + public void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context) { + this.serviceClient().attach(resourceGroupName, labName, username, name, attachDiskProperties, context); + } + + public void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties) { + this.serviceClient().detach(resourceGroupName, labName, username, name, detachDiskProperties); + } + + public void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context) { + this.serviceClient().detach(resourceGroupName, labName, username, name, detachDiskProperties, context); + } + + public Disk getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "disks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "disks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, username, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "disks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + this.delete(resourceGroupName, labName, username, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "disks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'disks'.", id))); + } + this.delete(resourceGroupName, labName, username, name, context); + } + + private DisksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public DiskImpl define(String name) { + return new DiskImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DtlEnvironmentImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DtlEnvironmentImpl.java new file mode 100644 index 000000000000..bf5c1ce014e2 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/DtlEnvironmentImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.DtlEnvironmentInner; +import com.azure.resourcemanager.devtestlabs.models.DtlEnvironment; +import com.azure.resourcemanager.devtestlabs.models.DtlEnvironmentFragment; +import com.azure.resourcemanager.devtestlabs.models.EnvironmentDeploymentProperties; +import java.util.Collections; +import java.util.Map; + +public final class DtlEnvironmentImpl implements DtlEnvironment, DtlEnvironment.Definition, DtlEnvironment.Update { + private DtlEnvironmentInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public EnvironmentDeploymentProperties deploymentProperties() { + return this.innerModel().deploymentProperties(); + } + + public String armTemplateDisplayName() { + return this.innerModel().armTemplateDisplayName(); + } + + public String resourceGroupId() { + return this.innerModel().resourceGroupId(); + } + + public String createdByUser() { + return this.innerModel().createdByUser(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DtlEnvironmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String username; + + private String name; + + private DtlEnvironmentFragment updateDtlEnvironment; + + public DtlEnvironmentImpl withExistingUser(String resourceGroupName, String labName, String username) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.username = username; + return this; + } + + public DtlEnvironment create() { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironments() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), Context.NONE); + return this; + } + + public DtlEnvironment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironments() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), context); + return this; + } + + DtlEnvironmentImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new DtlEnvironmentInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public DtlEnvironmentImpl update() { + this.updateDtlEnvironment = new DtlEnvironmentFragment(); + return this; + } + + public DtlEnvironment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironments() + .updateWithResponse(resourceGroupName, labName, username, name, updateDtlEnvironment, Context.NONE) + .getValue(); + return this; + } + + public DtlEnvironment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getEnvironments() + .updateWithResponse(resourceGroupName, labName, username, name, updateDtlEnvironment, context) + .getValue(); + return this; + } + + DtlEnvironmentImpl( + DtlEnvironmentInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.username = Utils.getValueFromIdByName(innerObject.id(), "users"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "environments"); + } + + public DtlEnvironment refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getEnvironments() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public DtlEnvironment refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getEnvironments() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, context) + .getValue(); + return this; + } + + public DtlEnvironmentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DtlEnvironmentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DtlEnvironmentImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateDtlEnvironment.withTags(tags); + return this; + } + } + + public DtlEnvironmentImpl withDeploymentProperties(EnvironmentDeploymentProperties deploymentProperties) { + this.innerModel().withDeploymentProperties(deploymentProperties); + return this; + } + + public DtlEnvironmentImpl withArmTemplateDisplayName(String armTemplateDisplayName) { + this.innerModel().withArmTemplateDisplayName(armTemplateDisplayName); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsClientImpl.java new file mode 100644 index 000000000000..e77dbc04503f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsClientImpl.java @@ -0,0 +1,1538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.EnvironmentsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.DtlEnvironmentInner; +import com.azure.resourcemanager.devtestlabs.models.DtlEnvironmentFragment; +import com.azure.resourcemanager.devtestlabs.models.DtlEnvironmentList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EnvironmentsClient. */ +public final class EnvironmentsClientImpl implements EnvironmentsClient { + private final ClientLogger logger = new ClientLogger(EnvironmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final EnvironmentsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of EnvironmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnvironmentsClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(EnvironmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientEnvironments to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientEnv") + private interface EnvironmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/environments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/environments/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/environments/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DtlEnvironmentInner dtlEnvironment, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/environments/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/environments/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DtlEnvironmentFragment dtlEnvironment, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, username, expand, filter, top, orderby)); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context)); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DtlEnvironmentInner get(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, username, name, expand).block(); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand, context).block(); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentInner dtlEnvironment) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (dtlEnvironment == null) { + return Mono.error(new IllegalArgumentException("Parameter dtlEnvironment is required and cannot be null.")); + } else { + dtlEnvironment.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + dtlEnvironment, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentInner dtlEnvironment, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (dtlEnvironment == null) { + return Mono.error(new IllegalArgumentException("Parameter dtlEnvironment is required and cannot be null.")); + } else { + dtlEnvironment.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + dtlEnvironment, + accept, + context); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DtlEnvironmentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentInner dtlEnvironment) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, dtlEnvironment); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DtlEnvironmentInner.class, + DtlEnvironmentInner.class, + Context.NONE); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DtlEnvironmentInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentInner dtlEnvironment, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, dtlEnvironment, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DtlEnvironmentInner.class, DtlEnvironmentInner.class, context); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DtlEnvironmentInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentInner dtlEnvironment) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, dtlEnvironment).getSyncPoller(); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DtlEnvironmentInner> beginCreateOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentInner dtlEnvironment, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, dtlEnvironment, context) + .getSyncPoller(); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentInner dtlEnvironment) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, dtlEnvironment) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentInner dtlEnvironment, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, dtlEnvironment, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DtlEnvironmentInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentInner dtlEnvironment) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, dtlEnvironment).block(); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DtlEnvironmentInner createOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentInner dtlEnvironment, + Context context) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, dtlEnvironment, context).block(); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String username, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, username, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, labName, username, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name) { + return beginDeleteAsync(resourceGroupName, labName, username, name).getSyncPoller(); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, username, name, context).getSyncPoller(); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String username, String name) { + return beginDeleteAsync(resourceGroupName, labName, username, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, username, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String username, String name) { + deleteAsync(resourceGroupName, labName, username, name).block(); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String username, String name, Context context) { + deleteAsync(resourceGroupName, labName, username, name, context).block(); + } + + /** + * Allows modifying tags of environments. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentFragment dtlEnvironment) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (dtlEnvironment == null) { + return Mono.error(new IllegalArgumentException("Parameter dtlEnvironment is required and cannot be null.")); + } else { + dtlEnvironment.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + dtlEnvironment, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of environments. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentFragment dtlEnvironment, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (dtlEnvironment == null) { + return Mono.error(new IllegalArgumentException("Parameter dtlEnvironment is required and cannot be null.")); + } else { + dtlEnvironment.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + dtlEnvironment, + accept, + context); + } + + /** + * Allows modifying tags of environments. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentFragment dtlEnvironment) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, dtlEnvironment) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of environments. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DtlEnvironmentInner update( + String resourceGroupName, String labName, String username, String name, DtlEnvironmentFragment dtlEnvironment) { + return updateAsync(resourceGroupName, labName, username, name, dtlEnvironment).block(); + } + + /** + * Allows modifying tags of environments. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an environment, which is essentially an ARM template deployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String name, + DtlEnvironmentFragment dtlEnvironment, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, dtlEnvironment, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsImpl.java new file mode 100644 index 000000000000..398728482f71 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EnvironmentsImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.EnvironmentsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.DtlEnvironmentInner; +import com.azure.resourcemanager.devtestlabs.models.DtlEnvironment; +import com.azure.resourcemanager.devtestlabs.models.Environments; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EnvironmentsImpl implements Environments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnvironmentsImpl.class); + + private final EnvironmentsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public EnvironmentsImpl( + EnvironmentsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String username) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName, username); + return Utils.mapPage(inner, inner1 -> new DtlEnvironmentImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, username, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new DtlEnvironmentImpl(inner1, this.manager())); + } + + public DtlEnvironment get(String resourceGroupName, String labName, String username, String name) { + DtlEnvironmentInner inner = this.serviceClient().get(resourceGroupName, labName, username, name); + if (inner != null) { + return new DtlEnvironmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, username, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DtlEnvironmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String username, String name) { + this.serviceClient().delete(resourceGroupName, labName, username, name); + } + + public void delete(String resourceGroupName, String labName, String username, String name, Context context) { + this.serviceClient().delete(resourceGroupName, labName, username, name, context); + } + + public DtlEnvironment getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "environments"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "environments"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, username, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "environments"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + this.delete(resourceGroupName, labName, username, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "environments"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'environments'.", id))); + } + this.delete(resourceGroupName, labName, username, name, context); + } + + private EnvironmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public DtlEnvironmentImpl define(String name) { + return new DtlEnvironmentImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EvaluatePoliciesResponseImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EvaluatePoliciesResponseImpl.java new file mode 100644 index 000000000000..83c03c61b320 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/EvaluatePoliciesResponseImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.EvaluatePoliciesResponseInner; +import com.azure.resourcemanager.devtestlabs.models.EvaluatePoliciesResponse; +import com.azure.resourcemanager.devtestlabs.models.PolicySetResult; +import java.util.Collections; +import java.util.List; + +public final class EvaluatePoliciesResponseImpl implements EvaluatePoliciesResponse { + private EvaluatePoliciesResponseInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + EvaluatePoliciesResponseImpl( + EvaluatePoliciesResponseInner innerObject, + com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List results() { + List inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public EvaluatePoliciesResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulaImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulaImpl.java new file mode 100644 index 000000000000..7dc772b16231 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulaImpl.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.FormulaInner; +import com.azure.resourcemanager.devtestlabs.models.Formula; +import com.azure.resourcemanager.devtestlabs.models.FormulaFragment; +import com.azure.resourcemanager.devtestlabs.models.FormulaPropertiesFromVm; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineCreationParameter; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class FormulaImpl implements Formula, Formula.Definition, Formula.Update { + private FormulaInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public String author() { + return this.innerModel().author(); + } + + public String osType() { + return this.innerModel().osType(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public LabVirtualMachineCreationParameter formulaContent() { + return this.innerModel().formulaContent(); + } + + public FormulaPropertiesFromVm vm() { + return this.innerModel().vm(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public FormulaInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + private FormulaFragment updateFormula; + + public FormulaImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public Formula create() { + this.innerObject = + serviceManager + .serviceClient() + .getFormulas() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), Context.NONE); + return this; + } + + public Formula create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFormulas() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), context); + return this; + } + + FormulaImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new FormulaInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public FormulaImpl update() { + this.updateFormula = new FormulaFragment(); + return this; + } + + public Formula apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFormulas() + .updateWithResponse(resourceGroupName, labName, name, updateFormula, Context.NONE) + .getValue(); + return this; + } + + public Formula apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFormulas() + .updateWithResponse(resourceGroupName, labName, name, updateFormula, context) + .getValue(); + return this; + } + + FormulaImpl(FormulaInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "formulas"); + } + + public Formula refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getFormulas() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Formula refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getFormulas() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public FormulaImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public FormulaImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public FormulaImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateFormula.withTags(tags); + return this; + } + } + + public FormulaImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public FormulaImpl withOsType(String osType) { + this.innerModel().withOsType(osType); + return this; + } + + public FormulaImpl withFormulaContent(LabVirtualMachineCreationParameter formulaContent) { + this.innerModel().withFormulaContent(formulaContent); + return this; + } + + public FormulaImpl withVm(FormulaPropertiesFromVm vm) { + this.innerModel().withVm(vm); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasClientImpl.java new file mode 100644 index 000000000000..e76cdb3c4a65 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasClientImpl.java @@ -0,0 +1,1295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.FormulasClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.FormulaInner; +import com.azure.resourcemanager.devtestlabs.models.FormulaFragment; +import com.azure.resourcemanager.devtestlabs.models.FormulaList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FormulasClient. */ +public final class FormulasClientImpl implements FormulasClient { + private final ClientLogger logger = new ClientLogger(FormulasClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FormulasService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of FormulasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FormulasClientImpl(DevTestLabsClientImpl client) { + this.service = RestProxy.create(FormulasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientFormulas to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientFor") + private interface FormulasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/formulas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/formulas/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/formulas/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FormulaInner formula, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/formulas/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/formulas/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FormulaFragment formula, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FormulaInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, FormulaInner formula) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (formula == null) { + return Mono.error(new IllegalArgumentException("Parameter formula is required and cannot be null.")); + } else { + formula.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + formula, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, FormulaInner formula, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (formula == null) { + return Mono.error(new IllegalArgumentException("Parameter formula is required and cannot be null.")); + } else { + formula.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + formula, + accept, + context); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FormulaInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, FormulaInner formula) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, formula); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FormulaInner.class, FormulaInner.class, Context.NONE); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FormulaInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, FormulaInner formula, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, formula, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FormulaInner.class, FormulaInner.class, context); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FormulaInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, FormulaInner formula) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, formula).getSyncPoller(); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FormulaInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, FormulaInner formula, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, formula, context).getSyncPoller(); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, FormulaInner formula) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, formula) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, FormulaInner formula, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, formula, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FormulaInner createOrUpdate(String resourceGroupName, String labName, String name, FormulaInner formula) { + return createOrUpdateAsync(resourceGroupName, labName, name, formula).block(); + } + + /** + * Create or replace an existing formula. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FormulaInner createOrUpdate( + String resourceGroupName, String labName, String name, FormulaInner formula, Context context) { + return createOrUpdateAsync(resourceGroupName, labName, name, formula, context).block(); + } + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, name).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of formulas. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, FormulaFragment formula) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (formula == null) { + return Mono.error(new IllegalArgumentException("Parameter formula is required and cannot be null.")); + } else { + formula.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + formula, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of formulas. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, FormulaFragment formula, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (formula == null) { + return Mono.error(new IllegalArgumentException("Parameter formula is required and cannot be null.")); + } else { + formula.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + formula, + accept, + context); + } + + /** + * Allows modifying tags of formulas. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String name, FormulaFragment formula) { + return updateWithResponseAsync(resourceGroupName, labName, name, formula) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of formulas. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FormulaInner update(String resourceGroupName, String labName, String name, FormulaFragment formula) { + return updateAsync(resourceGroupName, labName, name, formula).block(); + } + + /** + * Allows modifying tags of formulas. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param formula A formula for creating a VM, specifying an image base and other parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a formula for creating a VM, specifying an image base and other parameters. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String labName, String name, FormulaFragment formula, Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, formula, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasImpl.java new file mode 100644 index 000000000000..306392b1b660 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/FormulasImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.FormulasClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.FormulaInner; +import com.azure.resourcemanager.devtestlabs.models.Formula; +import com.azure.resourcemanager.devtestlabs.models.Formulas; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FormulasImpl implements Formulas { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FormulasImpl.class); + + private final FormulasClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public FormulasImpl( + FormulasClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new FormulaImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new FormulaImpl(inner1, this.manager())); + } + + public Formula get(String resourceGroupName, String labName, String name) { + FormulaInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new FormulaImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FormulaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, name, context); + } + + public Formula getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "formulas"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'formulas'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "formulas"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'formulas'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "formulas"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'formulas'.", id))); + } + this.deleteWithResponse(resourceGroupName, labName, name, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "formulas"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'formulas'.", id))); + } + return this.deleteWithResponse(resourceGroupName, labName, name, context); + } + + private FormulasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public FormulaImpl define(String name) { + return new FormulaImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImageImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImageImpl.java new file mode 100644 index 000000000000..ae73d33b6b4d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImageImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.devtestlabs.models.GalleryImage; +import com.azure.resourcemanager.devtestlabs.models.GalleryImageReference; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class GalleryImageImpl implements GalleryImage { + private GalleryImageInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + GalleryImageImpl( + GalleryImageInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String author() { + return this.innerModel().author(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String description() { + return this.innerModel().description(); + } + + public GalleryImageReference imageReference() { + return this.innerModel().imageReference(); + } + + public String icon() { + return this.innerModel().icon(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public String planId() { + return this.innerModel().planId(); + } + + public Boolean isPlanAuthorized() { + return this.innerModel().isPlanAuthorized(); + } + + public GalleryImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesClientImpl.java new file mode 100644 index 000000000000..5129d155c040 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesClientImpl.java @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.GalleryImagesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.devtestlabs.models.GalleryImageList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GalleryImagesClient. */ +public final class GalleryImagesClientImpl implements GalleryImagesClient { + private final ClientLogger logger = new ClientLogger(GalleryImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GalleryImagesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of GalleryImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleryImagesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(GalleryImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientGalleryImages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientGal") + private interface GalleryImagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/galleryimages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesImpl.java new file mode 100644 index 000000000000..9edd83a3fa2a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GalleryImagesImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.GalleryImagesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.devtestlabs.models.GalleryImage; +import com.azure.resourcemanager.devtestlabs.models.GalleryImages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GalleryImagesImpl implements GalleryImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImagesImpl.class); + + private final GalleryImagesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public GalleryImagesImpl( + GalleryImagesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + private GalleryImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GenerateUploadUriResponseImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GenerateUploadUriResponseImpl.java new file mode 100644 index 000000000000..c6cc788e1ac8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GenerateUploadUriResponseImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.GenerateUploadUriResponseInner; +import com.azure.resourcemanager.devtestlabs.models.GenerateUploadUriResponse; + +public final class GenerateUploadUriResponseImpl implements GenerateUploadUriResponse { + private GenerateUploadUriResponseInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + GenerateUploadUriResponseImpl( + GenerateUploadUriResponseInner innerObject, + com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String uploadUri() { + return this.innerModel().uploadUri(); + } + + public GenerateUploadUriResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesClientImpl.java new file mode 100644 index 000000000000..577394214d69 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesClientImpl.java @@ -0,0 +1,1922 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.GlobalSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.RetargetScheduleProperties; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.ScheduleList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in GlobalSchedulesClient. */ +public final class GlobalSchedulesClientImpl implements GlobalSchedulesClient { + private final ClientLogger logger = new ClientLogger(GlobalSchedulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final GlobalSchedulesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of GlobalSchedulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GlobalSchedulesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(GlobalSchedulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientGlobalSchedules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientGlo") + private interface GlobalSchedulesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab" + + "/schedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab" + + "/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab" + + "/schedules/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleInner schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab" + + "/schedules/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab" + + "/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleFragment schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab" + + "/schedules/{name}/execute") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab" + + "/schedules/{name}/retarget") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> retarget( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RetargetScheduleProperties retargetScheduleProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String expand, String filter, Integer top, String orderby, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, filter, top, orderby), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(expand, filter, top, orderby), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String expand, String filter, Integer top, String orderby, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, filter, top, orderby, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List schedules in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(expand, filter, top, orderby)); + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String expand, String filter, Integer top, String orderby, Context context) { + return new PagedIterable<>(listAsync(expand, filter, top, orderby, context)); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, filter, top, orderby)); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, filter, top, orderby, context)); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String name, String expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String name) { + final String expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner getByResourceGroup(String resourceGroupName, String name) { + final String expand = null; + return getByResourceGroupAsync(resourceGroupName, name, expand).block(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String name, String expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand, context).block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, ScheduleInner schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, ScheduleInner schedule, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String name, ScheduleInner schedule) { + return createOrUpdateWithResponseAsync(resourceGroupName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner createOrUpdate(String resourceGroupName, String name, ScheduleInner schedule) { + return createOrUpdateAsync(resourceGroupName, name, schedule).block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String name, ScheduleInner schedule, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, name, schedule, context).block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String name) { + return deleteWithResponseAsync(resourceGroupName, name).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String name) { + deleteAsync(resourceGroupName, name).block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, name, context).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String name, ScheduleFragment schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String name, ScheduleFragment schedule, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String name, ScheduleFragment schedule) { + return updateWithResponseAsync(resourceGroupName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner update(String resourceGroupName, String name, ScheduleFragment schedule) { + return updateAsync(resourceGroupName, name, schedule).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String name, ScheduleFragment schedule, Context context) { + return updateWithResponseAsync(resourceGroupName, name, schedule, context).block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync(String resourceGroupName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync(String resourceGroupName, String name) { + Mono>> mono = executeWithResponseAsync(resourceGroupName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = executeWithResponseAsync(resourceGroupName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute(String resourceGroupName, String name) { + return beginExecuteAsync(resourceGroupName, name).getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute(String resourceGroupName, String name, Context context) { + return beginExecuteAsync(resourceGroupName, name, context).getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String resourceGroupName, String name) { + return beginExecuteAsync(resourceGroupName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String resourceGroupName, String name, Context context) { + return beginExecuteAsync(resourceGroupName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute(String resourceGroupName, String name) { + executeAsync(resourceGroupName, name).block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute(String resourceGroupName, String name, Context context) { + executeAsync(resourceGroupName, name, context).block(); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retargetWithResponseAsync( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (retargetScheduleProperties == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter retargetScheduleProperties is required and cannot be null.")); + } else { + retargetScheduleProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retarget( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + retargetScheduleProperties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> retargetWithResponseAsync( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (retargetScheduleProperties == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter retargetScheduleProperties is required and cannot be null.")); + } else { + retargetScheduleProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retarget( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + retargetScheduleProperties, + accept, + context); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRetargetAsync( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + Mono>> mono = + retargetWithResponseAsync(resourceGroupName, name, retargetScheduleProperties); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRetargetAsync( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + retargetWithResponseAsync(resourceGroupName, name, retargetScheduleProperties, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRetarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + return beginRetargetAsync(resourceGroupName, name, retargetScheduleProperties).getSyncPoller(); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRetarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context) { + return beginRetargetAsync(resourceGroupName, name, retargetScheduleProperties, context).getSyncPoller(); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retargetAsync( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + return beginRetargetAsync(resourceGroupName, name, retargetScheduleProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retargetAsync( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context) { + return beginRetargetAsync(resourceGroupName, name, retargetScheduleProperties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void retarget(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + retargetAsync(resourceGroupName, name, retargetScheduleProperties).block(); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void retarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context) { + retargetAsync(resourceGroupName, name, retargetScheduleProperties, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesImpl.java new file mode 100644 index 000000000000..a7f5e1579014 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/GlobalSchedulesImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.GlobalSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.GlobalSchedules; +import com.azure.resourcemanager.devtestlabs.models.RetargetScheduleProperties; +import com.azure.resourcemanager.devtestlabs.models.Schedule; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class GlobalSchedulesImpl implements GlobalSchedules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GlobalSchedulesImpl.class); + + private final GlobalSchedulesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public GlobalSchedulesImpl( + GlobalSchedulesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, String filter, Integer top, String orderby, Context context) { + PagedIterable inner = this.serviceClient().list(expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public Schedule getByResourceGroup(String resourceGroupName, String name) { + ScheduleInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, name); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String name) { + this.serviceClient().delete(resourceGroupName, name); + } + + public Response deleteWithResponse(String resourceGroupName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, name, context); + } + + public void execute(String resourceGroupName, String name) { + this.serviceClient().execute(resourceGroupName, name); + } + + public void execute(String resourceGroupName, String name, Context context) { + this.serviceClient().execute(resourceGroupName, name, context); + } + + public void retarget(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + this.serviceClient().retarget(resourceGroupName, name, retargetScheduleProperties); + } + + public void retarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context) { + this.serviceClient().retarget(resourceGroupName, name, retargetScheduleProperties, context); + } + + public Schedule getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "schedules"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + String localExpand = null; + return this.getByResourceGroupWithResponse(resourceGroupName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "schedules"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "schedules"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + this.deleteWithResponse(resourceGroupName, name, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "schedules"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'schedules'.", id))); + } + return this.deleteWithResponse(resourceGroupName, name, context); + } + + private GlobalSchedulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public ScheduleImpl define(String name) { + return new ScheduleImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabCostImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabCostImpl.java new file mode 100644 index 000000000000..f65188b766c9 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabCostImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabCostInner; +import com.azure.resourcemanager.devtestlabs.models.LabCost; +import com.azure.resourcemanager.devtestlabs.models.LabCostDetailsProperties; +import com.azure.resourcemanager.devtestlabs.models.LabCostSummaryProperties; +import com.azure.resourcemanager.devtestlabs.models.LabResourceCostProperties; +import com.azure.resourcemanager.devtestlabs.models.TargetCostProperties; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class LabCostImpl implements LabCost, LabCost.Definition, LabCost.Update { + private LabCostInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TargetCostProperties targetCost() { + return this.innerModel().targetCost(); + } + + public LabCostSummaryProperties labCostSummary() { + return this.innerModel().labCostSummary(); + } + + public List labCostDetails() { + List inner = this.innerModel().labCostDetails(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List resourceCosts() { + List inner = this.innerModel().resourceCosts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String currencyCode() { + return this.innerModel().currencyCode(); + } + + public OffsetDateTime startDateTime() { + return this.innerModel().startDateTime(); + } + + public OffsetDateTime endDateTime() { + return this.innerModel().endDateTime(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public LabCostInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + public LabCostImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public LabCost create() { + this.innerObject = + serviceManager + .serviceClient() + .getCosts() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LabCost create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCosts() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), context) + .getValue(); + return this; + } + + LabCostImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new LabCostInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public LabCostImpl update() { + return this; + } + + public LabCost apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCosts() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LabCost apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCosts() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), context) + .getValue(); + return this; + } + + LabCostImpl(LabCostInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "costs"); + } + + public LabCost refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCosts() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public LabCost refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getCosts() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public LabCostImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LabCostImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LabCostImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public LabCostImpl withTargetCost(TargetCostProperties targetCost) { + this.innerModel().withTargetCost(targetCost); + return this; + } + + public LabCostImpl withCurrencyCode(String currencyCode) { + this.innerModel().withCurrencyCode(currencyCode); + return this; + } + + public LabCostImpl withStartDateTime(OffsetDateTime startDateTime) { + this.innerModel().withStartDateTime(startDateTime); + return this; + } + + public LabCostImpl withEndDateTime(OffsetDateTime endDateTime) { + this.innerModel().withEndDateTime(endDateTime); + return this; + } + + public LabCostImpl withCreatedDate(OffsetDateTime createdDate) { + this.innerModel().withCreatedDate(createdDate); + return this; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabImpl.java new file mode 100644 index 000000000000..c9ea9c3f55b7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabImpl.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabInner; +import com.azure.resourcemanager.devtestlabs.models.EnvironmentPermission; +import com.azure.resourcemanager.devtestlabs.models.ExportResourceUsageParameters; +import com.azure.resourcemanager.devtestlabs.models.GenerateUploadUriParameter; +import com.azure.resourcemanager.devtestlabs.models.GenerateUploadUriResponse; +import com.azure.resourcemanager.devtestlabs.models.ImportLabVirtualMachineRequest; +import com.azure.resourcemanager.devtestlabs.models.Lab; +import com.azure.resourcemanager.devtestlabs.models.LabAnnouncementProperties; +import com.azure.resourcemanager.devtestlabs.models.LabFragment; +import com.azure.resourcemanager.devtestlabs.models.LabSupportProperties; +import com.azure.resourcemanager.devtestlabs.models.LabVhd; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineCreationParameter; +import com.azure.resourcemanager.devtestlabs.models.PremiumDataDisk; +import com.azure.resourcemanager.devtestlabs.models.StorageType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class LabImpl implements Lab, Lab.Definition, Lab.Update { + private LabInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String defaultStorageAccount() { + return this.innerModel().defaultStorageAccount(); + } + + public String defaultPremiumStorageAccount() { + return this.innerModel().defaultPremiumStorageAccount(); + } + + public String artifactsStorageAccount() { + return this.innerModel().artifactsStorageAccount(); + } + + public String premiumDataDiskStorageAccount() { + return this.innerModel().premiumDataDiskStorageAccount(); + } + + public String vaultName() { + return this.innerModel().vaultName(); + } + + public StorageType labStorageType() { + return this.innerModel().labStorageType(); + } + + public List mandatoryArtifactsResourceIdsLinux() { + List inner = this.innerModel().mandatoryArtifactsResourceIdsLinux(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List mandatoryArtifactsResourceIdsWindows() { + List inner = this.innerModel().mandatoryArtifactsResourceIdsWindows(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public PremiumDataDisk premiumDataDisks() { + return this.innerModel().premiumDataDisks(); + } + + public EnvironmentPermission environmentPermission() { + return this.innerModel().environmentPermission(); + } + + public LabAnnouncementProperties announcement() { + return this.innerModel().announcement(); + } + + public LabSupportProperties support() { + return this.innerModel().support(); + } + + public String vmCreationResourceGroup() { + return this.innerModel().vmCreationResourceGroup(); + } + + public String publicIpId() { + return this.innerModel().publicIpId(); + } + + public String loadBalancerId() { + return this.innerModel().loadBalancerId(); + } + + public String networkSecurityGroupId() { + return this.innerModel().networkSecurityGroupId(); + } + + public Map extendedProperties() { + Map inner = this.innerModel().extendedProperties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public LabInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String name; + + private LabFragment updateLab; + + public LabImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Lab create() { + this.innerObject = + serviceManager + .serviceClient() + .getLabs() + .createOrUpdate(resourceGroupName, name, this.innerModel(), Context.NONE); + return this; + } + + public Lab create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLabs() + .createOrUpdate(resourceGroupName, name, this.innerModel(), context); + return this; + } + + LabImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new LabInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public LabImpl update() { + this.updateLab = new LabFragment(); + return this; + } + + public Lab apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLabs() + .updateWithResponse(resourceGroupName, name, updateLab, Context.NONE) + .getValue(); + return this; + } + + public Lab apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLabs() + .updateWithResponse(resourceGroupName, name, updateLab, context) + .getValue(); + return this; + } + + LabImpl(LabInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "labs"); + } + + public Lab refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getLabs() + .getByResourceGroupWithResponse(resourceGroupName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Lab refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getLabs() + .getByResourceGroupWithResponse(resourceGroupName, name, localExpand, context) + .getValue(); + return this; + } + + public void claimAnyVm() { + serviceManager.labs().claimAnyVm(resourceGroupName, name); + } + + public void claimAnyVm(Context context) { + serviceManager.labs().claimAnyVm(resourceGroupName, name, context); + } + + public void createEnvironment(LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + serviceManager.labs().createEnvironment(resourceGroupName, name, labVirtualMachineCreationParameter); + } + + public void createEnvironment( + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Context context) { + serviceManager.labs().createEnvironment(resourceGroupName, name, labVirtualMachineCreationParameter, context); + } + + public void exportResourceUsage(ExportResourceUsageParameters exportResourceUsageParameters) { + serviceManager.labs().exportResourceUsage(resourceGroupName, name, exportResourceUsageParameters); + } + + public void exportResourceUsage(ExportResourceUsageParameters exportResourceUsageParameters, Context context) { + serviceManager.labs().exportResourceUsage(resourceGroupName, name, exportResourceUsageParameters, context); + } + + public GenerateUploadUriResponse generateUploadUri(GenerateUploadUriParameter generateUploadUriParameter) { + return serviceManager.labs().generateUploadUri(resourceGroupName, name, generateUploadUriParameter); + } + + public Response generateUploadUriWithResponse( + GenerateUploadUriParameter generateUploadUriParameter, Context context) { + return serviceManager + .labs() + .generateUploadUriWithResponse(resourceGroupName, name, generateUploadUriParameter, context); + } + + public void importVirtualMachine(ImportLabVirtualMachineRequest importLabVirtualMachineRequest) { + serviceManager.labs().importVirtualMachine(resourceGroupName, name, importLabVirtualMachineRequest); + } + + public void importVirtualMachine(ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Context context) { + serviceManager.labs().importVirtualMachine(resourceGroupName, name, importLabVirtualMachineRequest, context); + } + + public PagedIterable listVhds() { + return serviceManager.labs().listVhds(resourceGroupName, name); + } + + public PagedIterable listVhds(Context context) { + return serviceManager.labs().listVhds(resourceGroupName, name, context); + } + + public LabImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LabImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LabImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateLab.withTags(tags); + return this; + } + } + + public LabImpl withLabStorageType(StorageType labStorageType) { + this.innerModel().withLabStorageType(labStorageType); + return this; + } + + public LabImpl withMandatoryArtifactsResourceIdsLinux(List mandatoryArtifactsResourceIdsLinux) { + this.innerModel().withMandatoryArtifactsResourceIdsLinux(mandatoryArtifactsResourceIdsLinux); + return this; + } + + public LabImpl withMandatoryArtifactsResourceIdsWindows(List mandatoryArtifactsResourceIdsWindows) { + this.innerModel().withMandatoryArtifactsResourceIdsWindows(mandatoryArtifactsResourceIdsWindows); + return this; + } + + public LabImpl withPremiumDataDisks(PremiumDataDisk premiumDataDisks) { + this.innerModel().withPremiumDataDisks(premiumDataDisks); + return this; + } + + public LabImpl withEnvironmentPermission(EnvironmentPermission environmentPermission) { + this.innerModel().withEnvironmentPermission(environmentPermission); + return this; + } + + public LabImpl withAnnouncement(LabAnnouncementProperties announcement) { + this.innerModel().withAnnouncement(announcement); + return this; + } + + public LabImpl withSupport(LabSupportProperties support) { + this.innerModel().withSupport(support); + return this; + } + + public LabImpl withExtendedProperties(Map extendedProperties) { + this.innerModel().withExtendedProperties(extendedProperties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVhdImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVhdImpl.java new file mode 100644 index 000000000000..0490dcedb8ca --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVhdImpl.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVhdInner; +import com.azure.resourcemanager.devtestlabs.models.LabVhd; + +public final class LabVhdImpl implements LabVhd { + private LabVhdInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + LabVhdImpl(LabVhdInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public LabVhdInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVirtualMachineImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVirtualMachineImpl.java new file mode 100644 index 000000000000..2bb09ebbe269 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabVirtualMachineImpl.java @@ -0,0 +1,585 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVirtualMachineInner; +import com.azure.resourcemanager.devtestlabs.models.ApplicableSchedule; +import com.azure.resourcemanager.devtestlabs.models.ApplyArtifactsRequest; +import com.azure.resourcemanager.devtestlabs.models.ArtifactDeploymentStatusProperties; +import com.azure.resourcemanager.devtestlabs.models.ArtifactInstallProperties; +import com.azure.resourcemanager.devtestlabs.models.ComputeVmProperties; +import com.azure.resourcemanager.devtestlabs.models.DataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.GalleryImageReference; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachine; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineFragment; +import com.azure.resourcemanager.devtestlabs.models.NetworkInterfaceProperties; +import com.azure.resourcemanager.devtestlabs.models.RdpConnection; +import com.azure.resourcemanager.devtestlabs.models.ResizeLabVirtualMachineProperties; +import com.azure.resourcemanager.devtestlabs.models.ScheduleCreationParameter; +import com.azure.resourcemanager.devtestlabs.models.VirtualMachineCreationSource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class LabVirtualMachineImpl + implements LabVirtualMachine, LabVirtualMachine.Definition, LabVirtualMachine.Update { + private LabVirtualMachineInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String notes() { + return this.innerModel().notes(); + } + + public String ownerObjectId() { + return this.innerModel().ownerObjectId(); + } + + public String ownerUserPrincipalName() { + return this.innerModel().ownerUserPrincipalName(); + } + + public String createdByUserId() { + return this.innerModel().createdByUserId(); + } + + public String createdByUser() { + return this.innerModel().createdByUser(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String computeId() { + return this.innerModel().computeId(); + } + + public String customImageId() { + return this.innerModel().customImageId(); + } + + public String osType() { + return this.innerModel().osType(); + } + + public String size() { + return this.innerModel().size(); + } + + public String username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public String sshKey() { + return this.innerModel().sshKey(); + } + + public Boolean isAuthenticationWithSshKey() { + return this.innerModel().isAuthenticationWithSshKey(); + } + + public String fqdn() { + return this.innerModel().fqdn(); + } + + public String labSubnetName() { + return this.innerModel().labSubnetName(); + } + + public String labVirtualNetworkId() { + return this.innerModel().labVirtualNetworkId(); + } + + public Boolean disallowPublicIpAddress() { + return this.innerModel().disallowPublicIpAddress(); + } + + public List artifacts() { + List inner = this.innerModel().artifacts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ArtifactDeploymentStatusProperties artifactDeploymentStatus() { + return this.innerModel().artifactDeploymentStatus(); + } + + public GalleryImageReference galleryImageReference() { + return this.innerModel().galleryImageReference(); + } + + public String planId() { + return this.innerModel().planId(); + } + + public ComputeVmProperties computeVm() { + return this.innerModel().computeVm(); + } + + public NetworkInterfaceProperties networkInterface() { + return this.innerModel().networkInterface(); + } + + public ApplicableSchedule applicableSchedule() { + ApplicableScheduleInner inner = this.innerModel().applicableSchedule(); + if (inner != null) { + return new ApplicableScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public OffsetDateTime expirationDate() { + return this.innerModel().expirationDate(); + } + + public Boolean allowClaim() { + return this.innerModel().allowClaim(); + } + + public String storageType() { + return this.innerModel().storageType(); + } + + public VirtualMachineCreationSource virtualMachineCreationSource() { + return this.innerModel().virtualMachineCreationSource(); + } + + public String environmentId() { + return this.innerModel().environmentId(); + } + + public List dataDiskParameters() { + List inner = this.innerModel().dataDiskParameters(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List scheduleParameters() { + List inner = this.innerModel().scheduleParameters(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String lastKnownPowerState() { + return this.innerModel().lastKnownPowerState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public LabVirtualMachineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + private LabVirtualMachineFragment updateLabVirtualMachine; + + public LabVirtualMachineImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public LabVirtualMachine create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), Context.NONE); + return this; + } + + public LabVirtualMachine create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), context); + return this; + } + + LabVirtualMachineImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new LabVirtualMachineInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public LabVirtualMachineImpl update() { + this.updateLabVirtualMachine = new LabVirtualMachineFragment(); + return this; + } + + public LabVirtualMachine apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .updateWithResponse(resourceGroupName, labName, name, updateLabVirtualMachine, Context.NONE) + .getValue(); + return this; + } + + public LabVirtualMachine apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .updateWithResponse(resourceGroupName, labName, name, updateLabVirtualMachine, context) + .getValue(); + return this; + } + + LabVirtualMachineImpl( + LabVirtualMachineInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "virtualmachines"); + } + + public LabVirtualMachine refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public LabVirtualMachine refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachines() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public void addDataDisk(DataDiskProperties dataDiskProperties) { + serviceManager.virtualMachines().addDataDisk(resourceGroupName, labName, name, dataDiskProperties); + } + + public void addDataDisk(DataDiskProperties dataDiskProperties, Context context) { + serviceManager.virtualMachines().addDataDisk(resourceGroupName, labName, name, dataDiskProperties, context); + } + + public void applyArtifacts(ApplyArtifactsRequest applyArtifactsRequest) { + serviceManager.virtualMachines().applyArtifacts(resourceGroupName, labName, name, applyArtifactsRequest); + } + + public void applyArtifacts(ApplyArtifactsRequest applyArtifactsRequest, Context context) { + serviceManager + .virtualMachines() + .applyArtifacts(resourceGroupName, labName, name, applyArtifactsRequest, context); + } + + public void claim() { + serviceManager.virtualMachines().claim(resourceGroupName, labName, name); + } + + public void claim(Context context) { + serviceManager.virtualMachines().claim(resourceGroupName, labName, name, context); + } + + public void detachDataDisk(DetachDataDiskProperties detachDataDiskProperties) { + serviceManager.virtualMachines().detachDataDisk(resourceGroupName, labName, name, detachDataDiskProperties); + } + + public void detachDataDisk(DetachDataDiskProperties detachDataDiskProperties, Context context) { + serviceManager + .virtualMachines() + .detachDataDisk(resourceGroupName, labName, name, detachDataDiskProperties, context); + } + + public RdpConnection getRdpFileContents() { + return serviceManager.virtualMachines().getRdpFileContents(resourceGroupName, labName, name); + } + + public Response getRdpFileContentsWithResponse(Context context) { + return serviceManager + .virtualMachines() + .getRdpFileContentsWithResponse(resourceGroupName, labName, name, context); + } + + public ApplicableSchedule listApplicableSchedules() { + return serviceManager.virtualMachines().listApplicableSchedules(resourceGroupName, labName, name); + } + + public Response listApplicableSchedulesWithResponse(Context context) { + return serviceManager + .virtualMachines() + .listApplicableSchedulesWithResponse(resourceGroupName, labName, name, context); + } + + public void redeploy() { + serviceManager.virtualMachines().redeploy(resourceGroupName, labName, name); + } + + public void redeploy(Context context) { + serviceManager.virtualMachines().redeploy(resourceGroupName, labName, name, context); + } + + public void resize(ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) { + serviceManager.virtualMachines().resize(resourceGroupName, labName, name, resizeLabVirtualMachineProperties); + } + + public void resize(ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Context context) { + serviceManager + .virtualMachines() + .resize(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, context); + } + + public void restart() { + serviceManager.virtualMachines().restart(resourceGroupName, labName, name); + } + + public void restart(Context context) { + serviceManager.virtualMachines().restart(resourceGroupName, labName, name, context); + } + + public void start() { + serviceManager.virtualMachines().start(resourceGroupName, labName, name); + } + + public void start(Context context) { + serviceManager.virtualMachines().start(resourceGroupName, labName, name, context); + } + + public void stop() { + serviceManager.virtualMachines().stop(resourceGroupName, labName, name); + } + + public void stop(Context context) { + serviceManager.virtualMachines().stop(resourceGroupName, labName, name, context); + } + + public void transferDisks() { + serviceManager.virtualMachines().transferDisks(resourceGroupName, labName, name); + } + + public void transferDisks(Context context) { + serviceManager.virtualMachines().transferDisks(resourceGroupName, labName, name, context); + } + + public void unClaim() { + serviceManager.virtualMachines().unClaim(resourceGroupName, labName, name); + } + + public void unClaim(Context context) { + serviceManager.virtualMachines().unClaim(resourceGroupName, labName, name, context); + } + + public LabVirtualMachineImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LabVirtualMachineImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LabVirtualMachineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateLabVirtualMachine.withTags(tags); + return this; + } + } + + public LabVirtualMachineImpl withNotes(String notes) { + this.innerModel().withNotes(notes); + return this; + } + + public LabVirtualMachineImpl withOwnerObjectId(String ownerObjectId) { + this.innerModel().withOwnerObjectId(ownerObjectId); + return this; + } + + public LabVirtualMachineImpl withOwnerUserPrincipalName(String ownerUserPrincipalName) { + this.innerModel().withOwnerUserPrincipalName(ownerUserPrincipalName); + return this; + } + + public LabVirtualMachineImpl withCreatedDate(OffsetDateTime createdDate) { + this.innerModel().withCreatedDate(createdDate); + return this; + } + + public LabVirtualMachineImpl withCustomImageId(String customImageId) { + this.innerModel().withCustomImageId(customImageId); + return this; + } + + public LabVirtualMachineImpl withSize(String size) { + this.innerModel().withSize(size); + return this; + } + + public LabVirtualMachineImpl withUsername(String username) { + this.innerModel().withUsername(username); + return this; + } + + public LabVirtualMachineImpl withPassword(String password) { + this.innerModel().withPassword(password); + return this; + } + + public LabVirtualMachineImpl withSshKey(String sshKey) { + this.innerModel().withSshKey(sshKey); + return this; + } + + public LabVirtualMachineImpl withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey) { + this.innerModel().withIsAuthenticationWithSshKey(isAuthenticationWithSshKey); + return this; + } + + public LabVirtualMachineImpl withLabSubnetName(String labSubnetName) { + this.innerModel().withLabSubnetName(labSubnetName); + return this; + } + + public LabVirtualMachineImpl withLabVirtualNetworkId(String labVirtualNetworkId) { + this.innerModel().withLabVirtualNetworkId(labVirtualNetworkId); + return this; + } + + public LabVirtualMachineImpl withDisallowPublicIpAddress(Boolean disallowPublicIpAddress) { + this.innerModel().withDisallowPublicIpAddress(disallowPublicIpAddress); + return this; + } + + public LabVirtualMachineImpl withArtifacts(List artifacts) { + this.innerModel().withArtifacts(artifacts); + return this; + } + + public LabVirtualMachineImpl withGalleryImageReference(GalleryImageReference galleryImageReference) { + this.innerModel().withGalleryImageReference(galleryImageReference); + return this; + } + + public LabVirtualMachineImpl withPlanId(String planId) { + this.innerModel().withPlanId(planId); + return this; + } + + public LabVirtualMachineImpl withNetworkInterface(NetworkInterfaceProperties networkInterface) { + this.innerModel().withNetworkInterface(networkInterface); + return this; + } + + public LabVirtualMachineImpl withExpirationDate(OffsetDateTime expirationDate) { + this.innerModel().withExpirationDate(expirationDate); + return this; + } + + public LabVirtualMachineImpl withAllowClaim(Boolean allowClaim) { + this.innerModel().withAllowClaim(allowClaim); + return this; + } + + public LabVirtualMachineImpl withStorageType(String storageType) { + this.innerModel().withStorageType(storageType); + return this; + } + + public LabVirtualMachineImpl withEnvironmentId(String environmentId) { + this.innerModel().withEnvironmentId(environmentId); + return this; + } + + public LabVirtualMachineImpl withDataDiskParameters(List dataDiskParameters) { + this.innerModel().withDataDiskParameters(dataDiskParameters); + return this; + } + + public LabVirtualMachineImpl withScheduleParameters(List scheduleParameters) { + this.innerModel().withScheduleParameters(scheduleParameters); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsClientImpl.java new file mode 100644 index 000000000000..384d7cb0ac53 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsClientImpl.java @@ -0,0 +1,3181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.LabsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.GenerateUploadUriResponseInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVhdInner; +import com.azure.resourcemanager.devtestlabs.models.ExportResourceUsageParameters; +import com.azure.resourcemanager.devtestlabs.models.GenerateUploadUriParameter; +import com.azure.resourcemanager.devtestlabs.models.ImportLabVirtualMachineRequest; +import com.azure.resourcemanager.devtestlabs.models.LabFragment; +import com.azure.resourcemanager.devtestlabs.models.LabList; +import com.azure.resourcemanager.devtestlabs.models.LabVhdList; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineCreationParameter; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LabsClient. */ +public final class LabsClientImpl implements LabsClient { + private final ClientLogger logger = new ClientLogger(LabsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LabsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of LabsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LabsClientImpl(DevTestLabsClientImpl client) { + this.service = RestProxy.create(LabsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientLabs to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientLab") + private interface LabsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LabInner lab, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LabFragment lab, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}/claimAnyVm") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> claimAnyVm( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}/createEnvironment") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createEnvironment( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}/exportResourceUsage") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> exportResourceUsage( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExportResourceUsageParameters exportResourceUsageParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}/generateUploadUri") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> generateUploadUri( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GenerateUploadUriParameter generateUploadUriParameter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}/importVirtualMachine") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> importVirtualMachine( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{name}/listVhds") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listVhds( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listVhdsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String expand, String filter, Integer top, String orderby, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, filter, top, orderby), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List labs in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(expand, filter, top, orderby), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, String filter, Integer top, String orderby, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, filter, top, orderby, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List labs in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(expand, filter, top, orderby)); + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, String filter, Integer top, String orderby, Context context) { + return new PagedIterable<>(listAsync(expand, filter, top, orderby, context)); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, filter, top, orderby)); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, expand, filter, top, orderby, context)); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String name, String expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String name) { + final String expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabInner getByResourceGroup(String resourceGroupName, String name) { + final String expand = null; + return getByResourceGroupAsync(resourceGroupName, name, expand).block(); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String name, String expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand, context).block(); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, LabInner lab) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (lab == null) { + return Mono.error(new IllegalArgumentException("Parameter lab is required and cannot be null.")); + } else { + lab.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + lab, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, LabInner lab, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (lab == null) { + return Mono.error(new IllegalArgumentException("Parameter lab is required and cannot be null.")); + } else { + lab.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + lab, + accept, + context); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LabInner> beginCreateOrUpdateAsync( + String resourceGroupName, String name, LabInner lab) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, name, lab); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LabInner.class, LabInner.class, Context.NONE); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LabInner> beginCreateOrUpdateAsync( + String resourceGroupName, String name, LabInner lab, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, name, lab, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LabInner.class, LabInner.class, context); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LabInner> beginCreateOrUpdate( + String resourceGroupName, String name, LabInner lab) { + return beginCreateOrUpdateAsync(resourceGroupName, name, lab).getSyncPoller(); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LabInner> beginCreateOrUpdate( + String resourceGroupName, String name, LabInner lab, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, lab, context).getSyncPoller(); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String name, LabInner lab) { + return beginCreateOrUpdateAsync(resourceGroupName, name, lab) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String name, LabInner lab, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, lab, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabInner createOrUpdate(String resourceGroupName, String name, LabInner lab) { + return createOrUpdateAsync(resourceGroupName, name, lab).block(); + } + + /** + * Create or replace an existing lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabInner createOrUpdate(String resourceGroupName, String name, LabInner lab, Context context) { + return createOrUpdateAsync(resourceGroupName, name, lab, context).block(); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String name) { + return beginDeleteAsync(resourceGroupName, name).getSyncPoller(); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, name, context).getSyncPoller(); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String name) { + return beginDeleteAsync(resourceGroupName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, name, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String name) { + deleteAsync(resourceGroupName, name).block(); + } + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String name, Context context) { + deleteAsync(resourceGroupName, name, context).block(); + } + + /** + * Allows modifying tags of labs. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String name, LabFragment lab) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (lab == null) { + return Mono.error(new IllegalArgumentException("Parameter lab is required and cannot be null.")); + } else { + lab.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + lab, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of labs. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String name, LabFragment lab, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (lab == null) { + return Mono.error(new IllegalArgumentException("Parameter lab is required and cannot be null.")); + } else { + lab.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + lab, + accept, + context); + } + + /** + * Allows modifying tags of labs. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String name, LabFragment lab) { + return updateWithResponseAsync(resourceGroupName, name, lab) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of labs. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabInner update(String resourceGroupName, String name, LabFragment lab) { + return updateAsync(resourceGroupName, name, lab).block(); + } + + /** + * Allows modifying tags of labs. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab A lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a lab. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String name, LabFragment lab, Context context) { + return updateWithResponseAsync(resourceGroupName, name, lab, context).block(); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> claimAnyVmWithResponseAsync(String resourceGroupName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .claimAnyVm( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> claimAnyVmWithResponseAsync( + String resourceGroupName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .claimAnyVm( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginClaimAnyVmAsync(String resourceGroupName, String name) { + Mono>> mono = claimAnyVmWithResponseAsync(resourceGroupName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginClaimAnyVmAsync( + String resourceGroupName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = claimAnyVmWithResponseAsync(resourceGroupName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginClaimAnyVm(String resourceGroupName, String name) { + return beginClaimAnyVmAsync(resourceGroupName, name).getSyncPoller(); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginClaimAnyVm(String resourceGroupName, String name, Context context) { + return beginClaimAnyVmAsync(resourceGroupName, name, context).getSyncPoller(); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono claimAnyVmAsync(String resourceGroupName, String name) { + return beginClaimAnyVmAsync(resourceGroupName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono claimAnyVmAsync(String resourceGroupName, String name, Context context) { + return beginClaimAnyVmAsync(resourceGroupName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void claimAnyVm(String resourceGroupName, String name) { + claimAnyVmAsync(resourceGroupName, name).block(); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void claimAnyVm(String resourceGroupName, String name, Context context) { + claimAnyVmAsync(resourceGroupName, name, context).block(); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createEnvironmentWithResponseAsync( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labVirtualMachineCreationParameter == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter labVirtualMachineCreationParameter is required and cannot be null.")); + } else { + labVirtualMachineCreationParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createEnvironment( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + labVirtualMachineCreationParameter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createEnvironmentWithResponseAsync( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labVirtualMachineCreationParameter == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter labVirtualMachineCreationParameter is required and cannot be null.")); + } else { + labVirtualMachineCreationParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createEnvironment( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + labVirtualMachineCreationParameter, + accept, + context); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCreateEnvironmentAsync( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + Mono>> mono = + createEnvironmentWithResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCreateEnvironmentAsync( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createEnvironmentWithResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCreateEnvironment( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + return beginCreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter).getSyncPoller(); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCreateEnvironment( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context) { + return beginCreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter, context) + .getSyncPoller(); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createEnvironmentAsync( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + return beginCreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createEnvironmentAsync( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context) { + return beginCreateEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void createEnvironment( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + createEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter).block(); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void createEnvironment( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context) { + createEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter, context).block(); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportResourceUsageWithResponseAsync( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (exportResourceUsageParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter exportResourceUsageParameters is required and cannot be null.")); + } else { + exportResourceUsageParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .exportResourceUsage( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + exportResourceUsageParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportResourceUsageWithResponseAsync( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (exportResourceUsageParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter exportResourceUsageParameters is required and cannot be null.")); + } else { + exportResourceUsageParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .exportResourceUsage( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + exportResourceUsageParameters, + accept, + context); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExportResourceUsageAsync( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + Mono>> mono = + exportResourceUsageWithResponseAsync(resourceGroupName, name, exportResourceUsageParameters); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExportResourceUsageAsync( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + exportResourceUsageWithResponseAsync(resourceGroupName, name, exportResourceUsageParameters, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExportResourceUsage( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + return beginExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters).getSyncPoller(); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExportResourceUsage( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context) { + return beginExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters, context) + .getSyncPoller(); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportResourceUsageAsync( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + return beginExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportResourceUsageAsync( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context) { + return beginExportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void exportResourceUsage( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + exportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters).block(); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void exportResourceUsage( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context) { + exportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters, context).block(); + } + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateUploadUriWithResponseAsync( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (generateUploadUriParameter == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter generateUploadUriParameter is required and cannot be null.")); + } else { + generateUploadUriParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateUploadUri( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + generateUploadUriParameter, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> generateUploadUriWithResponseAsync( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (generateUploadUriParameter == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter generateUploadUriParameter is required and cannot be null.")); + } else { + generateUploadUriParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateUploadUri( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + generateUploadUriParameter, + accept, + context); + } + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateUploadUriAsync( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter) { + return generateUploadUriWithResponseAsync(resourceGroupName, name, generateUploadUriParameter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GenerateUploadUriResponseInner generateUploadUri( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter) { + return generateUploadUriAsync(resourceGroupName, name, generateUploadUriParameter).block(); + } + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response generateUploadUriWithResponse( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter, Context context) { + return generateUploadUriWithResponseAsync(resourceGroupName, name, generateUploadUriParameter, context).block(); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importVirtualMachineWithResponseAsync( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (importLabVirtualMachineRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter importLabVirtualMachineRequest is required and cannot be null.")); + } else { + importLabVirtualMachineRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .importVirtualMachine( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + importLabVirtualMachineRequest, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> importVirtualMachineWithResponseAsync( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (importLabVirtualMachineRequest == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter importLabVirtualMachineRequest is required and cannot be null.")); + } else { + importLabVirtualMachineRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .importVirtualMachine( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + importLabVirtualMachineRequest, + accept, + context); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginImportVirtualMachineAsync( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) { + Mono>> mono = + importVirtualMachineWithResponseAsync(resourceGroupName, name, importLabVirtualMachineRequest); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginImportVirtualMachineAsync( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + importVirtualMachineWithResponseAsync(resourceGroupName, name, importLabVirtualMachineRequest, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginImportVirtualMachine( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) { + return beginImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest).getSyncPoller(); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginImportVirtualMachine( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context) { + return beginImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest, context) + .getSyncPoller(); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importVirtualMachineAsync( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) { + return beginImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono importVirtualMachineAsync( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context) { + return beginImportVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void importVirtualMachine( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) { + importVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest).block(); + } + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void importVirtualMachine( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context) { + importVirtualMachineAsync(resourceGroupName, name, importLabVirtualMachineRequest, context).block(); + } + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVhdsSinglePageAsync(String resourceGroupName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listVhds( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVhdsSinglePageAsync( + String resourceGroupName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listVhds( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listVhdsAsync(String resourceGroupName, String name) { + return new PagedFlux<>( + () -> listVhdsSinglePageAsync(resourceGroupName, name), nextLink -> listVhdsNextSinglePageAsync(nextLink)); + } + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listVhdsAsync(String resourceGroupName, String name, Context context) { + return new PagedFlux<>( + () -> listVhdsSinglePageAsync(resourceGroupName, name, context), + nextLink -> listVhdsNextSinglePageAsync(nextLink, context)); + } + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVhds(String resourceGroupName, String name) { + return new PagedIterable<>(listVhdsAsync(resourceGroupName, name)); + } + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listVhds(String resourceGroupName, String name, Context context) { + return new PagedIterable<>(listVhdsAsync(resourceGroupName, name, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVhdsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listVhdsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listVhdsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listVhdsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsImpl.java new file mode 100644 index 000000000000..4ab00b44e03b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/LabsImpl.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.LabsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.GenerateUploadUriResponseInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVhdInner; +import com.azure.resourcemanager.devtestlabs.models.ExportResourceUsageParameters; +import com.azure.resourcemanager.devtestlabs.models.GenerateUploadUriParameter; +import com.azure.resourcemanager.devtestlabs.models.GenerateUploadUriResponse; +import com.azure.resourcemanager.devtestlabs.models.ImportLabVirtualMachineRequest; +import com.azure.resourcemanager.devtestlabs.models.Lab; +import com.azure.resourcemanager.devtestlabs.models.LabVhd; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineCreationParameter; +import com.azure.resourcemanager.devtestlabs.models.Labs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LabsImpl implements Labs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabsImpl.class); + + private final LabsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public LabsImpl(LabsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new LabImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, String filter, Integer top, String orderby, Context context) { + PagedIterable inner = this.serviceClient().list(expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new LabImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new LabImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new LabImpl(inner1, this.manager())); + } + + public Lab getByResourceGroup(String resourceGroupName, String name) { + LabInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, name); + if (inner != null) { + return new LabImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LabImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String name) { + this.serviceClient().delete(resourceGroupName, name); + } + + public void delete(String resourceGroupName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, name, context); + } + + public void claimAnyVm(String resourceGroupName, String name) { + this.serviceClient().claimAnyVm(resourceGroupName, name); + } + + public void claimAnyVm(String resourceGroupName, String name, Context context) { + this.serviceClient().claimAnyVm(resourceGroupName, name, context); + } + + public void createEnvironment( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + this.serviceClient().createEnvironment(resourceGroupName, name, labVirtualMachineCreationParameter); + } + + public void createEnvironment( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context) { + this.serviceClient().createEnvironment(resourceGroupName, name, labVirtualMachineCreationParameter, context); + } + + public void exportResourceUsage( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + this.serviceClient().exportResourceUsage(resourceGroupName, name, exportResourceUsageParameters); + } + + public void exportResourceUsage( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context) { + this.serviceClient().exportResourceUsage(resourceGroupName, name, exportResourceUsageParameters, context); + } + + public GenerateUploadUriResponse generateUploadUri( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter) { + GenerateUploadUriResponseInner inner = + this.serviceClient().generateUploadUri(resourceGroupName, name, generateUploadUriParameter); + if (inner != null) { + return new GenerateUploadUriResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response generateUploadUriWithResponse( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter, Context context) { + Response inner = + this + .serviceClient() + .generateUploadUriWithResponse(resourceGroupName, name, generateUploadUriParameter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new GenerateUploadUriResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void importVirtualMachine( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest) { + this.serviceClient().importVirtualMachine(resourceGroupName, name, importLabVirtualMachineRequest); + } + + public void importVirtualMachine( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context) { + this.serviceClient().importVirtualMachine(resourceGroupName, name, importLabVirtualMachineRequest, context); + } + + public PagedIterable listVhds(String resourceGroupName, String name) { + PagedIterable inner = this.serviceClient().listVhds(resourceGroupName, name); + return Utils.mapPage(inner, inner1 -> new LabVhdImpl(inner1, this.manager())); + } + + public PagedIterable listVhds(String resourceGroupName, String name, Context context) { + PagedIterable inner = this.serviceClient().listVhds(resourceGroupName, name, context); + return Utils.mapPage(inner, inner1 -> new LabVhdImpl(inner1, this.manager())); + } + + public Lab getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "labs"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String localExpand = null; + return this.getByResourceGroupWithResponse(resourceGroupName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "labs"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "labs"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + this.delete(resourceGroupName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "labs"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + this.delete(resourceGroupName, name, context); + } + + private LabsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public LabImpl define(String name) { + return new LabImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelImpl.java new file mode 100644 index 000000000000..b6d0a0dd4cd3 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelImpl.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.NotificationChannelInner; +import com.azure.resourcemanager.devtestlabs.models.Event; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannel; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannelFragment; +import com.azure.resourcemanager.devtestlabs.models.NotifyParameters; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class NotificationChannelImpl + implements NotificationChannel, NotificationChannel.Definition, NotificationChannel.Update { + private NotificationChannelInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String webhookUrl() { + return this.innerModel().webhookUrl(); + } + + public String emailRecipient() { + return this.innerModel().emailRecipient(); + } + + public String notificationLocale() { + return this.innerModel().notificationLocale(); + } + + public String description() { + return this.innerModel().description(); + } + + public List events() { + List inner = this.innerModel().events(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public NotificationChannelInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + private NotificationChannelFragment updateNotificationChannel; + + public NotificationChannelImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public NotificationChannel create() { + this.innerObject = + serviceManager + .serviceClient() + .getNotificationChannels() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public NotificationChannel create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotificationChannels() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), context) + .getValue(); + return this; + } + + NotificationChannelImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new NotificationChannelInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public NotificationChannelImpl update() { + this.updateNotificationChannel = new NotificationChannelFragment(); + return this; + } + + public NotificationChannel apply() { + this.innerObject = + serviceManager + .serviceClient() + .getNotificationChannels() + .updateWithResponse(resourceGroupName, labName, name, updateNotificationChannel, Context.NONE) + .getValue(); + return this; + } + + public NotificationChannel apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getNotificationChannels() + .updateWithResponse(resourceGroupName, labName, name, updateNotificationChannel, context) + .getValue(); + return this; + } + + NotificationChannelImpl( + NotificationChannelInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "notificationchannels"); + } + + public NotificationChannel refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getNotificationChannels() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public NotificationChannel refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getNotificationChannels() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public void notify(NotifyParameters notifyParameters) { + serviceManager.notificationChannels().notify(resourceGroupName, labName, name, notifyParameters); + } + + public Response notifyWithResponse(NotifyParameters notifyParameters, Context context) { + return serviceManager + .notificationChannels() + .notifyWithResponse(resourceGroupName, labName, name, notifyParameters, context); + } + + public NotificationChannelImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NotificationChannelImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NotificationChannelImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateNotificationChannel.withTags(tags); + return this; + } + } + + public NotificationChannelImpl withWebhookUrl(String webhookUrl) { + this.innerModel().withWebhookUrl(webhookUrl); + return this; + } + + public NotificationChannelImpl withEmailRecipient(String emailRecipient) { + this.innerModel().withEmailRecipient(emailRecipient); + return this; + } + + public NotificationChannelImpl withNotificationLocale(String notificationLocale) { + this.innerModel().withNotificationLocale(notificationLocale); + return this; + } + + public NotificationChannelImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public NotificationChannelImpl withEvents(List events) { + this.innerModel().withEvents(events); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsClientImpl.java new file mode 100644 index 000000000000..de9590b2a7c4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsClientImpl.java @@ -0,0 +1,1408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.NotificationChannelsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.NotificationChannelInner; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannelFragment; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannelList; +import com.azure.resourcemanager.devtestlabs.models.NotifyParameters; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in NotificationChannelsClient. */ +public final class NotificationChannelsClientImpl implements NotificationChannelsClient { + private final ClientLogger logger = new ClientLogger(NotificationChannelsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final NotificationChannelsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of NotificationChannelsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NotificationChannelsClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy + .create(NotificationChannelsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientNotificationChannels to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientNot") + private interface NotificationChannelsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/notificationchannels") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/notificationchannels/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/notificationchannels/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NotificationChannelInner notificationChannel, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/notificationchannels/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/notificationchannels/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NotificationChannelFragment notificationChannel, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/notificationchannels/{name}/notify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> notify( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NotifyParameters notifyParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotificationChannelInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (notificationChannel == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationChannel is required and cannot be null.")); + } else { + notificationChannel.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + notificationChannel, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String name, + NotificationChannelInner notificationChannel, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (notificationChannel == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationChannel is required and cannot be null.")); + } else { + notificationChannel.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + notificationChannel, + accept, + context); + } + + /** + * Create or replace an existing notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, notificationChannel) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotificationChannelInner createOrUpdate( + String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel) { + return createOrUpdateAsync(resourceGroupName, labName, name, notificationChannel).block(); + } + + /** + * Create or replace an existing notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String name, + NotificationChannelInner notificationChannel, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, notificationChannel, context).block(); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, name).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of notification channels. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (notificationChannel == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationChannel is required and cannot be null.")); + } else { + notificationChannel.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + notificationChannel, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of notification channels. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String name, + NotificationChannelFragment notificationChannel, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (notificationChannel == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationChannel is required and cannot be null.")); + } else { + notificationChannel.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + notificationChannel, + accept, + context); + } + + /** + * Allows modifying tags of notification channels. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel) { + return updateWithResponseAsync(resourceGroupName, labName, name, notificationChannel) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of notification channels. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NotificationChannelInner update( + String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel) { + return updateAsync(resourceGroupName, labName, name, notificationChannel).block(); + } + + /** + * Allows modifying tags of notification channels. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notificationChannel A notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a notification. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String name, + NotificationChannelFragment notificationChannel, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, notificationChannel, context).block(); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> notifyWithResponseAsync( + String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (notifyParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter notifyParameters is required and cannot be null.")); + } else { + notifyParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .notify( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + notifyParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> notifyWithResponseAsync( + String resourceGroupName, String labName, String name, NotifyParameters notifyParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (notifyParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter notifyParameters is required and cannot be null.")); + } else { + notifyParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .notify( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + notifyParameters, + accept, + context); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono notifyAsync( + String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + return notifyWithResponseAsync(resourceGroupName, labName, name, notifyParameters) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void notify(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + notifyAsync(resourceGroupName, labName, name, notifyParameters).block(); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response notifyWithResponse( + String resourceGroupName, String labName, String name, NotifyParameters notifyParameters, Context context) { + return notifyWithResponseAsync(resourceGroupName, labName, name, notifyParameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsImpl.java new file mode 100644 index 000000000000..a9bd1f8dc8e7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/NotificationChannelsImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.NotificationChannelsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.NotificationChannelInner; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannel; +import com.azure.resourcemanager.devtestlabs.models.NotificationChannels; +import com.azure.resourcemanager.devtestlabs.models.NotifyParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class NotificationChannelsImpl implements NotificationChannels { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotificationChannelsImpl.class); + + private final NotificationChannelsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public NotificationChannelsImpl( + NotificationChannelsClient innerClient, + com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new NotificationChannelImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new NotificationChannelImpl(inner1, this.manager())); + } + + public NotificationChannel get(String resourceGroupName, String labName, String name) { + NotificationChannelInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new NotificationChannelImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NotificationChannelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, name, context); + } + + public void notify(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + this.serviceClient().notify(resourceGroupName, labName, name, notifyParameters); + } + + public Response notifyWithResponse( + String resourceGroupName, String labName, String name, NotifyParameters notifyParameters, Context context) { + return this.serviceClient().notifyWithResponse(resourceGroupName, labName, name, notifyParameters, context); + } + + public NotificationChannel getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "notificationchannels"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notificationchannels'.", + id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "notificationchannels"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notificationchannels'.", + id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "notificationchannels"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notificationchannels'.", + id))); + } + this.deleteWithResponse(resourceGroupName, labName, name, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "notificationchannels"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'notificationchannels'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, labName, name, context); + } + + private NotificationChannelsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public NotificationChannelImpl define(String name) { + return new NotificationChannelImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationMetadataImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationMetadataImpl.java new file mode 100644 index 000000000000..949877577b20 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationMetadataImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner; +import com.azure.resourcemanager.devtestlabs.models.OperationMetadata; +import com.azure.resourcemanager.devtestlabs.models.OperationMetadataDisplay; + +public final class OperationMetadataImpl implements OperationMetadata { + private OperationMetadataInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + OperationMetadataImpl( + OperationMetadataInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationMetadataDisplay display() { + return this.innerModel().display(); + } + + public OperationMetadataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationResultImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationResultImpl.java new file mode 100644 index 000000000000..221adb955a34 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationResultImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationResultInner; +import com.azure.resourcemanager.devtestlabs.models.HttpStatusCode; +import com.azure.resourcemanager.devtestlabs.models.OperationError; +import com.azure.resourcemanager.devtestlabs.models.OperationResult; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + OperationResultImpl( + OperationResultInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String status() { + return this.innerModel().status(); + } + + public HttpStatusCode statusCode() { + return this.innerModel().statusCode(); + } + + public OperationError error() { + return this.innerModel().error(); + } + + public OperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..762155f71bb1 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsClientImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.OperationsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientOpe") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + locationName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + locationName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String name) { + return getWithResponseAsync(locationName, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationResultInner get(String locationName, String name) { + return getAsync(locationName, name).block(); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String locationName, String name, Context context) { + return getWithResponseAsync(locationName, name, context).block(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsImpl.java new file mode 100644 index 000000000000..6722c758515f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/OperationsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.OperationsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationResultInner; +import com.azure.resourcemanager.devtestlabs.models.OperationResult; +import com.azure.resourcemanager.devtestlabs.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationResult get(String locationName, String name) { + OperationResultInner inner = this.serviceClient().get(locationName, name); + if (inner != null) { + return new OperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String locationName, String name, Context context) { + Response inner = this.serviceClient().getWithResponse(locationName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesClientImpl.java new file mode 100644 index 000000000000..cb3b22b0407d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesClientImpl.java @@ -0,0 +1,1306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.PoliciesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.PolicyInner; +import com.azure.resourcemanager.devtestlabs.models.PolicyFragment; +import com.azure.resourcemanager.devtestlabs.models.PolicyList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PoliciesClient. */ +public final class PoliciesClientImpl implements PoliciesClient { + private final ClientLogger logger = new ClientLogger(PoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PoliciesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of PoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PoliciesClientImpl(DevTestLabsClientImpl client) { + this.service = RestProxy.create(PoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientPolicies to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientPol") + private interface PoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/policysets/{policySetName}/policies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("policySetName") String policySetName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/policysets/{policySetName}/policies/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("policySetName") String policySetName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/policysets/{policySetName}/policies/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("policySetName") String policySetName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PolicyInner policy, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/policysets/{policySetName}/policies/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("policySetName") String policySetName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/policysets/{policySetName}/policies/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("policySetName") String policySetName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PolicyFragment policy, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String policySetName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String policySetName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby)); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby, context)); + } + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String policySetName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String policySetName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String policySetName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, policySetName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String policySetName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, policySetName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PolicyInner get(String resourceGroupName, String labName, String policySetName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, policySetName, name, expand).block(); + } + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String policySetName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, policySetName, name, expand, context).block(); + } + + /** + * Create or replace an existing policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (policy == null) { + return Mono.error(new IllegalArgumentException("Parameter policy is required and cannot be null.")); + } else { + policy.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + this.client.getApiVersion(), + policy, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String policySetName, + String name, + PolicyInner policy, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (policy == null) { + return Mono.error(new IllegalArgumentException("Parameter policy is required and cannot be null.")); + } else { + policy.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + this.client.getApiVersion(), + policy, + accept, + context); + } + + /** + * Create or replace an existing policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, policySetName, name, policy) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PolicyInner createOrUpdate( + String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return createOrUpdateAsync(resourceGroupName, labName, policySetName, name, policy).block(); + } + + /** + * Create or replace an existing policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String policySetName, + String name, + PolicyInner policy, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, policySetName, name, policy, context) + .block(); + } + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String policySetName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String policySetName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String policySetName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, policySetName, name) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String policySetName, String name) { + deleteAsync(resourceGroupName, labName, policySetName, name).block(); + } + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String labName, String policySetName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, policySetName, name, context).block(); + } + + /** + * Allows modifying tags of policies. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String policySetName, String name, PolicyFragment policy) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (policy == null) { + return Mono.error(new IllegalArgumentException("Parameter policy is required and cannot be null.")); + } else { + policy.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + this.client.getApiVersion(), + policy, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of policies. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String policySetName, + String name, + PolicyFragment policy, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (policySetName == null) { + return Mono.error(new IllegalArgumentException("Parameter policySetName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (policy == null) { + return Mono.error(new IllegalArgumentException("Parameter policy is required and cannot be null.")); + } else { + policy.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + policySetName, + name, + this.client.getApiVersion(), + policy, + accept, + context); + } + + /** + * Allows modifying tags of policies. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String policySetName, String name, PolicyFragment policy) { + return updateWithResponseAsync(resourceGroupName, labName, policySetName, name, policy) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of policies. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PolicyInner update( + String resourceGroupName, String labName, String policySetName, String name, PolicyFragment policy) { + return updateAsync(resourceGroupName, labName, policySetName, name, policy).block(); + } + + /** + * Allows modifying tags of policies. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param policy A Policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String policySetName, + String name, + PolicyFragment policy, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, policySetName, name, policy, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesImpl.java new file mode 100644 index 000000000000..d0c7d95fa529 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PoliciesImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.PoliciesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.PolicyInner; +import com.azure.resourcemanager.devtestlabs.models.Policies; +import com.azure.resourcemanager.devtestlabs.models.Policy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PoliciesImpl implements Policies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoliciesImpl.class); + + private final PoliciesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public PoliciesImpl( + PoliciesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String policySetName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName, policySetName); + return Utils.mapPage(inner, inner1 -> new PolicyImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, policySetName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new PolicyImpl(inner1, this.manager())); + } + + public Policy get(String resourceGroupName, String labName, String policySetName, String name) { + PolicyInner inner = this.serviceClient().get(resourceGroupName, labName, policySetName, name); + if (inner != null) { + return new PolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String policySetName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, policySetName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String policySetName, String name) { + this.serviceClient().delete(resourceGroupName, labName, policySetName, name); + } + + public Response deleteWithResponse( + String resourceGroupName, String labName, String policySetName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, policySetName, name, context); + } + + public Policy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String policySetName = Utils.getValueFromIdByName(id, "policysets"); + if (policySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policysets'.", id))); + } + String name = Utils.getValueFromIdByName(id, "policies"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policies'.", id))); + } + String localExpand = null; + return this + .getWithResponse(resourceGroupName, labName, policySetName, name, localExpand, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String policySetName = Utils.getValueFromIdByName(id, "policysets"); + if (policySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policysets'.", id))); + } + String name = Utils.getValueFromIdByName(id, "policies"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policies'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, policySetName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String policySetName = Utils.getValueFromIdByName(id, "policysets"); + if (policySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policysets'.", id))); + } + String name = Utils.getValueFromIdByName(id, "policies"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policies'.", id))); + } + this.deleteWithResponse(resourceGroupName, labName, policySetName, name, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String policySetName = Utils.getValueFromIdByName(id, "policysets"); + if (policySetName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policysets'.", id))); + } + String name = Utils.getValueFromIdByName(id, "policies"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'policies'.", id))); + } + return this.deleteWithResponse(resourceGroupName, labName, policySetName, name, context); + } + + private PoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public PolicyImpl define(String name) { + return new PolicyImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicyImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicyImpl.java new file mode 100644 index 000000000000..7712d7c5a2fa --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicyImpl.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.PolicyInner; +import com.azure.resourcemanager.devtestlabs.models.Policy; +import com.azure.resourcemanager.devtestlabs.models.PolicyEvaluatorType; +import com.azure.resourcemanager.devtestlabs.models.PolicyFactName; +import com.azure.resourcemanager.devtestlabs.models.PolicyFragment; +import com.azure.resourcemanager.devtestlabs.models.PolicyStatus; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class PolicyImpl implements Policy, Policy.Definition, Policy.Update { + private PolicyInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public PolicyStatus status() { + return this.innerModel().status(); + } + + public PolicyFactName factName() { + return this.innerModel().factName(); + } + + public String factData() { + return this.innerModel().factData(); + } + + public String threshold() { + return this.innerModel().threshold(); + } + + public PolicyEvaluatorType evaluatorType() { + return this.innerModel().evaluatorType(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public PolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String policySetName; + + private String name; + + private PolicyFragment updatePolicy; + + public PolicyImpl withExistingPolicyset(String resourceGroupName, String labName, String policySetName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.policySetName = policySetName; + return this; + } + + public Policy create() { + this.innerObject = + serviceManager + .serviceClient() + .getPolicies() + .createOrUpdateWithResponse( + resourceGroupName, labName, policySetName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Policy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPolicies() + .createOrUpdateWithResponse(resourceGroupName, labName, policySetName, name, this.innerModel(), context) + .getValue(); + return this; + } + + PolicyImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new PolicyInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public PolicyImpl update() { + this.updatePolicy = new PolicyFragment(); + return this; + } + + public Policy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPolicies() + .updateWithResponse(resourceGroupName, labName, policySetName, name, updatePolicy, Context.NONE) + .getValue(); + return this; + } + + public Policy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPolicies() + .updateWithResponse(resourceGroupName, labName, policySetName, name, updatePolicy, context) + .getValue(); + return this; + } + + PolicyImpl(PolicyInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.policySetName = Utils.getValueFromIdByName(innerObject.id(), "policysets"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "policies"); + } + + public Policy refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getPolicies() + .getWithResponse(resourceGroupName, labName, policySetName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Policy refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getPolicies() + .getWithResponse(resourceGroupName, labName, policySetName, name, localExpand, context) + .getValue(); + return this; + } + + public PolicyImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PolicyImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PolicyImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updatePolicy.withTags(tags); + return this; + } + } + + public PolicyImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public PolicyImpl withStatus(PolicyStatus status) { + this.innerModel().withStatus(status); + return this; + } + + public PolicyImpl withFactName(PolicyFactName factName) { + this.innerModel().withFactName(factName); + return this; + } + + public PolicyImpl withFactData(String factData) { + this.innerModel().withFactData(factData); + return this; + } + + public PolicyImpl withThreshold(String threshold) { + this.innerModel().withThreshold(threshold); + return this; + } + + public PolicyImpl withEvaluatorType(PolicyEvaluatorType evaluatorType) { + this.innerModel().withEvaluatorType(evaluatorType); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsClientImpl.java new file mode 100644 index 000000000000..8b0af7c1f68a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.PolicySetsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.EvaluatePoliciesResponseInner; +import com.azure.resourcemanager.devtestlabs.models.EvaluatePoliciesRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PolicySetsClient. */ +public final class PolicySetsClientImpl implements PolicySetsClient { + private final ClientLogger logger = new ClientLogger(PolicySetsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PolicySetsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of PolicySetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PolicySetsClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(PolicySetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientPolicySets to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientPol") + private interface PolicySetsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/policysets/{name}/evaluatePolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> evaluatePolicies( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EvaluatePoliciesRequest evaluatePoliciesRequest, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> evaluatePoliciesWithResponseAsync( + String resourceGroupName, String labName, String name, EvaluatePoliciesRequest evaluatePoliciesRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (evaluatePoliciesRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter evaluatePoliciesRequest is required and cannot be null.")); + } else { + evaluatePoliciesRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .evaluatePolicies( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + evaluatePoliciesRequest, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> evaluatePoliciesWithResponseAsync( + String resourceGroupName, + String labName, + String name, + EvaluatePoliciesRequest evaluatePoliciesRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (evaluatePoliciesRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter evaluatePoliciesRequest is required and cannot be null.")); + } else { + evaluatePoliciesRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .evaluatePolicies( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + evaluatePoliciesRequest, + accept, + context); + } + + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono evaluatePoliciesAsync( + String resourceGroupName, String labName, String name, EvaluatePoliciesRequest evaluatePoliciesRequest) { + return evaluatePoliciesWithResponseAsync(resourceGroupName, labName, name, evaluatePoliciesRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EvaluatePoliciesResponseInner evaluatePolicies( + String resourceGroupName, String labName, String name, EvaluatePoliciesRequest evaluatePoliciesRequest) { + return evaluatePoliciesAsync(resourceGroupName, labName, name, evaluatePoliciesRequest).block(); + } + + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response evaluatePoliciesWithResponse( + String resourceGroupName, + String labName, + String name, + EvaluatePoliciesRequest evaluatePoliciesRequest, + Context context) { + return evaluatePoliciesWithResponseAsync(resourceGroupName, labName, name, evaluatePoliciesRequest, context) + .block(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsImpl.java new file mode 100644 index 000000000000..79fe57a17cee --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/PolicySetsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.PolicySetsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.EvaluatePoliciesResponseInner; +import com.azure.resourcemanager.devtestlabs.models.EvaluatePoliciesRequest; +import com.azure.resourcemanager.devtestlabs.models.EvaluatePoliciesResponse; +import com.azure.resourcemanager.devtestlabs.models.PolicySets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PolicySetsImpl implements PolicySets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicySetsImpl.class); + + private final PolicySetsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public PolicySetsImpl( + PolicySetsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public EvaluatePoliciesResponse evaluatePolicies( + String resourceGroupName, String labName, String name, EvaluatePoliciesRequest evaluatePoliciesRequest) { + EvaluatePoliciesResponseInner inner = + this.serviceClient().evaluatePolicies(resourceGroupName, labName, name, evaluatePoliciesRequest); + if (inner != null) { + return new EvaluatePoliciesResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response evaluatePoliciesWithResponse( + String resourceGroupName, + String labName, + String name, + EvaluatePoliciesRequest evaluatePoliciesRequest, + Context context) { + Response inner = + this + .serviceClient() + .evaluatePoliciesWithResponse(resourceGroupName, labName, name, evaluatePoliciesRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EvaluatePoliciesResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PolicySetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsClientImpl.java new file mode 100644 index 000000000000..a79f957bdb3f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ProviderOperationsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner; +import com.azure.resourcemanager.devtestlabs.models.ProviderOperationResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ProviderOperationsClient. */ +public final class ProviderOperationsClientImpl implements ProviderOperationsClient { + private final ClientLogger logger = new ClientLogger(ProviderOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ProviderOperationsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of ProviderOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProviderOperationsClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(ProviderOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientProviderOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientPro") + private interface ProviderOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DevTestLab/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Result of the request to list REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Result of the request to list REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Result of the request to list REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Result of the request to list REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Result of the request to list REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Result of the request to list REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsImpl.java new file mode 100644 index 000000000000..12d7cc5ae857 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ProviderOperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ProviderOperationsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner; +import com.azure.resourcemanager.devtestlabs.models.OperationMetadata; +import com.azure.resourcemanager.devtestlabs.models.ProviderOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ProviderOperationsImpl implements ProviderOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderOperationsImpl.class); + + private final ProviderOperationsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public ProviderOperationsImpl( + ProviderOperationsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationMetadataImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationMetadataImpl(inner1, this.manager())); + } + + private ProviderOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/RdpConnectionImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/RdpConnectionImpl.java new file mode 100644 index 000000000000..eee8fc27f0e4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/RdpConnectionImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.resourcemanager.devtestlabs.fluent.models.RdpConnectionInner; +import com.azure.resourcemanager.devtestlabs.models.RdpConnection; + +public final class RdpConnectionImpl implements RdpConnection { + private RdpConnectionInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + RdpConnectionImpl( + RdpConnectionInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String contents() { + return this.innerModel().contents(); + } + + public RdpConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ScheduleImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ScheduleImpl.java new file mode 100644 index 000000000000..4cabe5c6c429 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ScheduleImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.DayDetails; +import com.azure.resourcemanager.devtestlabs.models.EnableStatus; +import com.azure.resourcemanager.devtestlabs.models.HourDetails; +import com.azure.resourcemanager.devtestlabs.models.NotificationSettings; +import com.azure.resourcemanager.devtestlabs.models.RetargetScheduleProperties; +import com.azure.resourcemanager.devtestlabs.models.Schedule; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.WeekDetails; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class ScheduleImpl implements Schedule, Schedule.Definition, Schedule.Update { + private ScheduleInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public EnableStatus status() { + return this.innerModel().status(); + } + + public String taskType() { + return this.innerModel().taskType(); + } + + public WeekDetails weeklyRecurrence() { + return this.innerModel().weeklyRecurrence(); + } + + public DayDetails dailyRecurrence() { + return this.innerModel().dailyRecurrence(); + } + + public HourDetails hourlyRecurrence() { + return this.innerModel().hourlyRecurrence(); + } + + public String timeZoneId() { + return this.innerModel().timeZoneId(); + } + + public NotificationSettings notificationSettings() { + return this.innerModel().notificationSettings(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ScheduleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String name; + + private ScheduleFragment updateSchedule; + + public ScheduleImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Schedule create() { + this.innerObject = + serviceManager + .serviceClient() + .getGlobalSchedules() + .createOrUpdateWithResponse(resourceGroupName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Schedule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGlobalSchedules() + .createOrUpdateWithResponse(resourceGroupName, name, this.innerModel(), context) + .getValue(); + return this; + } + + ScheduleImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new ScheduleInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public ScheduleImpl update() { + this.updateSchedule = new ScheduleFragment(); + return this; + } + + public Schedule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getGlobalSchedules() + .updateWithResponse(resourceGroupName, name, updateSchedule, Context.NONE) + .getValue(); + return this; + } + + public Schedule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getGlobalSchedules() + .updateWithResponse(resourceGroupName, name, updateSchedule, context) + .getValue(); + return this; + } + + ScheduleImpl(ScheduleInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "schedules"); + } + + public Schedule refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getGlobalSchedules() + .getByResourceGroupWithResponse(resourceGroupName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Schedule refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getGlobalSchedules() + .getByResourceGroupWithResponse(resourceGroupName, name, localExpand, context) + .getValue(); + return this; + } + + public void execute() { + serviceManager.globalSchedules().execute(resourceGroupName, name); + } + + public void execute(Context context) { + serviceManager.globalSchedules().execute(resourceGroupName, name, context); + } + + public void retarget(RetargetScheduleProperties retargetScheduleProperties) { + serviceManager.globalSchedules().retarget(resourceGroupName, name, retargetScheduleProperties); + } + + public void retarget(RetargetScheduleProperties retargetScheduleProperties, Context context) { + serviceManager.globalSchedules().retarget(resourceGroupName, name, retargetScheduleProperties, context); + } + + public ScheduleImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ScheduleImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ScheduleImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSchedule.withTags(tags); + return this; + } + } + + public ScheduleImpl withStatus(EnableStatus status) { + this.innerModel().withStatus(status); + return this; + } + + public ScheduleImpl withTaskType(String taskType) { + this.innerModel().withTaskType(taskType); + return this; + } + + public ScheduleImpl withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.innerModel().withWeeklyRecurrence(weeklyRecurrence); + return this; + } + + public ScheduleImpl withDailyRecurrence(DayDetails dailyRecurrence) { + this.innerModel().withDailyRecurrence(dailyRecurrence); + return this; + } + + public ScheduleImpl withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.innerModel().withHourlyRecurrence(hourlyRecurrence); + return this; + } + + public ScheduleImpl withTimeZoneId(String timeZoneId) { + this.innerModel().withTimeZoneId(timeZoneId); + return this; + } + + public ScheduleImpl withNotificationSettings(NotificationSettings notificationSettings) { + this.innerModel().withNotificationSettings(notificationSettings); + return this; + } + + public ScheduleImpl withTargetResourceId(String targetResourceId) { + this.innerModel().withTargetResourceId(targetResourceId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesClientImpl.java new file mode 100644 index 000000000000..ce164705346b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesClientImpl.java @@ -0,0 +1,1752 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.SchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.ScheduleList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SchedulesClient. */ +public final class SchedulesClientImpl implements SchedulesClient { + private final ClientLogger logger = new ClientLogger(SchedulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SchedulesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of SchedulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SchedulesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(SchedulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientSchedules to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientSch") + private interface SchedulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/schedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/schedules/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleInner schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/schedules/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleFragment schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/schedules/{name}/execute") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/schedules/{name}/listApplicable") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listApplicable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listApplicableNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, ScheduleInner schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, ScheduleInner schedule, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner createOrUpdate(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return createOrUpdateAsync(resourceGroupName, labName, name, schedule).block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ScheduleInner schedule, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, schedule, context).block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, name).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, ScheduleFragment schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, ScheduleFragment schedule, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String name, ScheduleFragment schedule) { + return updateWithResponseAsync(resourceGroupName, labName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner update(String resourceGroupName, String labName, String name, ScheduleFragment schedule) { + return updateAsync(resourceGroupName, labName, name, schedule).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String labName, String name, ScheduleFragment schedule, Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, schedule, context).block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, String labName, String name) { + Mono>> mono = executeWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = executeWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute(String resourceGroupName, String labName, String name) { + return beginExecuteAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String name, Context context) { + return beginExecuteAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String resourceGroupName, String labName, String name) { + return beginExecuteAsync(resourceGroupName, labName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String resourceGroupName, String labName, String name, Context context) { + return beginExecuteAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute(String resourceGroupName, String labName, String name) { + executeAsync(resourceGroupName, labName, name).block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute(String resourceGroupName, String labName, String name, Context context) { + executeAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableSinglePageAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listApplicable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableSinglePageAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listApplicable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listApplicableAsync(String resourceGroupName, String labName, String name) { + return new PagedFlux<>( + () -> listApplicableSinglePageAsync(resourceGroupName, labName, name), + nextLink -> listApplicableNextSinglePageAsync(nextLink)); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listApplicableAsync( + String resourceGroupName, String labName, String name, Context context) { + return new PagedFlux<>( + () -> listApplicableSinglePageAsync(resourceGroupName, labName, name, context), + nextLink -> listApplicableNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listApplicable(String resourceGroupName, String labName, String name) { + return new PagedIterable<>(listApplicableAsync(resourceGroupName, labName, name)); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listApplicable( + String resourceGroupName, String labName, String name, Context context) { + return new PagedIterable<>(listApplicableAsync(resourceGroupName, labName, name, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listApplicableNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listApplicableNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesImpl.java new file mode 100644 index 000000000000..b25644ac0d5f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SchedulesImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.SchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.Schedule; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.Schedules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SchedulesImpl implements Schedules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SchedulesImpl.class); + + private final SchedulesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public SchedulesImpl( + SchedulesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public Schedule get(String resourceGroupName, String labName, String name) { + ScheduleInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Schedule createOrUpdate(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + ScheduleInner inner = this.serviceClient().createOrUpdate(resourceGroupName, labName, name, schedule); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ScheduleInner schedule, Context context) { + Response inner = + this.serviceClient().createOrUpdateWithResponse(resourceGroupName, labName, name, schedule, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, name, context); + } + + public Schedule update(String resourceGroupName, String labName, String name, ScheduleFragment schedule) { + ScheduleInner inner = this.serviceClient().update(resourceGroupName, labName, name, schedule); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, String labName, String name, ScheduleFragment schedule, Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, labName, name, schedule, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void execute(String resourceGroupName, String labName, String name) { + this.serviceClient().execute(resourceGroupName, labName, name); + } + + public void execute(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().execute(resourceGroupName, labName, name, context); + } + + public PagedIterable listApplicable(String resourceGroupName, String labName, String name) { + PagedIterable inner = this.serviceClient().listApplicable(resourceGroupName, labName, name); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable listApplicable( + String resourceGroupName, String labName, String name, Context context) { + PagedIterable inner = + this.serviceClient().listApplicable(resourceGroupName, labName, name, context); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + private SchedulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretImpl.java new file mode 100644 index 000000000000..7b49d471fda4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.SecretInner; +import com.azure.resourcemanager.devtestlabs.models.Secret; +import com.azure.resourcemanager.devtestlabs.models.SecretFragment; +import java.util.Collections; +import java.util.Map; + +public final class SecretImpl implements Secret, Secret.Definition, Secret.Update { + private SecretInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String value() { + return this.innerModel().value(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public SecretInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String username; + + private String name; + + private SecretFragment updateSecret; + + public SecretImpl withExistingUser(String resourceGroupName, String labName, String username) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.username = username; + return this; + } + + public Secret create() { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), Context.NONE); + return this; + } + + public Secret create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), context); + return this; + } + + SecretImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new SecretInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public SecretImpl update() { + this.updateSecret = new SecretFragment(); + return this; + } + + public Secret apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .updateWithResponse(resourceGroupName, labName, username, name, updateSecret, Context.NONE) + .getValue(); + return this; + } + + public Secret apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .updateWithResponse(resourceGroupName, labName, username, name, updateSecret, context) + .getValue(); + return this; + } + + SecretImpl(SecretInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.username = Utils.getValueFromIdByName(innerObject.id(), "users"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "secrets"); + } + + public Secret refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public Secret refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getSecrets() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, context) + .getValue(); + return this; + } + + public SecretImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SecretImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SecretImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateSecret.withTags(tags); + return this; + } + } + + public SecretImpl withValue(String value) { + this.innerModel().withValue(value); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsClientImpl.java new file mode 100644 index 000000000000..4f4587d46ecd --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsClientImpl.java @@ -0,0 +1,1405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.SecretsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.SecretInner; +import com.azure.resourcemanager.devtestlabs.models.SecretFragment; +import com.azure.resourcemanager.devtestlabs.models.SecretList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SecretsClient. */ +public final class SecretsClientImpl implements SecretsClient { + private final ClientLogger logger = new ClientLogger(SecretsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SecretsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of SecretsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecretsClientImpl(DevTestLabsClientImpl client) { + this.service = RestProxy.create(SecretsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientSecrets to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientSec") + private interface SecretsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/secrets") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/secrets/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/secrets/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SecretInner secret, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/secrets/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/secrets/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SecretFragment secret, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, username, expand, filter, top, orderby)); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context)); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretInner get(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, username, name, expand).block(); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand, context).block(); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, SecretInner secret) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (secret == null) { + return Mono.error(new IllegalArgumentException("Parameter secret is required and cannot be null.")); + } else { + secret.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + secret, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, SecretInner secret, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (secret == null) { + return Mono.error(new IllegalArgumentException("Parameter secret is required and cannot be null.")); + } else { + secret.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + secret, + accept, + context); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SecretInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, SecretInner secret) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, secret); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SecretInner.class, SecretInner.class, Context.NONE); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, SecretInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, SecretInner secret, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, secret, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), SecretInner.class, SecretInner.class, context); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SecretInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, secret).getSyncPoller(); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, SecretInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, secret, context).getSyncPoller(); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, SecretInner secret) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, secret) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, SecretInner secret, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, secret, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, secret).block(); + } + + /** + * Create or replace an existing secret. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, SecretInner secret, Context context) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, secret, context).block(); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String username, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, username, name) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String username, String name) { + deleteAsync(resourceGroupName, labName, username, name).block(); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String labName, String username, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, username, name, context).block(); + } + + /** + * Allows modifying tags of secrets. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, SecretFragment secret) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (secret == null) { + return Mono.error(new IllegalArgumentException("Parameter secret is required and cannot be null.")); + } else { + secret.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + secret, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of secrets. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + SecretFragment secret, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (secret == null) { + return Mono.error(new IllegalArgumentException("Parameter secret is required and cannot be null.")); + } else { + secret.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + secret, + accept, + context); + } + + /** + * Allows modifying tags of secrets. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String username, String name, SecretFragment secret) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, secret) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of secrets. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecretInner update( + String resourceGroupName, String labName, String username, String name, SecretFragment secret) { + return updateAsync(resourceGroupName, labName, username, name, secret).block(); + } + + /** + * Allows modifying tags of secrets. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a secret. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String name, + SecretFragment secret, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, secret, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsImpl.java new file mode 100644 index 000000000000..21f9a5350bc2 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/SecretsImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.SecretsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.SecretInner; +import com.azure.resourcemanager.devtestlabs.models.Secret; +import com.azure.resourcemanager.devtestlabs.models.Secrets; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SecretsImpl implements Secrets { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecretsImpl.class); + + private final SecretsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public SecretsImpl( + SecretsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String username) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName, username); + return Utils.mapPage(inner, inner1 -> new SecretImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, username, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new SecretImpl(inner1, this.manager())); + } + + public Secret get(String resourceGroupName, String labName, String username, String name) { + SecretInner inner = this.serviceClient().get(resourceGroupName, labName, username, name); + if (inner != null) { + return new SecretImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, username, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SecretImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String username, String name) { + this.serviceClient().delete(resourceGroupName, labName, username, name); + } + + public Response deleteWithResponse( + String resourceGroupName, String labName, String username, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, username, name, context); + } + + public Secret getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "secrets"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "secrets"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, username, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "secrets"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + this.deleteWithResponse(resourceGroupName, labName, username, name, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "secrets"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'secrets'.", id))); + } + return this.deleteWithResponse(resourceGroupName, labName, username, name, context); + } + + private SecretsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public SecretImpl define(String name) { + return new SecretImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricImpl.java new file mode 100644 index 000000000000..596e8b5278d6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricImpl.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceFabricInner; +import com.azure.resourcemanager.devtestlabs.models.ApplicableSchedule; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabric; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabricFragment; +import java.util.Collections; +import java.util.Map; + +public final class ServiceFabricImpl implements ServiceFabric, ServiceFabric.Definition, ServiceFabric.Update { + private ServiceFabricInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String externalServiceFabricId() { + return this.innerModel().externalServiceFabricId(); + } + + public String environmentId() { + return this.innerModel().environmentId(); + } + + public ApplicableSchedule applicableSchedule() { + ApplicableScheduleInner inner = this.innerModel().applicableSchedule(); + if (inner != null) { + return new ApplicableScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServiceFabricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String username; + + private String name; + + private ServiceFabricFragment updateServiceFabric; + + public ServiceFabricImpl withExistingUser(String resourceGroupName, String labName, String username) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.username = username; + return this; + } + + public ServiceFabric create() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceFabrics() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), Context.NONE); + return this; + } + + public ServiceFabric create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceFabrics() + .createOrUpdate(resourceGroupName, labName, username, name, this.innerModel(), context); + return this; + } + + ServiceFabricImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new ServiceFabricInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public ServiceFabricImpl update() { + this.updateServiceFabric = new ServiceFabricFragment(); + return this; + } + + public ServiceFabric apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceFabrics() + .updateWithResponse(resourceGroupName, labName, username, name, updateServiceFabric, Context.NONE) + .getValue(); + return this; + } + + public ServiceFabric apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceFabrics() + .updateWithResponse(resourceGroupName, labName, username, name, updateServiceFabric, context) + .getValue(); + return this; + } + + ServiceFabricImpl( + ServiceFabricInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.username = Utils.getValueFromIdByName(innerObject.id(), "users"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "servicefabrics"); + } + + public ServiceFabric refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getServiceFabrics() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public ServiceFabric refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getServiceFabrics() + .getWithResponse(resourceGroupName, labName, username, name, localExpand, context) + .getValue(); + return this; + } + + public ApplicableSchedule listApplicableSchedules() { + return serviceManager.serviceFabrics().listApplicableSchedules(resourceGroupName, labName, username, name); + } + + public Response listApplicableSchedulesWithResponse(Context context) { + return serviceManager + .serviceFabrics() + .listApplicableSchedulesWithResponse(resourceGroupName, labName, username, name, context); + } + + public void start() { + serviceManager.serviceFabrics().start(resourceGroupName, labName, username, name); + } + + public void start(Context context) { + serviceManager.serviceFabrics().start(resourceGroupName, labName, username, name, context); + } + + public void stop() { + serviceManager.serviceFabrics().stop(resourceGroupName, labName, username, name); + } + + public void stop(Context context) { + serviceManager.serviceFabrics().stop(resourceGroupName, labName, username, name, context); + } + + public ServiceFabricImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServiceFabricImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServiceFabricImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateServiceFabric.withTags(tags); + return this; + } + } + + public ServiceFabricImpl withExternalServiceFabricId(String externalServiceFabricId) { + this.innerModel().withExternalServiceFabricId(externalServiceFabricId); + return this; + } + + public ServiceFabricImpl withEnvironmentId(String environmentId) { + this.innerModel().withEnvironmentId(environmentId); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesClientImpl.java new file mode 100644 index 000000000000..46c9bd1ebf0e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesClientImpl.java @@ -0,0 +1,1821 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceFabricSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.ScheduleList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceFabricSchedulesClient. */ +public final class ServiceFabricSchedulesClientImpl implements ServiceFabricSchedulesClient { + private final ClientLogger logger = new ClientLogger(ServiceFabricSchedulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServiceFabricSchedulesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of ServiceFabricSchedulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceFabricSchedulesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy + .create(ServiceFabricSchedulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientServiceFabricSchedules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientSer") + private interface ServiceFabricSchedulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("serviceFabricName") String serviceFabricName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("serviceFabricName") String serviceFabricName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("serviceFabricName") String serviceFabricName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleInner schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("serviceFabricName") String serviceFabricName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("serviceFabricName") String serviceFabricName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleFragment schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{serviceFabricName}/schedules/{name}/execute") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("serviceFabricName") String serviceFabricName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, labName, username, serviceFabricName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String username, String serviceFabricName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, labName, username, serviceFabricName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, labName, username, serviceFabricName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String labName, String username, String serviceFabricName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>( + listAsync(resourceGroupName, labName, username, serviceFabricName, expand, filter, top, orderby)); + } + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, username, serviceFabricName, expand, filter, top, orderby, context)); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + String expand) { + return getWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner get( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, username, serviceFabricName, name, expand).block(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + String expand, + Context context) { + return getWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, expand, context) + .block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner createOrUpdate( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule) { + return createOrUpdateAsync(resourceGroupName, labName, username, serviceFabricName, name, schedule).block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, labName, username, serviceFabricName, name, schedule, context) + .block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + deleteAsync(resourceGroupName, labName, username, serviceFabricName, name).block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, context).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule) { + return updateWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner update( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule) { + return updateAsync(resourceGroupName, labName, username, serviceFabricName, name, schedule).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, schedule, context) + .block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (serviceFabricName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceFabricName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + serviceFabricName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + Mono>> mono = + executeWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + executeWithResponseAsync(resourceGroupName, labName, username, serviceFabricName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + return beginExecuteAsync(resourceGroupName, labName, username, serviceFabricName, name).getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + return beginExecuteAsync(resourceGroupName, labName, username, serviceFabricName, name, context) + .getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + return beginExecuteAsync(resourceGroupName, labName, username, serviceFabricName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + return beginExecuteAsync(resourceGroupName, labName, username, serviceFabricName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + executeAsync(resourceGroupName, labName, username, serviceFabricName, name).block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + executeAsync(resourceGroupName, labName, username, serviceFabricName, name, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesImpl.java new file mode 100644 index 000000000000..4dbc34089f87 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricSchedulesImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceFabricSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.Schedule; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabricSchedules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServiceFabricSchedulesImpl implements ServiceFabricSchedules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceFabricSchedulesImpl.class); + + private final ServiceFabricSchedulesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public ServiceFabricSchedulesImpl( + ServiceFabricSchedulesClient innerClient, + com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, String labName, String username, String serviceFabricName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, username, serviceFabricName); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, labName, username, serviceFabricName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public Schedule get( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + ScheduleInner inner = this.serviceClient().get(resourceGroupName, labName, username, serviceFabricName, name); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + String expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, labName, username, serviceFabricName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Schedule createOrUpdate( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule) { + ScheduleInner inner = + this + .serviceClient() + .createOrUpdate(resourceGroupName, labName, username, serviceFabricName, name, schedule); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, labName, username, serviceFabricName, name, schedule, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + this.serviceClient().delete(resourceGroupName, labName, username, serviceFabricName, name); + } + + public Response deleteWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, labName, username, serviceFabricName, name, context); + } + + public Schedule update( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule) { + ScheduleInner inner = + this.serviceClient().update(resourceGroupName, labName, username, serviceFabricName, name, schedule); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, labName, username, serviceFabricName, name, schedule, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void execute( + String resourceGroupName, String labName, String username, String serviceFabricName, String name) { + this.serviceClient().execute(resourceGroupName, labName, username, serviceFabricName, name); + } + + public void execute( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context) { + this.serviceClient().execute(resourceGroupName, labName, username, serviceFabricName, name, context); + } + + private ServiceFabricSchedulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsClientImpl.java new file mode 100644 index 000000000000..724ab7692298 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsClientImpl.java @@ -0,0 +1,2302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceFabricsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceFabricInner; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabricFragment; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabricList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceFabricsClient. */ +public final class ServiceFabricsClientImpl implements ServiceFabricsClient { + private final ClientLogger logger = new ClientLogger(ServiceFabricsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServiceFabricsService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of ServiceFabricsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceFabricsClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(ServiceFabricsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientServiceFabrics to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientSer") + private interface ServiceFabricsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServiceFabricInner serviceFabric, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServiceFabricFragment serviceFabric, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{name}/listApplicableSchedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listApplicableSchedules( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{name}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{userName}/servicefabrics/{name}/stop") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("userName") String username, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String username) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, username, expand, filter, top, orderby)); + } + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, username, expand, filter, top, orderby, context)); + } + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String username, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, username, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceFabricInner get(String resourceGroupName, String labName, String username, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, username, name, expand).block(); + } + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, username, name, expand, context).block(); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, ServiceFabricInner serviceFabric) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (serviceFabric == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceFabric is required and cannot be null.")); + } else { + serviceFabric.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + serviceFabric, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricInner serviceFabric, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (serviceFabric == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceFabric is required and cannot be null.")); + } else { + serviceFabric.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + serviceFabric, + accept, + context); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServiceFabricInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, ServiceFabricInner serviceFabric) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, serviceFabric); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServiceFabricInner.class, ServiceFabricInner.class, Context.NONE); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServiceFabricInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricInner serviceFabric, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, username, name, serviceFabric, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServiceFabricInner.class, ServiceFabricInner.class, context); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceFabricInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String username, String name, ServiceFabricInner serviceFabric) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, serviceFabric).getSyncPoller(); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceFabricInner> beginCreateOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricInner serviceFabric, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, serviceFabric, context) + .getSyncPoller(); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String username, String name, ServiceFabricInner serviceFabric) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, serviceFabric) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricInner serviceFabric, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, username, name, serviceFabric, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceFabricInner createOrUpdate( + String resourceGroupName, String labName, String username, String name, ServiceFabricInner serviceFabric) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, serviceFabric).block(); + } + + /** + * Create or replace an existing service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceFabricInner createOrUpdate( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricInner serviceFabric, + Context context) { + return createOrUpdateAsync(resourceGroupName, labName, username, name, serviceFabric, context).block(); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String username, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, username, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, labName, username, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name) { + return beginDeleteAsync(resourceGroupName, labName, username, name).getSyncPoller(); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, username, name, context).getSyncPoller(); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String username, String name) { + return beginDeleteAsync(resourceGroupName, labName, username, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, username, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String username, String name) { + deleteAsync(resourceGroupName, labName, username, name).block(); + } + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String username, String name, Context context) { + deleteAsync(resourceGroupName, labName, username, name, context).block(); + } + + /** + * Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String username, String name, ServiceFabricFragment serviceFabric) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (serviceFabric == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceFabric is required and cannot be null.")); + } else { + serviceFabric.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + serviceFabric, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricFragment serviceFabric, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (serviceFabric == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceFabric is required and cannot be null.")); + } else { + serviceFabric.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + serviceFabric, + accept, + context); + } + + /** + * Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String username, String name, ServiceFabricFragment serviceFabric) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, serviceFabric) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceFabricInner update( + String resourceGroupName, String labName, String username, String name, ServiceFabricFragment serviceFabric) { + return updateAsync(resourceGroupName, labName, username, name, serviceFabric).block(); + } + + /** + * Allows modifying tags of service fabrics. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param serviceFabric A Service Fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Service Fabric. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String name, + ServiceFabricFragment serviceFabric, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, username, name, serviceFabric, context).block(); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableSchedulesWithResponseAsync( + String resourceGroupName, String labName, String username, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listApplicableSchedules( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableSchedulesWithResponseAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listApplicableSchedules( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listApplicableSchedulesAsync( + String resourceGroupName, String labName, String username, String name) { + return listApplicableSchedulesWithResponseAsync(resourceGroupName, labName, username, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicableScheduleInner listApplicableSchedules( + String resourceGroupName, String labName, String username, String name) { + return listApplicableSchedulesAsync(resourceGroupName, labName, username, name).block(); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String username, String name, Context context) { + return listApplicableSchedulesWithResponseAsync(resourceGroupName, labName, username, name, context).block(); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String labName, String username, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String labName, String username, String name) { + Mono>> mono = startWithResponseAsync(resourceGroupName, labName, username, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + startWithResponseAsync(resourceGroupName, labName, username, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String labName, String username, String name) { + return beginStartAsync(resourceGroupName, labName, username, name).getSyncPoller(); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginStartAsync(resourceGroupName, labName, username, name, context).getSyncPoller(); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String labName, String username, String name) { + return beginStartAsync(resourceGroupName, labName, username, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginStartAsync(resourceGroupName, labName, username, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String labName, String username, String name) { + startAsync(resourceGroupName, labName, username, name).block(); + } + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String labName, String username, String name, Context context) { + startAsync(resourceGroupName, labName, username, name, context).block(); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String labName, String username, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (username == null) { + return Mono.error(new IllegalArgumentException("Parameter username is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + username, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStopAsync( + String resourceGroupName, String labName, String username, String name) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, labName, username, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStopAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + stopWithResponseAsync(resourceGroupName, labName, username, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStop( + String resourceGroupName, String labName, String username, String name) { + return beginStopAsync(resourceGroupName, labName, username, name).getSyncPoller(); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStop( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginStopAsync(resourceGroupName, labName, username, name, context).getSyncPoller(); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String labName, String username, String name) { + return beginStopAsync(resourceGroupName, labName, username, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync( + String resourceGroupName, String labName, String username, String name, Context context) { + return beginStopAsync(resourceGroupName, labName, username, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String labName, String username, String name) { + stopAsync(resourceGroupName, labName, username, name).block(); + } + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String labName, String username, String name, Context context) { + stopAsync(resourceGroupName, labName, username, name, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsImpl.java new file mode 100644 index 000000000000..5cf4d5d15dc9 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceFabricsImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceFabricsClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceFabricInner; +import com.azure.resourcemanager.devtestlabs.models.ApplicableSchedule; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabric; +import com.azure.resourcemanager.devtestlabs.models.ServiceFabrics; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServiceFabricsImpl implements ServiceFabrics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceFabricsImpl.class); + + private final ServiceFabricsClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public ServiceFabricsImpl( + ServiceFabricsClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String username) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName, username); + return Utils.mapPage(inner, inner1 -> new ServiceFabricImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, username, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ServiceFabricImpl(inner1, this.manager())); + } + + public ServiceFabric get(String resourceGroupName, String labName, String username, String name) { + ServiceFabricInner inner = this.serviceClient().get(resourceGroupName, labName, username, name); + if (inner != null) { + return new ServiceFabricImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, username, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceFabricImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String username, String name) { + this.serviceClient().delete(resourceGroupName, labName, username, name); + } + + public void delete(String resourceGroupName, String labName, String username, String name, Context context) { + this.serviceClient().delete(resourceGroupName, labName, username, name, context); + } + + public ApplicableSchedule listApplicableSchedules( + String resourceGroupName, String labName, String username, String name) { + ApplicableScheduleInner inner = + this.serviceClient().listApplicableSchedules(resourceGroupName, labName, username, name); + if (inner != null) { + return new ApplicableScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String username, String name, Context context) { + Response inner = + this + .serviceClient() + .listApplicableSchedulesWithResponse(resourceGroupName, labName, username, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicableScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void start(String resourceGroupName, String labName, String username, String name) { + this.serviceClient().start(resourceGroupName, labName, username, name); + } + + public void start(String resourceGroupName, String labName, String username, String name, Context context) { + this.serviceClient().start(resourceGroupName, labName, username, name, context); + } + + public void stop(String resourceGroupName, String labName, String username, String name) { + this.serviceClient().stop(resourceGroupName, labName, username, name); + } + + public void stop(String resourceGroupName, String labName, String username, String name, Context context) { + this.serviceClient().stop(resourceGroupName, labName, username, name, context); + } + + public ServiceFabric getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicefabrics"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicefabrics'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, username, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicefabrics"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicefabrics'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, username, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicefabrics"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicefabrics'.", id))); + } + this.delete(resourceGroupName, labName, username, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String username = Utils.getValueFromIdByName(id, "users"); + if (username == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicefabrics"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicefabrics'.", id))); + } + this.delete(resourceGroupName, labName, username, name, context); + } + + private ServiceFabricsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public ServiceFabricImpl define(String name) { + return new ServiceFabricImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnerImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnerImpl.java new file mode 100644 index 000000000000..0d21a4ce2ba0 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnerImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceRunnerInner; +import com.azure.resourcemanager.devtestlabs.models.IdentityProperties; +import com.azure.resourcemanager.devtestlabs.models.ServiceRunner; +import java.util.Collections; +import java.util.Map; + +public final class ServiceRunnerImpl implements ServiceRunner, ServiceRunner.Definition, ServiceRunner.Update { + private ServiceRunnerInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public IdentityProperties identity() { + return this.innerModel().identity(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServiceRunnerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + public ServiceRunnerImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public ServiceRunner create() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceRunners() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceRunner create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceRunners() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceRunnerImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new ServiceRunnerInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public ServiceRunnerImpl update() { + return this; + } + + public ServiceRunner apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceRunners() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceRunner apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceRunners() + .createOrUpdateWithResponse(resourceGroupName, labName, name, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceRunnerImpl( + ServiceRunnerInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "servicerunners"); + } + + public ServiceRunner refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceRunners() + .getWithResponse(resourceGroupName, labName, name, Context.NONE) + .getValue(); + return this; + } + + public ServiceRunner refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceRunners() + .getWithResponse(resourceGroupName, labName, name, context) + .getValue(); + return this; + } + + public ServiceRunnerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServiceRunnerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServiceRunnerImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ServiceRunnerImpl withIdentity(IdentityProperties identity) { + this.innerModel().withIdentity(identity); + return this; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersClientImpl.java new file mode 100644 index 000000000000..7e64155b672c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersClientImpl.java @@ -0,0 +1,603 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceRunnersClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceRunnerInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceRunnersClient. */ +public final class ServiceRunnersClientImpl implements ServiceRunnersClient { + private final ClientLogger logger = new ClientLogger(ServiceRunnersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServiceRunnersService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of ServiceRunnersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceRunnersClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(ServiceRunnersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientServiceRunners to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientSer") + private interface ServiceRunnersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/servicerunners/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/servicerunners/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServiceRunnerInner serviceRunner, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/servicerunners/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + return getWithResponseAsync(resourceGroupName, labName, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceRunnerInner get(String resourceGroupName, String labName, String name) { + return getAsync(resourceGroupName, labName, name).block(); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Create or replace an existing service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a managed identity to execute DevTest lab services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (serviceRunner == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceRunner is required and cannot be null.")); + } else { + serviceRunner.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + serviceRunner, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a managed identity to execute DevTest lab services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (serviceRunner == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceRunner is required and cannot be null.")); + } else { + serviceRunner.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + serviceRunner, + accept, + context); + } + + /** + * Create or replace an existing service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a managed identity to execute DevTest lab services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, serviceRunner) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a managed identity to execute DevTest lab services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceRunnerInner createOrUpdate( + String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner) { + return createOrUpdateAsync(resourceGroupName, labName, name, serviceRunner).block(); + } + + /** + * Create or replace an existing service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a managed identity to execute DevTest lab services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, name, serviceRunner, context).block(); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, name).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, name, context).block(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersImpl.java new file mode 100644 index 000000000000..f3e1ec6938dd --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/ServiceRunnersImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.ServiceRunnersClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceRunnerInner; +import com.azure.resourcemanager.devtestlabs.models.ServiceRunner; +import com.azure.resourcemanager.devtestlabs.models.ServiceRunners; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServiceRunnersImpl implements ServiceRunners { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceRunnersImpl.class); + + private final ServiceRunnersClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public ServiceRunnersImpl( + ServiceRunnersClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceRunner get(String resourceGroupName, String labName, String name) { + ServiceRunnerInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new ServiceRunnerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceRunnerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, name, context); + } + + public ServiceRunner getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicerunners"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicerunners'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicerunners"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicerunners'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicerunners"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicerunners'.", id))); + } + this.deleteWithResponse(resourceGroupName, labName, name, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "servicerunners"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'servicerunners'.", id))); + } + return this.deleteWithResponse(resourceGroupName, labName, name, context); + } + + private ServiceRunnersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public ServiceRunnerImpl define(String name) { + return new ServiceRunnerImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UserImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UserImpl.java new file mode 100644 index 000000000000..13aca3cc5174 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UserImpl.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.UserInner; +import com.azure.resourcemanager.devtestlabs.models.User; +import com.azure.resourcemanager.devtestlabs.models.UserFragment; +import com.azure.resourcemanager.devtestlabs.models.UserIdentity; +import com.azure.resourcemanager.devtestlabs.models.UserSecretStore; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class UserImpl implements User, User.Definition, User.Update { + private UserInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public UserIdentity identity() { + return this.innerModel().identity(); + } + + public UserSecretStore secretStore() { + return this.innerModel().secretStore(); + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public UserInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + private UserFragment updateUser; + + public UserImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public User create() { + this.innerObject = + serviceManager + .serviceClient() + .getUsers() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), Context.NONE); + return this; + } + + public User create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getUsers() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), context); + return this; + } + + UserImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new UserInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public UserImpl update() { + this.updateUser = new UserFragment(); + return this; + } + + public User apply() { + this.innerObject = + serviceManager + .serviceClient() + .getUsers() + .updateWithResponse(resourceGroupName, labName, name, updateUser, Context.NONE) + .getValue(); + return this; + } + + public User apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getUsers() + .updateWithResponse(resourceGroupName, labName, name, updateUser, context) + .getValue(); + return this; + } + + UserImpl(UserInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "users"); + } + + public User refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getUsers() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public User refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getUsers() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public UserImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public UserImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public UserImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateUser.withTags(tags); + return this; + } + } + + public UserImpl withIdentity(UserIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public UserImpl withSecretStore(UserSecretStore secretStore) { + this.innerModel().withSecretStore(secretStore); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersClientImpl.java new file mode 100644 index 000000000000..ca31fe421313 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersClientImpl.java @@ -0,0 +1,1386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.UsersClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.UserInner; +import com.azure.resourcemanager.devtestlabs.models.UserFragment; +import com.azure.resourcemanager.devtestlabs.models.UserList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UsersClient. */ +public final class UsersClientImpl implements UsersClient { + private final ClientLogger logger = new ClientLogger(UsersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final UsersService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of UsersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UsersClientImpl(DevTestLabsClientImpl client) { + this.service = RestProxy.create(UsersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientUsers to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientUse") + private interface UsersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UserInner user, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/users/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UserFragment user, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UserInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, UserInner user) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (user == null) { + return Mono.error(new IllegalArgumentException("Parameter user is required and cannot be null.")); + } else { + user.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + user, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, UserInner user, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (user == null) { + return Mono.error(new IllegalArgumentException("Parameter user is required and cannot be null.")); + } else { + user.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + user, + accept, + context); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, UserInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, UserInner user) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, labName, name, user); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), UserInner.class, UserInner.class, Context.NONE); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, UserInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, UserInner user, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, user, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), UserInner.class, UserInner.class, context); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, UserInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, UserInner user) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, user).getSyncPoller(); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, UserInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, UserInner user, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, user, context).getSyncPoller(); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String labName, String name, UserInner user) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, user) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, UserInner user, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, user, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UserInner createOrUpdate(String resourceGroupName, String labName, String name, UserInner user) { + return createOrUpdateAsync(resourceGroupName, labName, name, user).block(); + } + + /** + * Create or replace an existing user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UserInner createOrUpdate( + String resourceGroupName, String labName, String name, UserInner user, Context context) { + return createOrUpdateAsync(resourceGroupName, labName, name, user, context).block(); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String labName, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name, Context context) { + deleteAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of user profiles. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, UserFragment user) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (user == null) { + return Mono.error(new IllegalArgumentException("Parameter user is required and cannot be null.")); + } else { + user.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + user, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of user profiles. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, UserFragment user, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (user == null) { + return Mono.error(new IllegalArgumentException("Parameter user is required and cannot be null.")); + } else { + user.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + user, + accept, + context); + } + + /** + * Allows modifying tags of user profiles. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String labName, String name, UserFragment user) { + return updateWithResponseAsync(resourceGroupName, labName, name, user) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of user profiles. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UserInner update(String resourceGroupName, String labName, String name, UserFragment user) { + return updateAsync(resourceGroupName, labName, name, user).block(); + } + + /** + * Allows modifying tags of user profiles. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return profile of a lab user. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String labName, String name, UserFragment user, Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, user, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersImpl.java new file mode 100644 index 000000000000..2b84a68e2c6e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/UsersImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.UsersClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.UserInner; +import com.azure.resourcemanager.devtestlabs.models.User; +import com.azure.resourcemanager.devtestlabs.models.Users; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class UsersImpl implements Users { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsersImpl.class); + + private final UsersClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public UsersImpl(UsersClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new UserImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new UserImpl(inner1, this.manager())); + } + + public User get(String resourceGroupName, String labName, String name) { + UserInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new UserImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new UserImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public void delete(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, labName, name, context); + } + + public User getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "users"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "users"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "users"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + this.delete(resourceGroupName, labName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "users"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'users'.", id))); + } + this.delete(resourceGroupName, labName, name, context); + } + + private UsersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public UserImpl define(String name) { + return new UserImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/Utils.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/Utils.java new file mode 100644 index 000000000000..44ce005b12b8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesClientImpl.java new file mode 100644 index 000000000000..04224a9ffdd0 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesClientImpl.java @@ -0,0 +1,1628 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualMachineSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.ScheduleList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineSchedulesClient. */ +public final class VirtualMachineSchedulesClientImpl implements VirtualMachineSchedulesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineSchedulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineSchedulesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of VirtualMachineSchedulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineSchedulesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy + .create(VirtualMachineSchedulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientVirtualMachineSchedules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientVir") + private interface VirtualMachineSchedulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{virtualMachineName}/schedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("virtualMachineName") String virtualMachineName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleInner schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduleFragment schedule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> execute( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("virtualMachineName") String virtualMachineName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName, String virtualMachineName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName, String virtualMachineName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>( + listAsync(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby)); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby, context)); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String virtualMachineName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner get(String resourceGroupName, String labName, String virtualMachineName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, virtualMachineName, name, expand).block(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + String expand, + Context context) { + return getWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, expand, context).block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleInner schedule, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner createOrUpdate( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule) { + return createOrUpdateAsync(resourceGroupName, labName, virtualMachineName, name, schedule).block(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleInner schedule, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule, context) + .block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String virtualMachineName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String virtualMachineName, String name) { + return deleteWithResponseAsync(resourceGroupName, labName, virtualMachineName, name) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String virtualMachineName, String name) { + deleteAsync(resourceGroupName, labName, virtualMachineName, name).block(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + return deleteWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, context).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + schedule, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleFragment schedule, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (schedule == null) { + return Mono.error(new IllegalArgumentException("Parameter schedule is required and cannot be null.")); + } else { + schedule.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + schedule, + accept, + context); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule) { + return updateWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduleInner update( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule) { + return updateAsync(resourceGroupName, labName, virtualMachineName, name, schedule).block(); + } + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleFragment schedule, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule, context).block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, String labName, String virtualMachineName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> executeWithResponseAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (virtualMachineName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualMachineName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + virtualMachineName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, String labName, String virtualMachineName, String name) { + Mono>> mono = + executeWithResponseAsync(resourceGroupName, labName, virtualMachineName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginExecuteAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + executeWithResponseAsync(resourceGroupName, labName, virtualMachineName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String virtualMachineName, String name) { + return beginExecuteAsync(resourceGroupName, labName, virtualMachineName, name).getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginExecute( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + return beginExecuteAsync(resourceGroupName, labName, virtualMachineName, name, context).getSyncPoller(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(String resourceGroupName, String labName, String virtualMachineName, String name) { + return beginExecuteAsync(resourceGroupName, labName, virtualMachineName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + return beginExecuteAsync(resourceGroupName, labName, virtualMachineName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute(String resourceGroupName, String labName, String virtualMachineName, String name) { + executeAsync(resourceGroupName, labName, virtualMachineName, name).block(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void execute( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + executeAsync(resourceGroupName, labName, virtualMachineName, name, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesImpl.java new file mode 100644 index 000000000000..0a4edb1a7ef1 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachineSchedulesImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualMachineSchedulesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.azure.resourcemanager.devtestlabs.models.Schedule; +import com.azure.resourcemanager.devtestlabs.models.ScheduleFragment; +import com.azure.resourcemanager.devtestlabs.models.VirtualMachineSchedules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineSchedulesImpl implements VirtualMachineSchedules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineSchedulesImpl.class); + + private final VirtualMachineSchedulesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public VirtualMachineSchedulesImpl( + VirtualMachineSchedulesClient innerClient, + com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName, String virtualMachineName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName, virtualMachineName); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new ScheduleImpl(inner1, this.manager())); + } + + public Schedule get(String resourceGroupName, String labName, String virtualMachineName, String name) { + ScheduleInner inner = this.serviceClient().get(resourceGroupName, labName, virtualMachineName, name); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + String expand, + Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, virtualMachineName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Schedule createOrUpdate( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule) { + ScheduleInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, labName, virtualMachineName, name, schedule); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleInner schedule, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse(resourceGroupName, labName, virtualMachineName, name, schedule, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String virtualMachineName, String name) { + this.serviceClient().delete(resourceGroupName, labName, virtualMachineName, name); + } + + public Response deleteWithResponse( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, labName, virtualMachineName, name, context); + } + + public Schedule update( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule) { + ScheduleInner inner = + this.serviceClient().update(resourceGroupName, labName, virtualMachineName, name, schedule); + if (inner != null) { + return new ScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleFragment schedule, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, labName, virtualMachineName, name, schedule, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void execute(String resourceGroupName, String labName, String virtualMachineName, String name) { + this.serviceClient().execute(resourceGroupName, labName, virtualMachineName, name); + } + + public void execute( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context) { + this.serviceClient().execute(resourceGroupName, labName, virtualMachineName, name, context); + } + + private VirtualMachineSchedulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesClientImpl.java new file mode 100644 index 000000000000..d5211b830d07 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesClientImpl.java @@ -0,0 +1,4925 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVirtualMachineInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.RdpConnectionInner; +import com.azure.resourcemanager.devtestlabs.models.ApplyArtifactsRequest; +import com.azure.resourcemanager.devtestlabs.models.DataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineFragment; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachineList; +import com.azure.resourcemanager.devtestlabs.models.ResizeLabVirtualMachineProperties; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachinesClient. */ +public final class VirtualMachinesClientImpl implements VirtualMachinesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachinesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachinesService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of VirtualMachinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachinesClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(VirtualMachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientVirtualMachines to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientVir") + private interface VirtualMachinesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LabVirtualMachineInner labVirtualMachine, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LabVirtualMachineFragment labVirtualMachine, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/addDataDisk") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> addDataDisk( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataDiskProperties dataDiskProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/applyArtifacts") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> applyArtifacts( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ApplyArtifactsRequest applyArtifactsRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/claim") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> claim( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/detachDataDisk") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> detachDataDisk( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DetachDataDiskProperties detachDataDiskProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/getRdpFileContents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getRdpFileContents( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/listApplicableSchedules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listApplicableSchedules( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/redeploy") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> redeploy( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/resize") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> resize( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/stop") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/transferDisks") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> transferDisks( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualmachines/{name}/unClaim") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> unClaim( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabVirtualMachineInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labVirtualMachine == null) { + return Mono + .error(new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null.")); + } else { + labVirtualMachine.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + labVirtualMachine, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineInner labVirtualMachine, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labVirtualMachine == null) { + return Mono + .error(new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null.")); + } else { + labVirtualMachine.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + labVirtualMachine, + accept, + context); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LabVirtualMachineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, labVirtualMachine); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LabVirtualMachineInner.class, + LabVirtualMachineInner.class, + Context.NONE); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, LabVirtualMachineInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineInner labVirtualMachine, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, labVirtualMachine, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LabVirtualMachineInner.class, + LabVirtualMachineInner.class, + context); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LabVirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine).getSyncPoller(); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, LabVirtualMachineInner> beginCreateOrUpdate( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineInner labVirtualMachine, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine, context).getSyncPoller(); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineInner labVirtualMachine, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabVirtualMachineInner createOrUpdate( + String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return createOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine).block(); + } + + /** + * Create or replace an existing virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabVirtualMachineInner createOrUpdate( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineInner labVirtualMachine, + Context context) { + return createOrUpdateAsync(resourceGroupName, labName, name, labVirtualMachine, context).block(); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String labName, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name, Context context) { + deleteAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, LabVirtualMachineFragment labVirtualMachine) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labVirtualMachine == null) { + return Mono + .error(new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null.")); + } else { + labVirtualMachine.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + labVirtualMachine, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineFragment labVirtualMachine, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (labVirtualMachine == null) { + return Mono + .error(new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null.")); + } else { + labVirtualMachine.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + labVirtualMachine, + accept, + context); + } + + /** + * Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String name, LabVirtualMachineFragment labVirtualMachine) { + return updateWithResponseAsync(resourceGroupName, labName, name, labVirtualMachine) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LabVirtualMachineInner update( + String resourceGroupName, String labName, String name, LabVirtualMachineFragment labVirtualMachine) { + return updateAsync(resourceGroupName, labName, name, labVirtualMachine).block(); + } + + /** + * Allows modifying tags of virtual machines. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param labVirtualMachine A virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String labName, + String name, + LabVirtualMachineFragment labVirtualMachine, + Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, labVirtualMachine, context).block(); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> addDataDiskWithResponseAsync( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (dataDiskProperties == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataDiskProperties is required and cannot be null.")); + } else { + dataDiskProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .addDataDisk( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + dataDiskProperties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> addDataDiskWithResponseAsync( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (dataDiskProperties == null) { + return Mono + .error(new IllegalArgumentException("Parameter dataDiskProperties is required and cannot be null.")); + } else { + dataDiskProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .addDataDisk( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + dataDiskProperties, + accept, + context); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginAddDataDiskAsync( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + Mono>> mono = + addDataDiskWithResponseAsync(resourceGroupName, labName, name, dataDiskProperties); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginAddDataDiskAsync( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + addDataDiskWithResponseAsync(resourceGroupName, labName, name, dataDiskProperties, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginAddDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + return beginAddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties).getSyncPoller(); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginAddDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context) { + return beginAddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties, context).getSyncPoller(); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addDataDiskAsync( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + return beginAddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addDataDiskAsync( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context) { + return beginAddDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void addDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + addDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties).block(); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void addDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context) { + addDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties, context).block(); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> applyArtifactsWithResponseAsync( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (applyArtifactsRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter applyArtifactsRequest is required and cannot be null.")); + } else { + applyArtifactsRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .applyArtifacts( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + applyArtifactsRequest, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> applyArtifactsWithResponseAsync( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (applyArtifactsRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter applyArtifactsRequest is required and cannot be null.")); + } else { + applyArtifactsRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .applyArtifacts( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + applyArtifactsRequest, + accept, + context); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginApplyArtifactsAsync( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest) { + Mono>> mono = + applyArtifactsWithResponseAsync(resourceGroupName, labName, name, applyArtifactsRequest); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginApplyArtifactsAsync( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + applyArtifactsWithResponseAsync(resourceGroupName, labName, name, applyArtifactsRequest, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginApplyArtifacts( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest) { + return beginApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest).getSyncPoller(); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginApplyArtifacts( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context) { + return beginApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest, context) + .getSyncPoller(); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono applyArtifactsAsync( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest) { + return beginApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono applyArtifactsAsync( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context) { + return beginApplyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void applyArtifacts( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest) { + applyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest).block(); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void applyArtifacts( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context) { + applyArtifactsAsync(resourceGroupName, labName, name, applyArtifactsRequest, context).block(); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> claimWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .claim( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> claimWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .claim( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginClaimAsync(String resourceGroupName, String labName, String name) { + Mono>> mono = claimWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginClaimAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = claimWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginClaim(String resourceGroupName, String labName, String name) { + return beginClaimAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginClaim( + String resourceGroupName, String labName, String name, Context context) { + return beginClaimAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono claimAsync(String resourceGroupName, String labName, String name) { + return beginClaimAsync(resourceGroupName, labName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono claimAsync(String resourceGroupName, String labName, String name, Context context) { + return beginClaimAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void claim(String resourceGroupName, String labName, String name) { + claimAsync(resourceGroupName, labName, name).block(); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void claim(String resourceGroupName, String labName, String name, Context context) { + claimAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> detachDataDiskWithResponseAsync( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (detachDataDiskProperties == null) { + return Mono + .error( + new IllegalArgumentException("Parameter detachDataDiskProperties is required and cannot be null.")); + } else { + detachDataDiskProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .detachDataDisk( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + detachDataDiskProperties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> detachDataDiskWithResponseAsync( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (detachDataDiskProperties == null) { + return Mono + .error( + new IllegalArgumentException("Parameter detachDataDiskProperties is required and cannot be null.")); + } else { + detachDataDiskProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .detachDataDisk( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + detachDataDiskProperties, + accept, + context); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDetachDataDiskAsync( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties) { + Mono>> mono = + detachDataDiskWithResponseAsync(resourceGroupName, labName, name, detachDataDiskProperties); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDetachDataDiskAsync( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + detachDataDiskWithResponseAsync(resourceGroupName, labName, name, detachDataDiskProperties, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDetachDataDisk( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties) { + return beginDetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties).getSyncPoller(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDetachDataDisk( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context) { + return beginDetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties, context) + .getSyncPoller(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono detachDataDiskAsync( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties) { + return beginDetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono detachDataDiskAsync( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context) { + return beginDetachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void detachDataDisk( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties) { + detachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties).block(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void detachDataDisk( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context) { + detachDataDiskAsync(resourceGroupName, labName, name, detachDataDiskProperties, context).block(); + } + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRdpFileContentsWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getRdpFileContents( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRdpFileContentsWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getRdpFileContents( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getRdpFileContentsAsync(String resourceGroupName, String labName, String name) { + return getRdpFileContentsWithResponseAsync(resourceGroupName, labName, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RdpConnectionInner getRdpFileContents(String resourceGroupName, String labName, String name) { + return getRdpFileContentsAsync(resourceGroupName, labName, name).block(); + } + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRdpFileContentsWithResponse( + String resourceGroupName, String labName, String name, Context context) { + return getRdpFileContentsWithResponseAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableSchedulesWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listApplicableSchedules( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApplicableSchedulesWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listApplicableSchedules( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listApplicableSchedulesAsync( + String resourceGroupName, String labName, String name) { + return listApplicableSchedulesWithResponseAsync(resourceGroupName, labName, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicableScheduleInner listApplicableSchedules(String resourceGroupName, String labName, String name) { + return listApplicableSchedulesAsync(resourceGroupName, labName, name).block(); + } + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String name, Context context) { + return listApplicableSchedulesWithResponseAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> redeployWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .redeploy( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> redeployWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .redeploy( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRedeployAsync( + String resourceGroupName, String labName, String name) { + Mono>> mono = redeployWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRedeployAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = redeployWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRedeploy(String resourceGroupName, String labName, String name) { + return beginRedeployAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRedeploy( + String resourceGroupName, String labName, String name, Context context) { + return beginRedeployAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono redeployAsync(String resourceGroupName, String labName, String name) { + return beginRedeployAsync(resourceGroupName, labName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono redeployAsync(String resourceGroupName, String labName, String name, Context context) { + return beginRedeployAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void redeploy(String resourceGroupName, String labName, String name) { + redeployAsync(resourceGroupName, labName, name).block(); + } + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void redeploy(String resourceGroupName, String labName, String name, Context context) { + redeployAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resizeWithResponseAsync( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resizeLabVirtualMachineProperties == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resizeLabVirtualMachineProperties is required and cannot be null.")); + } else { + resizeLabVirtualMachineProperties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .resize( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + resizeLabVirtualMachineProperties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> resizeWithResponseAsync( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resizeLabVirtualMachineProperties == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter resizeLabVirtualMachineProperties is required and cannot be null.")); + } else { + resizeLabVirtualMachineProperties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .resize( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + resizeLabVirtualMachineProperties, + accept, + context); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginResizeAsync( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) { + Mono>> mono = + resizeWithResponseAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginResizeAsync( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + resizeWithResponseAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginResize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) { + return beginResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties).getSyncPoller(); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginResize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context) { + return beginResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, context) + .getSyncPoller(); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resizeAsync( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) { + return beginResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resizeAsync( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context) { + return beginResizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) { + resizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties).block(); + } + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context) { + resizeAsync(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, context).block(); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String labName, String name) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRestart(String resourceGroupName, String labName, String name) { + return beginRestartAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String labName, String name, Context context) { + return beginRestartAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String labName, String name) { + return beginRestartAsync(resourceGroupName, labName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String labName, String name, Context context) { + return beginRestartAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String labName, String name) { + restartAsync(resourceGroupName, labName, name).block(); + } + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String labName, String name, Context context) { + restartAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String labName, String name) { + Mono>> mono = startWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart(String resourceGroupName, String labName, String name) { + return beginStartAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String labName, String name, Context context) { + return beginStartAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String labName, String name) { + return beginStartAsync(resourceGroupName, labName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String labName, String name, Context context) { + return beginStartAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String labName, String name) { + startAsync(resourceGroupName, labName, name).block(); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String labName, String name, Context context) { + startAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStopAsync(String resourceGroupName, String labName, String name) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStopAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = stopWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStop(String resourceGroupName, String labName, String name) { + return beginStopAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStop( + String resourceGroupName, String labName, String name, Context context) { + return beginStopAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String labName, String name) { + return beginStopAsync(resourceGroupName, labName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String labName, String name, Context context) { + return beginStopAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String labName, String name) { + stopAsync(resourceGroupName, labName, name).block(); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String labName, String name, Context context) { + stopAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> transferDisksWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .transferDisks( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> transferDisksWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .transferDisks( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTransferDisksAsync( + String resourceGroupName, String labName, String name) { + Mono>> mono = transferDisksWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginTransferDisksAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + transferDisksWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTransferDisks( + String resourceGroupName, String labName, String name) { + return beginTransferDisksAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginTransferDisks( + String resourceGroupName, String labName, String name, Context context) { + return beginTransferDisksAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono transferDisksAsync(String resourceGroupName, String labName, String name) { + return beginTransferDisksAsync(resourceGroupName, labName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono transferDisksAsync(String resourceGroupName, String labName, String name, Context context) { + return beginTransferDisksAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void transferDisks(String resourceGroupName, String labName, String name) { + transferDisksAsync(resourceGroupName, labName, name).block(); + } + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void transferDisks(String resourceGroupName, String labName, String name, Context context) { + transferDisksAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> unClaimWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .unClaim( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> unClaimWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .unClaim( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginUnClaimAsync( + String resourceGroupName, String labName, String name) { + Mono>> mono = unClaimWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginUnClaimAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = unClaimWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginUnClaim(String resourceGroupName, String labName, String name) { + return beginUnClaimAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginUnClaim( + String resourceGroupName, String labName, String name, Context context) { + return beginUnClaimAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono unClaimAsync(String resourceGroupName, String labName, String name) { + return beginUnClaimAsync(resourceGroupName, labName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono unClaimAsync(String resourceGroupName, String labName, String name, Context context) { + return beginUnClaimAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void unClaim(String resourceGroupName, String labName, String name) { + unClaimAsync(resourceGroupName, labName, name).block(); + } + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void unClaim(String resourceGroupName, String labName, String name, Context context) { + unClaimAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesImpl.java new file mode 100644 index 000000000000..b44d78c408f1 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualMachinesImpl.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualMachinesClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVirtualMachineInner; +import com.azure.resourcemanager.devtestlabs.fluent.models.RdpConnectionInner; +import com.azure.resourcemanager.devtestlabs.models.ApplicableSchedule; +import com.azure.resourcemanager.devtestlabs.models.ApplyArtifactsRequest; +import com.azure.resourcemanager.devtestlabs.models.DataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.DetachDataDiskProperties; +import com.azure.resourcemanager.devtestlabs.models.LabVirtualMachine; +import com.azure.resourcemanager.devtestlabs.models.RdpConnection; +import com.azure.resourcemanager.devtestlabs.models.ResizeLabVirtualMachineProperties; +import com.azure.resourcemanager.devtestlabs.models.VirtualMachines; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachinesImpl implements VirtualMachines { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachinesImpl.class); + + private final VirtualMachinesClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public VirtualMachinesImpl( + VirtualMachinesClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new LabVirtualMachineImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new LabVirtualMachineImpl(inner1, this.manager())); + } + + public LabVirtualMachine get(String resourceGroupName, String labName, String name) { + LabVirtualMachineInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new LabVirtualMachineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LabVirtualMachineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public void delete(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, labName, name, context); + } + + public void addDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + this.serviceClient().addDataDisk(resourceGroupName, labName, name, dataDiskProperties); + } + + public void addDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context) { + this.serviceClient().addDataDisk(resourceGroupName, labName, name, dataDiskProperties, context); + } + + public void applyArtifacts( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest) { + this.serviceClient().applyArtifacts(resourceGroupName, labName, name, applyArtifactsRequest); + } + + public void applyArtifacts( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context) { + this.serviceClient().applyArtifacts(resourceGroupName, labName, name, applyArtifactsRequest, context); + } + + public void claim(String resourceGroupName, String labName, String name) { + this.serviceClient().claim(resourceGroupName, labName, name); + } + + public void claim(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().claim(resourceGroupName, labName, name, context); + } + + public void detachDataDisk( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties) { + this.serviceClient().detachDataDisk(resourceGroupName, labName, name, detachDataDiskProperties); + } + + public void detachDataDisk( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context) { + this.serviceClient().detachDataDisk(resourceGroupName, labName, name, detachDataDiskProperties, context); + } + + public RdpConnection getRdpFileContents(String resourceGroupName, String labName, String name) { + RdpConnectionInner inner = this.serviceClient().getRdpFileContents(resourceGroupName, labName, name); + if (inner != null) { + return new RdpConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getRdpFileContentsWithResponse( + String resourceGroupName, String labName, String name, Context context) { + Response inner = + this.serviceClient().getRdpFileContentsWithResponse(resourceGroupName, labName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RdpConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ApplicableSchedule listApplicableSchedules(String resourceGroupName, String labName, String name) { + ApplicableScheduleInner inner = this.serviceClient().listApplicableSchedules(resourceGroupName, labName, name); + if (inner != null) { + return new ApplicableScheduleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String name, Context context) { + Response inner = + this.serviceClient().listApplicableSchedulesWithResponse(resourceGroupName, labName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicableScheduleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void redeploy(String resourceGroupName, String labName, String name) { + this.serviceClient().redeploy(resourceGroupName, labName, name); + } + + public void redeploy(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().redeploy(resourceGroupName, labName, name, context); + } + + public void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties) { + this.serviceClient().resize(resourceGroupName, labName, name, resizeLabVirtualMachineProperties); + } + + public void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context) { + this.serviceClient().resize(resourceGroupName, labName, name, resizeLabVirtualMachineProperties, context); + } + + public void restart(String resourceGroupName, String labName, String name) { + this.serviceClient().restart(resourceGroupName, labName, name); + } + + public void restart(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().restart(resourceGroupName, labName, name, context); + } + + public void start(String resourceGroupName, String labName, String name) { + this.serviceClient().start(resourceGroupName, labName, name); + } + + public void start(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().start(resourceGroupName, labName, name, context); + } + + public void stop(String resourceGroupName, String labName, String name) { + this.serviceClient().stop(resourceGroupName, labName, name); + } + + public void stop(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().stop(resourceGroupName, labName, name, context); + } + + public void transferDisks(String resourceGroupName, String labName, String name) { + this.serviceClient().transferDisks(resourceGroupName, labName, name); + } + + public void transferDisks(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().transferDisks(resourceGroupName, labName, name, context); + } + + public void unClaim(String resourceGroupName, String labName, String name) { + this.serviceClient().unClaim(resourceGroupName, labName, name); + } + + public void unClaim(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().unClaim(resourceGroupName, labName, name, context); + } + + public LabVirtualMachine getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualmachines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualmachines'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualmachines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualmachines'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualmachines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualmachines'.", id))); + } + this.delete(resourceGroupName, labName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualmachines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualmachines'.", id))); + } + this.delete(resourceGroupName, labName, name, context); + } + + private VirtualMachinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public LabVirtualMachineImpl define(String name) { + return new LabVirtualMachineImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworkImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworkImpl.java new file mode 100644 index 000000000000..2bb6b8da1d76 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworkImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.devtestlabs.models.ExternalSubnet; +import com.azure.resourcemanager.devtestlabs.models.Subnet; +import com.azure.resourcemanager.devtestlabs.models.SubnetOverride; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetwork; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetworkFragment; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class VirtualNetworkImpl implements VirtualNetwork, VirtualNetwork.Definition, VirtualNetwork.Update { + private VirtualNetworkInner innerObject; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public List allowedSubnets() { + List inner = this.innerModel().allowedSubnets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public String externalProviderResourceId() { + return this.innerModel().externalProviderResourceId(); + } + + public List externalSubnets() { + List inner = this.innerModel().externalSubnets(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List subnetOverrides() { + List inner = this.innerModel().subnetOverrides(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime createdDate() { + return this.innerModel().createdDate(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String uniqueIdentifier() { + return this.innerModel().uniqueIdentifier(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public VirtualNetworkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String labName; + + private String name; + + private VirtualNetworkFragment updateVirtualNetwork; + + public VirtualNetworkImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + public VirtualNetwork create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetwork create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .createOrUpdate(resourceGroupName, labName, name, this.innerModel(), context); + return this; + } + + VirtualNetworkImpl(String name, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = new VirtualNetworkInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public VirtualNetworkImpl update() { + this.updateVirtualNetwork = new VirtualNetworkFragment(); + return this; + } + + public VirtualNetwork apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .updateWithResponse(resourceGroupName, labName, name, updateVirtualNetwork, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetwork apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .updateWithResponse(resourceGroupName, labName, name, updateVirtualNetwork, context) + .getValue(); + return this; + } + + VirtualNetworkImpl( + VirtualNetworkInner innerObject, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.labName = Utils.getValueFromIdByName(innerObject.id(), "labs"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "virtualnetworks"); + } + + public VirtualNetwork refresh() { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetwork refresh(Context context) { + String localExpand = null; + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworks() + .getWithResponse(resourceGroupName, labName, name, localExpand, context) + .getValue(); + return this; + } + + public VirtualNetworkImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualNetworkImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualNetworkImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateVirtualNetwork.withTags(tags); + return this; + } + } + + public VirtualNetworkImpl withAllowedSubnets(List allowedSubnets) { + this.innerModel().withAllowedSubnets(allowedSubnets); + return this; + } + + public VirtualNetworkImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public VirtualNetworkImpl withExternalProviderResourceId(String externalProviderResourceId) { + this.innerModel().withExternalProviderResourceId(externalProviderResourceId); + return this; + } + + public VirtualNetworkImpl withSubnetOverrides(List subnetOverrides) { + this.innerModel().withSubnetOverrides(subnetOverrides); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksClientImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksClientImpl.java new file mode 100644 index 000000000000..97ba2b54fcaa --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksClientImpl.java @@ -0,0 +1,1396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualNetworksClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetworkFragment; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetworkList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualNetworksClient. */ +public final class VirtualNetworksClientImpl implements VirtualNetworksClient { + private final ClientLogger logger = new ClientLogger(VirtualNetworksClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualNetworksService service; + + /** The service client containing this operation class. */ + private final DevTestLabsClientImpl client; + + /** + * Initializes an instance of VirtualNetworksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworksClientImpl(DevTestLabsClientImpl client) { + this.service = + RestProxy.create(VirtualNetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DevTestLabsClientVirtualNetworks to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DevTestLabsClientVir") + private interface VirtualNetworksService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualnetworks") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @QueryParam("$expand") String expand, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$orderby") String orderby, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualnetworks/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualnetworks/{name}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualNetworkInner virtualNetwork, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualnetworks/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs" + + "/{labName}/virtualnetworks/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("labName") String labName, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") VirtualNetworkFragment virtualNetwork, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + expand, + filter, + top, + orderby, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String labName, String expand, String filter, Integer top, String orderby) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String labName) { + final String expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby)); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, labName, expand, filter, top, orderby, context)); + } + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String labName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + expand, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String labName, String name) { + final String expand = null; + return getWithResponseAsync(resourceGroupName, labName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner get(String resourceGroupName, String labName, String name) { + final String expand = null; + return getAsync(resourceGroupName, labName, name, expand).block(); + } + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + return getWithResponseAsync(resourceGroupName, labName, name, expand, context).block(); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (virtualNetwork == null) { + return Mono.error(new IllegalArgumentException("Parameter virtualNetwork is required and cannot be null.")); + } else { + virtualNetwork.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + virtualNetwork, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (virtualNetwork == null) { + return Mono.error(new IllegalArgumentException("Parameter virtualNetwork is required and cannot be null.")); + } else { + virtualNetwork.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + virtualNetwork, + accept, + context); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, virtualNetwork); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkInner.class, + VirtualNetworkInner.class, + Context.NONE); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkInner> beginCreateOrUpdateAsync( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, labName, name, virtualNetwork, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), VirtualNetworkInner.class, VirtualNetworkInner.class, context); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork).getSyncPoller(); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork, context).getSyncPoller(); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner createOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return createOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork).block(); + } + + /** + * Create or replace an existing virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner createOrUpdate( + String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, Context context) { + return createOrUpdateAsync(resourceGroupName, labName, name, virtualNetwork, context).block(); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String labName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String labName, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String labName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, labName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).getSyncPoller(); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context).getSyncPoller(); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteAsync(resourceGroupName, labName, name).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String labName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, labName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name) { + deleteAsync(resourceGroupName, labName, name).block(); + } + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String labName, String name, Context context) { + deleteAsync(resourceGroupName, labName, name, context).block(); + } + + /** + * Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (virtualNetwork == null) { + return Mono.error(new IllegalArgumentException("Parameter virtualNetwork is required and cannot be null.")); + } else { + virtualNetwork.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + virtualNetwork, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (labName == null) { + return Mono.error(new IllegalArgumentException("Parameter labName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (virtualNetwork == null) { + return Mono.error(new IllegalArgumentException("Parameter virtualNetwork is required and cannot be null.")); + } else { + virtualNetwork.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + labName, + name, + this.client.getApiVersion(), + virtualNetwork, + accept, + context); + } + + /** + * Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork) { + return updateWithResponseAsync(resourceGroupName, labName, name, virtualNetwork) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkInner update( + String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork) { + return updateAsync(resourceGroupName, labName, name, virtualNetwork).block(); + } + + /** + * Allows modifying tags of virtual networks. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param virtualNetwork A virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork, Context context) { + return updateWithResponseAsync(resourceGroupName, labName, name, virtualNetwork, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksImpl.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksImpl.java new file mode 100644 index 000000000000..261679ec462f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/VirtualNetworksImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.VirtualNetworksClient; +import com.azure.resourcemanager.devtestlabs.fluent.models.VirtualNetworkInner; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetwork; +import com.azure.resourcemanager.devtestlabs.models.VirtualNetworks; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualNetworksImpl implements VirtualNetworks { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworksImpl.class); + + private final VirtualNetworksClient innerClient; + + private final com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager; + + public VirtualNetworksImpl( + VirtualNetworksClient innerClient, com.azure.resourcemanager.devtestlabs.DevTestLabsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String labName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, labName); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, labName, expand, filter, top, orderby, context); + return Utils.mapPage(inner, inner1 -> new VirtualNetworkImpl(inner1, this.manager())); + } + + public VirtualNetwork get(String resourceGroupName, String labName, String name) { + VirtualNetworkInner inner = this.serviceClient().get(resourceGroupName, labName, name); + if (inner != null) { + return new VirtualNetworkImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, labName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String labName, String name) { + this.serviceClient().delete(resourceGroupName, labName, name); + } + + public void delete(String resourceGroupName, String labName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, labName, name, context); + } + + public VirtualNetwork getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualnetworks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualnetworks'.", id))); + } + String localExpand = null; + return this.getWithResponse(resourceGroupName, labName, name, localExpand, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, String expand, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualnetworks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualnetworks'.", id))); + } + return this.getWithResponse(resourceGroupName, labName, name, expand, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualnetworks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualnetworks'.", id))); + } + this.delete(resourceGroupName, labName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String labName = Utils.getValueFromIdByName(id, "labs"); + if (labName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'labs'.", id))); + } + String name = Utils.getValueFromIdByName(id, "virtualnetworks"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'virtualnetworks'.", id))); + } + this.delete(resourceGroupName, labName, name, context); + } + + private VirtualNetworksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devtestlabs.DevTestLabsManager manager() { + return this.serviceManager; + } + + public VirtualNetworkImpl define(String name) { + return new VirtualNetworkImpl(name, this.manager()); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/package-info.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/package-info.java new file mode 100644 index 000000000000..08389e1b0679 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for DevTestLabsClient. The DevTest Labs Client. */ +package com.azure.resourcemanager.devtestlabs.implementation; diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableSchedule.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableSchedule.java new file mode 100644 index 000000000000..33c94354dc47 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableSchedule.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner; +import java.util.Map; + +/** An immutable client-side representation of ApplicableSchedule. */ +public interface ApplicableSchedule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the labVmsShutdown property: The auto-shutdown schedule, if one has been set at the lab or lab resource + * level. + * + * @return the labVmsShutdown value. + */ + Schedule labVmsShutdown(); + + /** + * Gets the labVmsStartup property: The auto-startup schedule, if one has been set at the lab or lab resource level. + * + * @return the labVmsStartup value. + */ + Schedule labVmsStartup(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ApplicableScheduleInner object. + * + * @return the inner object. + */ + ApplicableScheduleInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableScheduleFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableScheduleFragment.java new file mode 100644 index 000000000000..8d58391939e9 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplicableScheduleFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** Schedules applicable to a virtual machine. The schedules may have been defined on a VM or on lab level. */ +@Immutable +public final class ApplicableScheduleFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicableScheduleFragment.class); + + /** {@inheritDoc} */ + @Override + public ApplicableScheduleFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplyArtifactsRequest.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplyArtifactsRequest.java new file mode 100644 index 000000000000..1b734e6cda74 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ApplyArtifactsRequest.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request body for applying artifacts to a virtual machine. */ +@Fluent +public final class ApplyArtifactsRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplyArtifactsRequest.class); + + /* + * The list of artifacts to apply. + */ + @JsonProperty(value = "artifacts") + private List artifacts; + + /** + * Get the artifacts property: The list of artifacts to apply. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Set the artifacts property: The list of artifacts to apply. + * + * @param artifacts the artifacts value to set. + * @return the ApplyArtifactsRequest object itself. + */ + public ApplyArtifactsRequest withArtifacts(List artifacts) { + this.artifacts = artifacts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (artifacts() != null) { + artifacts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplate.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplate.java new file mode 100644 index 000000000000..557a56165373 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplate.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ArmTemplate. */ +public interface ArmTemplate { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the displayName property: The display name of the ARM template. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the description property: The description of the ARM template. + * + * @return the description value. + */ + String description(); + + /** + * Gets the publisher property: The publisher of the ARM template. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the icon property: The URI to the icon of the ARM template. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the contents property: The contents of the ARM template. + * + * @return the contents value. + */ + Object contents(); + + /** + * Gets the createdDate property: The creation date of the armTemplate. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the parametersValueFilesInfo property: File name and parameter values information from all + * azuredeploy.*.parameters.json for the ARM template. + * + * @return the parametersValueFilesInfo value. + */ + List parametersValueFilesInfo(); + + /** + * Gets the enabled property: Whether or not ARM template is enabled for use by lab user. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInner object. + * + * @return the inner object. + */ + ArmTemplateInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateInfo.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateInfo.java new file mode 100644 index 000000000000..d759713a4272 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateInfo.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInfoInner; + +/** An immutable client-side representation of ArmTemplateInfo. */ +public interface ArmTemplateInfo { + /** + * Gets the template property: The template's contents. + * + * @return the template value. + */ + Object template(); + + /** + * Gets the parameters property: The parameters of the ARM template. + * + * @return the parameters value. + */ + Object parameters(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInfoInner object. + * + * @return the inner object. + */ + ArmTemplateInfoInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateList.java new file mode 100644 index 000000000000..67a29f431656 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArmTemplateInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class ArmTemplateList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmTemplateList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the ArmTemplateList object itself. + */ + public ArmTemplateList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ArmTemplateList object itself. + */ + public ArmTemplateList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateParameterProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateParameterProperties.java new file mode 100644 index 000000000000..9abd38224a27 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplateParameterProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Azure Resource Manager template parameter. */ +@Fluent +public final class ArmTemplateParameterProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmTemplateParameterProperties.class); + + /* + * The name of the template parameter. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the template parameter. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the template parameter. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the template parameter. + * + * @param name the name value to set. + * @return the ArmTemplateParameterProperties object itself. + */ + public ArmTemplateParameterProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the template parameter. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the template parameter. + * + * @param value the value value to set. + * @return the ArmTemplateParameterProperties object itself. + */ + public ArmTemplateParameterProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplates.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplates.java new file mode 100644 index 000000000000..402da0da244c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArmTemplates.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ArmTemplates. */ +public interface ArmTemplates { + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String artifactSourceName); + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + ArmTemplate get(String resourceGroupName, String labName, String artifactSourceName, String name); + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure resource manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure resource manager template. + */ + Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifact.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifact.java new file mode 100644 index 000000000000..bdeab04a858c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifact.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Artifact. */ +public interface Artifact { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the title property: The artifact's title. + * + * @return the title value. + */ + String title(); + + /** + * Gets the description property: The artifact's description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the publisher property: The artifact's publisher. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the filePath property: The file path to the artifact. + * + * @return the filePath value. + */ + String filePath(); + + /** + * Gets the icon property: The URI to the artifact icon. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the targetOsType property: The artifact's target OS. + * + * @return the targetOsType value. + */ + String targetOsType(); + + /** + * Gets the parameters property: The artifact's parameters. + * + * @return the parameters value. + */ + Object parameters(); + + /** + * Gets the createdDate property: The artifact's creation date. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactInner object. + * + * @return the inner object. + */ + ArtifactInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactDeploymentStatusProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactDeploymentStatusProperties.java new file mode 100644 index 000000000000..e4d551c9552c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactDeploymentStatusProperties.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an artifact deployment. */ +@Fluent +public final class ArtifactDeploymentStatusProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactDeploymentStatusProperties.class); + + /* + * The deployment status of the artifact. + */ + @JsonProperty(value = "deploymentStatus") + private String deploymentStatus; + + /* + * The total count of the artifacts that were successfully applied. + */ + @JsonProperty(value = "artifactsApplied") + private Integer artifactsApplied; + + /* + * The total count of the artifacts that were tentatively applied. + */ + @JsonProperty(value = "totalArtifacts") + private Integer totalArtifacts; + + /** + * Get the deploymentStatus property: The deployment status of the artifact. + * + * @return the deploymentStatus value. + */ + public String deploymentStatus() { + return this.deploymentStatus; + } + + /** + * Set the deploymentStatus property: The deployment status of the artifact. + * + * @param deploymentStatus the deploymentStatus value to set. + * @return the ArtifactDeploymentStatusProperties object itself. + */ + public ArtifactDeploymentStatusProperties withDeploymentStatus(String deploymentStatus) { + this.deploymentStatus = deploymentStatus; + return this; + } + + /** + * Get the artifactsApplied property: The total count of the artifacts that were successfully applied. + * + * @return the artifactsApplied value. + */ + public Integer artifactsApplied() { + return this.artifactsApplied; + } + + /** + * Set the artifactsApplied property: The total count of the artifacts that were successfully applied. + * + * @param artifactsApplied the artifactsApplied value to set. + * @return the ArtifactDeploymentStatusProperties object itself. + */ + public ArtifactDeploymentStatusProperties withArtifactsApplied(Integer artifactsApplied) { + this.artifactsApplied = artifactsApplied; + return this; + } + + /** + * Get the totalArtifacts property: The total count of the artifacts that were tentatively applied. + * + * @return the totalArtifacts value. + */ + public Integer totalArtifacts() { + return this.totalArtifacts; + } + + /** + * Set the totalArtifacts property: The total count of the artifacts that were tentatively applied. + * + * @param totalArtifacts the totalArtifacts value to set. + * @return the ArtifactDeploymentStatusProperties object itself. + */ + public ArtifactDeploymentStatusProperties withTotalArtifacts(Integer totalArtifacts) { + this.totalArtifacts = totalArtifacts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactInstallProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactInstallProperties.java new file mode 100644 index 000000000000..81ccc8711ca5 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactInstallProperties.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of an artifact. */ +@Fluent +public final class ArtifactInstallProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactInstallProperties.class); + + /* + * The artifact's identifier. + */ + @JsonProperty(value = "artifactId") + private String artifactId; + + /* + * The artifact's title. + */ + @JsonProperty(value = "artifactTitle") + private String artifactTitle; + + /* + * The parameters of the artifact. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /* + * The status of the artifact. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The status message from the deployment. + */ + @JsonProperty(value = "deploymentStatusMessage") + private String deploymentStatusMessage; + + /* + * The status message from the virtual machine extension. + */ + @JsonProperty(value = "vmExtensionStatusMessage") + private String vmExtensionStatusMessage; + + /* + * The time that the artifact starts to install on the virtual machine. + */ + @JsonProperty(value = "installTime") + private OffsetDateTime installTime; + + /** + * Get the artifactId property: The artifact's identifier. + * + * @return the artifactId value. + */ + public String artifactId() { + return this.artifactId; + } + + /** + * Set the artifactId property: The artifact's identifier. + * + * @param artifactId the artifactId value to set. + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withArtifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + /** + * Get the artifactTitle property: The artifact's title. + * + * @return the artifactTitle value. + */ + public String artifactTitle() { + return this.artifactTitle; + } + + /** + * Set the artifactTitle property: The artifact's title. + * + * @param artifactTitle the artifactTitle value to set. + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withArtifactTitle(String artifactTitle) { + this.artifactTitle = artifactTitle; + return this; + } + + /** + * Get the parameters property: The parameters of the artifact. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters of the artifact. + * + * @param parameters the parameters value to set. + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the status property: The status of the artifact. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the artifact. + * + * @param status the status value to set. + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the deploymentStatusMessage property: The status message from the deployment. + * + * @return the deploymentStatusMessage value. + */ + public String deploymentStatusMessage() { + return this.deploymentStatusMessage; + } + + /** + * Set the deploymentStatusMessage property: The status message from the deployment. + * + * @param deploymentStatusMessage the deploymentStatusMessage value to set. + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withDeploymentStatusMessage(String deploymentStatusMessage) { + this.deploymentStatusMessage = deploymentStatusMessage; + return this; + } + + /** + * Get the vmExtensionStatusMessage property: The status message from the virtual machine extension. + * + * @return the vmExtensionStatusMessage value. + */ + public String vmExtensionStatusMessage() { + return this.vmExtensionStatusMessage; + } + + /** + * Set the vmExtensionStatusMessage property: The status message from the virtual machine extension. + * + * @param vmExtensionStatusMessage the vmExtensionStatusMessage value to set. + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withVmExtensionStatusMessage(String vmExtensionStatusMessage) { + this.vmExtensionStatusMessage = vmExtensionStatusMessage; + return this; + } + + /** + * Get the installTime property: The time that the artifact starts to install on the virtual machine. + * + * @return the installTime value. + */ + public OffsetDateTime installTime() { + return this.installTime; + } + + /** + * Set the installTime property: The time that the artifact starts to install on the virtual machine. + * + * @param installTime the installTime value to set. + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withInstallTime(OffsetDateTime installTime) { + this.installTime = installTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parameters() != null) { + parameters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactList.java new file mode 100644 index 000000000000..8ff2c763013e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class ArtifactList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the ArtifactList object itself. + */ + public ArtifactList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ArtifactList object itself. + */ + public ArtifactList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactParameterProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactParameterProperties.java new file mode 100644 index 000000000000..e2be65b516f4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactParameterProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an artifact parameter. */ +@Fluent +public final class ArtifactParameterProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactParameterProperties.class); + + /* + * The name of the artifact parameter. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the artifact parameter. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the artifact parameter. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the artifact parameter. + * + * @param name the name value to set. + * @return the ArtifactParameterProperties object itself. + */ + public ArtifactParameterProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the artifact parameter. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the artifact parameter. + * + * @param value the value value to set. + * @return the ArtifactParameterProperties object itself. + */ + public ArtifactParameterProperties withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSource.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSource.java new file mode 100644 index 000000000000..d77896670881 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSource.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of ArtifactSource. */ +public interface ArtifactSource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the displayName property: The artifact source's display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the uri property: The artifact source's URI. + * + * @return the uri value. + */ + String uri(); + + /** + * Gets the sourceType property: The artifact source's type. + * + * @return the sourceType value. + */ + SourceControlType sourceType(); + + /** + * Gets the folderPath property: The folder containing artifacts. + * + * @return the folderPath value. + */ + String folderPath(); + + /** + * Gets the armTemplateFolderPath property: The folder containing Azure Resource Manager templates. + * + * @return the armTemplateFolderPath value. + */ + String armTemplateFolderPath(); + + /** + * Gets the branchRef property: The artifact source's branch reference. + * + * @return the branchRef value. + */ + String branchRef(); + + /** + * Gets the securityToken property: The security token to authenticate to the artifact source. + * + * @return the securityToken value. + */ + String securityToken(); + + /** + * Gets the status property: Indicates if the artifact source is enabled (values: Enabled, Disabled). + * + * @return the status value. + */ + EnableStatus status(); + + /** + * Gets the createdDate property: The artifact source's creation date. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner object. + * + * @return the inner object. + */ + ArtifactSourceInner innerModel(); + + /** The entirety of the ArtifactSource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The ArtifactSource definition stages. */ + interface DefinitionStages { + /** The first stage of the ArtifactSource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ArtifactSource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ArtifactSource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the ArtifactSource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDisplayName, + DefinitionStages.WithUri, + DefinitionStages.WithSourceType, + DefinitionStages.WithFolderPath, + DefinitionStages.WithArmTemplateFolderPath, + DefinitionStages.WithBranchRef, + DefinitionStages.WithSecurityToken, + DefinitionStages.WithStatus { + /** + * Executes the create request. + * + * @return the created resource. + */ + ArtifactSource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ArtifactSource create(Context context); + } + /** The stage of the ArtifactSource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ArtifactSource definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The artifact source's display name.. + * + * @param displayName The artifact source's display name. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the ArtifactSource definition allowing to specify uri. */ + interface WithUri { + /** + * Specifies the uri property: The artifact source's URI.. + * + * @param uri The artifact source's URI. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + /** The stage of the ArtifactSource definition allowing to specify sourceType. */ + interface WithSourceType { + /** + * Specifies the sourceType property: The artifact source's type.. + * + * @param sourceType The artifact source's type. + * @return the next definition stage. + */ + WithCreate withSourceType(SourceControlType sourceType); + } + /** The stage of the ArtifactSource definition allowing to specify folderPath. */ + interface WithFolderPath { + /** + * Specifies the folderPath property: The folder containing artifacts.. + * + * @param folderPath The folder containing artifacts. + * @return the next definition stage. + */ + WithCreate withFolderPath(String folderPath); + } + /** The stage of the ArtifactSource definition allowing to specify armTemplateFolderPath. */ + interface WithArmTemplateFolderPath { + /** + * Specifies the armTemplateFolderPath property: The folder containing Azure Resource Manager templates.. + * + * @param armTemplateFolderPath The folder containing Azure Resource Manager templates. + * @return the next definition stage. + */ + WithCreate withArmTemplateFolderPath(String armTemplateFolderPath); + } + /** The stage of the ArtifactSource definition allowing to specify branchRef. */ + interface WithBranchRef { + /** + * Specifies the branchRef property: The artifact source's branch reference.. + * + * @param branchRef The artifact source's branch reference. + * @return the next definition stage. + */ + WithCreate withBranchRef(String branchRef); + } + /** The stage of the ArtifactSource definition allowing to specify securityToken. */ + interface WithSecurityToken { + /** + * Specifies the securityToken property: The security token to authenticate to the artifact source.. + * + * @param securityToken The security token to authenticate to the artifact source. + * @return the next definition stage. + */ + WithCreate withSecurityToken(String securityToken); + } + /** The stage of the ArtifactSource definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: Indicates if the artifact source is enabled (values: Enabled, Disabled).. + * + * @param status Indicates if the artifact source is enabled (values: Enabled, Disabled). + * @return the next definition stage. + */ + WithCreate withStatus(EnableStatus status); + } + } + /** + * Begins update for the ArtifactSource resource. + * + * @return the stage of resource update. + */ + ArtifactSource.Update update(); + + /** The template for ArtifactSource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ArtifactSource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ArtifactSource apply(Context context); + } + /** The ArtifactSource update stages. */ + interface UpdateStages { + /** The stage of the ArtifactSource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ArtifactSource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ArtifactSource refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceFragment.java new file mode 100644 index 000000000000..3f85e8bbbb64 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** Properties of an artifact source. */ +@Immutable +public final class ArtifactSourceFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourceFragment.class); + + /** {@inheritDoc} */ + @Override + public ArtifactSourceFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceList.java new file mode 100644 index 000000000000..f804d23214fd --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSourceList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.ArtifactSourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class ArtifactSourceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourceList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the ArtifactSourceList object itself. + */ + public ArtifactSourceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ArtifactSourceList object itself. + */ + public ArtifactSourceList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSources.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSources.java new file mode 100644 index 000000000000..bce949b8b16c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ArtifactSources.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ArtifactSources. */ +public interface ArtifactSources { + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + ArtifactSource get(String resourceGroupName, String labName, String name); + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Get artifact source. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + ArtifactSource getById(String id); + + /** + * Get artifact source. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact source. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete artifact source. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete artifact source. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ArtifactSource resource. + * + * @param name resource name. + * @return the first stage of the new ArtifactSource definition. + */ + ArtifactSource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifacts.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifacts.java new file mode 100644 index 000000000000..ab048bf73dbe --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Artifacts.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Artifacts. */ +public interface Artifacts { + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String artifactSourceName); + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String artifactSourceName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + Artifact get(String resourceGroupName, String labName, String artifactSourceName, String name); + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param expand Specify the $expand query. Example: 'properties($select=title)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return artifact. + */ + Response getWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + String expand, + Context context); + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + ArmTemplateInfo generateArmTemplate( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest); + + /** + * Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates + * the generated artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param generateArmTemplateRequest Parameters for generating an ARM template for deploying artifacts. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a generated ARM template. + */ + Response generateArmTemplateWithResponse( + String resourceGroupName, + String labName, + String artifactSourceName, + String name, + GenerateArmTemplateRequest generateArmTemplateRequest, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachDiskProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachDiskProperties.java new file mode 100644 index 000000000000..7e762cfbd61d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachDiskProperties.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the disk to attach. */ +@Fluent +public final class AttachDiskProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttachDiskProperties.class); + + /* + * The resource ID of the Lab virtual machine to which the disk is + * attached. + */ + @JsonProperty(value = "leasedByLabVmId") + private String leasedByLabVmId; + + /** + * Get the leasedByLabVmId property: The resource ID of the Lab virtual machine to which the disk is attached. + * + * @return the leasedByLabVmId value. + */ + public String leasedByLabVmId() { + return this.leasedByLabVmId; + } + + /** + * Set the leasedByLabVmId property: The resource ID of the Lab virtual machine to which the disk is attached. + * + * @param leasedByLabVmId the leasedByLabVmId value to set. + * @return the AttachDiskProperties object itself. + */ + public AttachDiskProperties withLeasedByLabVmId(String leasedByLabVmId) { + this.leasedByLabVmId = leasedByLabVmId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachNewDataDiskOptions.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachNewDataDiskOptions.java new file mode 100644 index 000000000000..5670c4db1df8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/AttachNewDataDiskOptions.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties to attach new disk to the Virtual Machine. */ +@Fluent +public final class AttachNewDataDiskOptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttachNewDataDiskOptions.class); + + /* + * Size of the disk to be attached in Gibibytes. + */ + @JsonProperty(value = "diskSizeGiB") + private Integer diskSizeGiB; + + /* + * The name of the disk to be attached. + */ + @JsonProperty(value = "diskName") + private String diskName; + + /* + * The storage type for the disk (i.e. Standard, Premium). + */ + @JsonProperty(value = "diskType") + private StorageType diskType; + + /** + * Get the diskSizeGiB property: Size of the disk to be attached in Gibibytes. + * + * @return the diskSizeGiB value. + */ + public Integer diskSizeGiB() { + return this.diskSizeGiB; + } + + /** + * Set the diskSizeGiB property: Size of the disk to be attached in Gibibytes. + * + * @param diskSizeGiB the diskSizeGiB value to set. + * @return the AttachNewDataDiskOptions object itself. + */ + public AttachNewDataDiskOptions withDiskSizeGiB(Integer diskSizeGiB) { + this.diskSizeGiB = diskSizeGiB; + return this; + } + + /** + * Get the diskName property: The name of the disk to be attached. + * + * @return the diskName value. + */ + public String diskName() { + return this.diskName; + } + + /** + * Set the diskName property: The name of the disk to be attached. + * + * @param diskName the diskName value to set. + * @return the AttachNewDataDiskOptions object itself. + */ + public AttachNewDataDiskOptions withDiskName(String diskName) { + this.diskName = diskName; + return this; + } + + /** + * Get the diskType property: The storage type for the disk (i.e. Standard, Premium). + * + * @return the diskType value. + */ + public StorageType diskType() { + return this.diskType; + } + + /** + * Set the diskType property: The storage type for the disk (i.e. Standard, Premium). + * + * @param diskType the diskType value to set. + * @return the AttachNewDataDiskOptions object itself. + */ + public AttachNewDataDiskOptions withDiskType(StorageType diskType) { + this.diskType = diskType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/BulkCreationParameters.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/BulkCreationParameters.java new file mode 100644 index 000000000000..a6e65e513300 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/BulkCreationParameters.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Parameters for creating multiple virtual machines as a single action. */ +@Fluent +public final class BulkCreationParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BulkCreationParameters.class); + + /* + * The number of virtual machine instances to create. + */ + @JsonProperty(value = "instanceCount") + private Integer instanceCount; + + /** + * Get the instanceCount property: The number of virtual machine instances to create. + * + * @return the instanceCount value. + */ + public Integer instanceCount() { + return this.instanceCount; + } + + /** + * Set the instanceCount property: The number of virtual machine instances to create. + * + * @param instanceCount the instanceCount value to set. + * @return the BulkCreationParameters object itself. + */ + public BulkCreationParameters withInstanceCount(Integer instanceCount) { + this.instanceCount = instanceCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeDataDisk.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeDataDisk.java new file mode 100644 index 000000000000..885b06b07d96 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeDataDisk.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A data disks attached to a virtual machine. */ +@Fluent +public final class ComputeDataDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComputeDataDisk.class); + + /* + * Gets data disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * When backed by a blob, the URI of underlying blob. + */ + @JsonProperty(value = "diskUri") + private String diskUri; + + /* + * When backed by managed disk, this is the ID of the compute disk + * resource. + */ + @JsonProperty(value = "managedDiskId") + private String managedDiskId; + + /* + * Gets data disk size in GiB. + */ + @JsonProperty(value = "diskSizeGiB") + private Integer diskSizeGiB; + + /** + * Get the name property: Gets data disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets data disk name. + * + * @param name the name value to set. + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the diskUri property: When backed by a blob, the URI of underlying blob. + * + * @return the diskUri value. + */ + public String diskUri() { + return this.diskUri; + } + + /** + * Set the diskUri property: When backed by a blob, the URI of underlying blob. + * + * @param diskUri the diskUri value to set. + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withDiskUri(String diskUri) { + this.diskUri = diskUri; + return this; + } + + /** + * Get the managedDiskId property: When backed by managed disk, this is the ID of the compute disk resource. + * + * @return the managedDiskId value. + */ + public String managedDiskId() { + return this.managedDiskId; + } + + /** + * Set the managedDiskId property: When backed by managed disk, this is the ID of the compute disk resource. + * + * @param managedDiskId the managedDiskId value to set. + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withManagedDiskId(String managedDiskId) { + this.managedDiskId = managedDiskId; + return this; + } + + /** + * Get the diskSizeGiB property: Gets data disk size in GiB. + * + * @return the diskSizeGiB value. + */ + public Integer diskSizeGiB() { + return this.diskSizeGiB; + } + + /** + * Set the diskSizeGiB property: Gets data disk size in GiB. + * + * @param diskSizeGiB the diskSizeGiB value to set. + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withDiskSizeGiB(Integer diskSizeGiB) { + this.diskSizeGiB = diskSizeGiB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmInstanceViewStatus.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmInstanceViewStatus.java new file mode 100644 index 000000000000..80018920925e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmInstanceViewStatus.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Status information about a virtual machine. */ +@Fluent +public final class ComputeVmInstanceViewStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComputeVmInstanceViewStatus.class); + + /* + * Gets the status Code. + */ + @JsonProperty(value = "code") + private String code; + + /* + * Gets the short localizable label for the status. + */ + @JsonProperty(value = "displayStatus") + private String displayStatus; + + /* + * Gets the message associated with the status. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: Gets the status Code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Gets the status Code. + * + * @param code the code value to set. + * @return the ComputeVmInstanceViewStatus object itself. + */ + public ComputeVmInstanceViewStatus withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the displayStatus property: Gets the short localizable label for the status. + * + * @return the displayStatus value. + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Set the displayStatus property: Gets the short localizable label for the status. + * + * @param displayStatus the displayStatus value to set. + * @return the ComputeVmInstanceViewStatus object itself. + */ + public ComputeVmInstanceViewStatus withDisplayStatus(String displayStatus) { + this.displayStatus = displayStatus; + return this; + } + + /** + * Get the message property: Gets the message associated with the status. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Gets the message associated with the status. + * + * @param message the message value to set. + * @return the ComputeVmInstanceViewStatus object itself. + */ + public ComputeVmInstanceViewStatus withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmProperties.java new file mode 100644 index 000000000000..fe66c661f455 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ComputeVmProperties.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a virtual machine returned by the Microsoft.Compute API. */ +@Fluent +public final class ComputeVmProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComputeVmProperties.class); + + /* + * Gets the statuses of the virtual machine. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /* + * Gets the OS type of the virtual machine. + */ + @JsonProperty(value = "osType") + private String osType; + + /* + * Gets the size of the virtual machine. + */ + @JsonProperty(value = "vmSize") + private String vmSize; + + /* + * Gets the network interface ID of the virtual machine. + */ + @JsonProperty(value = "networkInterfaceId") + private String networkInterfaceId; + + /* + * Gets OS disk blob uri for the virtual machine. + */ + @JsonProperty(value = "osDiskId") + private String osDiskId; + + /* + * Gets data disks blob uri for the virtual machine. + */ + @JsonProperty(value = "dataDiskIds") + private List dataDiskIds; + + /* + * Gets all data disks attached to the virtual machine. + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * Get the statuses property: Gets the statuses of the virtual machine. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: Gets the statuses of the virtual machine. + * + * @param statuses the statuses value to set. + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Get the osType property: Gets the OS type of the virtual machine. + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Set the osType property: Gets the OS type of the virtual machine. + * + * @param osType the osType value to set. + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withOsType(String osType) { + this.osType = osType; + return this; + } + + /** + * Get the vmSize property: Gets the size of the virtual machine. + * + * @return the vmSize value. + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set the vmSize property: Gets the size of the virtual machine. + * + * @param vmSize the vmSize value to set. + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the networkInterfaceId property: Gets the network interface ID of the virtual machine. + * + * @return the networkInterfaceId value. + */ + public String networkInterfaceId() { + return this.networkInterfaceId; + } + + /** + * Set the networkInterfaceId property: Gets the network interface ID of the virtual machine. + * + * @param networkInterfaceId the networkInterfaceId value to set. + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withNetworkInterfaceId(String networkInterfaceId) { + this.networkInterfaceId = networkInterfaceId; + return this; + } + + /** + * Get the osDiskId property: Gets OS disk blob uri for the virtual machine. + * + * @return the osDiskId value. + */ + public String osDiskId() { + return this.osDiskId; + } + + /** + * Set the osDiskId property: Gets OS disk blob uri for the virtual machine. + * + * @param osDiskId the osDiskId value to set. + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withOsDiskId(String osDiskId) { + this.osDiskId = osDiskId; + return this; + } + + /** + * Get the dataDiskIds property: Gets data disks blob uri for the virtual machine. + * + * @return the dataDiskIds value. + */ + public List dataDiskIds() { + return this.dataDiskIds; + } + + /** + * Set the dataDiskIds property: Gets data disks blob uri for the virtual machine. + * + * @param dataDiskIds the dataDiskIds value to set. + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withDataDiskIds(List dataDiskIds) { + this.dataDiskIds = dataDiskIds; + return this; + } + + /** + * Get the dataDisks property: Gets all data disks attached to the virtual machine. + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: Gets all data disks attached to the virtual machine. + * + * @param dataDisks the dataDisks value to set. + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdProperties.java new file mode 100644 index 000000000000..05a8fdc9adbc --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdProperties.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a cost threshold item. */ +@Fluent +public final class CostThresholdProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CostThresholdProperties.class); + + /* + * The ID of the cost threshold item. + */ + @JsonProperty(value = "thresholdId") + private String thresholdId; + + /* + * The value of the percentage cost threshold. + */ + @JsonProperty(value = "percentageThreshold") + private PercentageCostThresholdProperties percentageThreshold; + + /* + * Indicates whether this threshold will be displayed on cost charts. + */ + @JsonProperty(value = "displayOnChart") + private CostThresholdStatus displayOnChart; + + /* + * Indicates whether notifications will be sent when this threshold is + * exceeded. + */ + @JsonProperty(value = "sendNotificationWhenExceeded") + private CostThresholdStatus sendNotificationWhenExceeded; + + /* + * Indicates the datetime when notifications were last sent for this + * threshold. + */ + @JsonProperty(value = "notificationSent") + private String notificationSent; + + /** + * Get the thresholdId property: The ID of the cost threshold item. + * + * @return the thresholdId value. + */ + public String thresholdId() { + return this.thresholdId; + } + + /** + * Set the thresholdId property: The ID of the cost threshold item. + * + * @param thresholdId the thresholdId value to set. + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withThresholdId(String thresholdId) { + this.thresholdId = thresholdId; + return this; + } + + /** + * Get the percentageThreshold property: The value of the percentage cost threshold. + * + * @return the percentageThreshold value. + */ + public PercentageCostThresholdProperties percentageThreshold() { + return this.percentageThreshold; + } + + /** + * Set the percentageThreshold property: The value of the percentage cost threshold. + * + * @param percentageThreshold the percentageThreshold value to set. + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withPercentageThreshold(PercentageCostThresholdProperties percentageThreshold) { + this.percentageThreshold = percentageThreshold; + return this; + } + + /** + * Get the displayOnChart property: Indicates whether this threshold will be displayed on cost charts. + * + * @return the displayOnChart value. + */ + public CostThresholdStatus displayOnChart() { + return this.displayOnChart; + } + + /** + * Set the displayOnChart property: Indicates whether this threshold will be displayed on cost charts. + * + * @param displayOnChart the displayOnChart value to set. + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withDisplayOnChart(CostThresholdStatus displayOnChart) { + this.displayOnChart = displayOnChart; + return this; + } + + /** + * Get the sendNotificationWhenExceeded property: Indicates whether notifications will be sent when this threshold + * is exceeded. + * + * @return the sendNotificationWhenExceeded value. + */ + public CostThresholdStatus sendNotificationWhenExceeded() { + return this.sendNotificationWhenExceeded; + } + + /** + * Set the sendNotificationWhenExceeded property: Indicates whether notifications will be sent when this threshold + * is exceeded. + * + * @param sendNotificationWhenExceeded the sendNotificationWhenExceeded value to set. + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withSendNotificationWhenExceeded(CostThresholdStatus sendNotificationWhenExceeded) { + this.sendNotificationWhenExceeded = sendNotificationWhenExceeded; + return this; + } + + /** + * Get the notificationSent property: Indicates the datetime when notifications were last sent for this threshold. + * + * @return the notificationSent value. + */ + public String notificationSent() { + return this.notificationSent; + } + + /** + * Set the notificationSent property: Indicates the datetime when notifications were last sent for this threshold. + * + * @param notificationSent the notificationSent value to set. + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withNotificationSent(String notificationSent) { + this.notificationSent = notificationSent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (percentageThreshold() != null) { + percentageThreshold().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdStatus.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdStatus.java new file mode 100644 index 000000000000..9c920398d66d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostThresholdStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CostThresholdStatus. */ +public final class CostThresholdStatus extends ExpandableStringEnum { + /** Static value Enabled for CostThresholdStatus. */ + public static final CostThresholdStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for CostThresholdStatus. */ + public static final CostThresholdStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a CostThresholdStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding CostThresholdStatus. + */ + @JsonCreator + public static CostThresholdStatus fromString(String name) { + return fromString(name, CostThresholdStatus.class); + } + + /** @return known CostThresholdStatus values. */ + public static Collection values() { + return values(CostThresholdStatus.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostType.java new file mode 100644 index 000000000000..6ce31c633da0 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CostType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CostType. */ +public final class CostType extends ExpandableStringEnum { + /** Static value Unavailable for CostType. */ + public static final CostType UNAVAILABLE = fromString("Unavailable"); + + /** Static value Reported for CostType. */ + public static final CostType REPORTED = fromString("Reported"); + + /** Static value Projected for CostType. */ + public static final CostType PROJECTED = fromString("Projected"); + + /** + * Creates or finds a CostType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CostType. + */ + @JsonCreator + public static CostType fromString(String name) { + return fromString(name, CostType.class); + } + + /** @return known CostType values. */ + public static Collection values() { + return values(CostType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Costs.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Costs.java new file mode 100644 index 000000000000..1f341bab73ac --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Costs.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Costs. */ +public interface Costs { + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + LabCost get(String resourceGroupName, String labName, String name); + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Get cost. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + LabCost getById(String id); + + /** + * Get cost. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return cost. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Begins definition for a new LabCost resource. + * + * @param name resource name. + * @return the first stage of the new LabCost definition. + */ + LabCost.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImage.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImage.java new file mode 100644 index 000000000000..8f0f7c9e469a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImage.java @@ -0,0 +1,383 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.CustomImageInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of CustomImage. */ +public interface CustomImage { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the vm property: The virtual machine from which the image is to be created. + * + * @return the vm value. + */ + CustomImagePropertiesFromVm vm(); + + /** + * Gets the vhd property: The VHD from which the image is to be created. + * + * @return the vhd value. + */ + CustomImagePropertiesCustom vhd(); + + /** + * Gets the description property: The description of the custom image. + * + * @return the description value. + */ + String description(); + + /** + * Gets the author property: The author of the custom image. + * + * @return the author value. + */ + String author(); + + /** + * Gets the creationDate property: The creation date of the custom image. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the managedImageId property: The Managed Image Id backing the custom image. + * + * @return the managedImageId value. + */ + String managedImageId(); + + /** + * Gets the managedSnapshotId property: The Managed Snapshot Id backing the custom image. + * + * @return the managedSnapshotId value. + */ + String managedSnapshotId(); + + /** + * Gets the dataDiskStorageInfo property: Storage information about the data disks present in the custom image. + * + * @return the dataDiskStorageInfo value. + */ + List dataDiskStorageInfo(); + + /** + * Gets the customImagePlan property: Storage information about the plan related to this custom image. + * + * @return the customImagePlan value. + */ + CustomImagePropertiesFromPlan customImagePlan(); + + /** + * Gets the isPlanAuthorized property: Whether or not the custom images underlying offer/plan has been enabled for + * programmatic deployment. + * + * @return the isPlanAuthorized value. + */ + Boolean isPlanAuthorized(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.CustomImageInner object. + * + * @return the inner object. + */ + CustomImageInner innerModel(); + + /** The entirety of the CustomImage definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The CustomImage definition stages. */ + interface DefinitionStages { + /** The first stage of the CustomImage definition. */ + interface Blank extends WithLocation { + } + /** The stage of the CustomImage definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the CustomImage definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the CustomImage definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithVm, + DefinitionStages.WithVhd, + DefinitionStages.WithDescription, + DefinitionStages.WithAuthor, + DefinitionStages.WithManagedImageId, + DefinitionStages.WithManagedSnapshotId, + DefinitionStages.WithDataDiskStorageInfo, + DefinitionStages.WithCustomImagePlan, + DefinitionStages.WithIsPlanAuthorized { + /** + * Executes the create request. + * + * @return the created resource. + */ + CustomImage create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CustomImage create(Context context); + } + /** The stage of the CustomImage definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the CustomImage definition allowing to specify vm. */ + interface WithVm { + /** + * Specifies the vm property: The virtual machine from which the image is to be created.. + * + * @param vm The virtual machine from which the image is to be created. + * @return the next definition stage. + */ + WithCreate withVm(CustomImagePropertiesFromVm vm); + } + /** The stage of the CustomImage definition allowing to specify vhd. */ + interface WithVhd { + /** + * Specifies the vhd property: The VHD from which the image is to be created.. + * + * @param vhd The VHD from which the image is to be created. + * @return the next definition stage. + */ + WithCreate withVhd(CustomImagePropertiesCustom vhd); + } + /** The stage of the CustomImage definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the custom image.. + * + * @param description The description of the custom image. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the CustomImage definition allowing to specify author. */ + interface WithAuthor { + /** + * Specifies the author property: The author of the custom image.. + * + * @param author The author of the custom image. + * @return the next definition stage. + */ + WithCreate withAuthor(String author); + } + /** The stage of the CustomImage definition allowing to specify managedImageId. */ + interface WithManagedImageId { + /** + * Specifies the managedImageId property: The Managed Image Id backing the custom image.. + * + * @param managedImageId The Managed Image Id backing the custom image. + * @return the next definition stage. + */ + WithCreate withManagedImageId(String managedImageId); + } + /** The stage of the CustomImage definition allowing to specify managedSnapshotId. */ + interface WithManagedSnapshotId { + /** + * Specifies the managedSnapshotId property: The Managed Snapshot Id backing the custom image.. + * + * @param managedSnapshotId The Managed Snapshot Id backing the custom image. + * @return the next definition stage. + */ + WithCreate withManagedSnapshotId(String managedSnapshotId); + } + /** The stage of the CustomImage definition allowing to specify dataDiskStorageInfo. */ + interface WithDataDiskStorageInfo { + /** + * Specifies the dataDiskStorageInfo property: Storage information about the data disks present in the + * custom image. + * + * @param dataDiskStorageInfo Storage information about the data disks present in the custom image. + * @return the next definition stage. + */ + WithCreate withDataDiskStorageInfo(List dataDiskStorageInfo); + } + /** The stage of the CustomImage definition allowing to specify customImagePlan. */ + interface WithCustomImagePlan { + /** + * Specifies the customImagePlan property: Storage information about the plan related to this custom image. + * + * @param customImagePlan Storage information about the plan related to this custom image. + * @return the next definition stage. + */ + WithCreate withCustomImagePlan(CustomImagePropertiesFromPlan customImagePlan); + } + /** The stage of the CustomImage definition allowing to specify isPlanAuthorized. */ + interface WithIsPlanAuthorized { + /** + * Specifies the isPlanAuthorized property: Whether or not the custom images underlying offer/plan has been + * enabled for programmatic deployment. + * + * @param isPlanAuthorized Whether or not the custom images underlying offer/plan has been enabled for + * programmatic deployment. + * @return the next definition stage. + */ + WithCreate withIsPlanAuthorized(Boolean isPlanAuthorized); + } + } + /** + * Begins update for the CustomImage resource. + * + * @return the stage of resource update. + */ + CustomImage.Update update(); + + /** The template for CustomImage update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CustomImage apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CustomImage apply(Context context); + } + /** The CustomImage update stages. */ + interface UpdateStages { + /** The stage of the CustomImage update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CustomImage refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CustomImage refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageFragment.java new file mode 100644 index 000000000000..d4cf59c9c3ee --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A custom image. */ +@Immutable +public final class CustomImageFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomImageFragment.class); + + /** {@inheritDoc} */ + @Override + public CustomImageFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageList.java new file mode 100644 index 000000000000..b8dc4ec94f93 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.CustomImageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class CustomImageList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomImageList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the CustomImageList object itself. + */ + public CustomImageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the CustomImageList object itself. + */ + public CustomImageList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageOsType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageOsType.java new file mode 100644 index 000000000000..a8828d78c2a1 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImageOsType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CustomImageOsType. */ +public final class CustomImageOsType extends ExpandableStringEnum { + /** Static value Windows for CustomImageOsType. */ + public static final CustomImageOsType WINDOWS = fromString("Windows"); + + /** Static value Linux for CustomImageOsType. */ + public static final CustomImageOsType LINUX = fromString("Linux"); + + /** Static value None for CustomImageOsType. */ + public static final CustomImageOsType NONE = fromString("None"); + + /** + * Creates or finds a CustomImageOsType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CustomImageOsType. + */ + @JsonCreator + public static CustomImageOsType fromString(String name) { + return fromString(name, CustomImageOsType.class); + } + + /** @return known CustomImageOsType values. */ + public static Collection values() { + return values(CustomImageOsType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesCustom.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesCustom.java new file mode 100644 index 000000000000..50c6747c88f4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesCustom.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for creating a custom image from a VHD. */ +@Fluent +public final class CustomImagePropertiesCustom { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomImagePropertiesCustom.class); + + /* + * The image name. + */ + @JsonProperty(value = "imageName") + private String imageName; + + /* + * Indicates whether sysprep has been run on the VHD. + */ + @JsonProperty(value = "sysPrep") + private Boolean sysPrep; + + /* + * The OS type of the custom image (i.e. Windows, Linux) + */ + @JsonProperty(value = "osType", required = true) + private CustomImageOsType osType; + + /** + * Get the imageName property: The image name. + * + * @return the imageName value. + */ + public String imageName() { + return this.imageName; + } + + /** + * Set the imageName property: The image name. + * + * @param imageName the imageName value to set. + * @return the CustomImagePropertiesCustom object itself. + */ + public CustomImagePropertiesCustom withImageName(String imageName) { + this.imageName = imageName; + return this; + } + + /** + * Get the sysPrep property: Indicates whether sysprep has been run on the VHD. + * + * @return the sysPrep value. + */ + public Boolean sysPrep() { + return this.sysPrep; + } + + /** + * Set the sysPrep property: Indicates whether sysprep has been run on the VHD. + * + * @param sysPrep the sysPrep value to set. + * @return the CustomImagePropertiesCustom object itself. + */ + public CustomImagePropertiesCustom withSysPrep(Boolean sysPrep) { + this.sysPrep = sysPrep; + return this; + } + + /** + * Get the osType property: The OS type of the custom image (i.e. Windows, Linux). + * + * @return the osType value. + */ + public CustomImageOsType osType() { + return this.osType; + } + + /** + * Set the osType property: The OS type of the custom image (i.e. Windows, Linux). + * + * @param osType the osType value to set. + * @return the CustomImagePropertiesCustom object itself. + */ + public CustomImagePropertiesCustom withOsType(CustomImageOsType osType) { + this.osType = osType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osType in model CustomImagePropertiesCustom")); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromPlan.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromPlan.java new file mode 100644 index 000000000000..10542dff3d5a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromPlan.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for plan on a custom image. */ +@Fluent +public final class CustomImagePropertiesFromPlan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomImagePropertiesFromPlan.class); + + /* + * The id of the plan, equivalent to name of the plan + */ + @JsonProperty(value = "id") + private String id; + + /* + * The publisher for the plan from the marketplace image the custom image + * is derived from + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * The offer for the plan from the marketplace image the custom image is + * derived from + */ + @JsonProperty(value = "offer") + private String offer; + + /** + * Get the id property: The id of the plan, equivalent to name of the plan. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The id of the plan, equivalent to name of the plan. + * + * @param id the id value to set. + * @return the CustomImagePropertiesFromPlan object itself. + */ + public CustomImagePropertiesFromPlan withId(String id) { + this.id = id; + return this; + } + + /** + * Get the publisher property: The publisher for the plan from the marketplace image the custom image is derived + * from. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher for the plan from the marketplace image the custom image is derived + * from. + * + * @param publisher the publisher value to set. + * @return the CustomImagePropertiesFromPlan object itself. + */ + public CustomImagePropertiesFromPlan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer property: The offer for the plan from the marketplace image the custom image is derived from. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: The offer for the plan from the marketplace image the custom image is derived from. + * + * @param offer the offer value to set. + * @return the CustomImagePropertiesFromPlan object itself. + */ + public CustomImagePropertiesFromPlan withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromVm.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromVm.java new file mode 100644 index 000000000000..8817df65562b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImagePropertiesFromVm.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for creating a custom image from a virtual machine. */ +@Fluent +public final class CustomImagePropertiesFromVm { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomImagePropertiesFromVm.class); + + /* + * The source vm identifier. + */ + @JsonProperty(value = "sourceVmId") + private String sourceVmId; + + /* + * The Windows OS information of the VM. + */ + @JsonProperty(value = "windowsOsInfo") + private WindowsOsInfo windowsOsInfo; + + /* + * The Linux OS information of the VM. + */ + @JsonProperty(value = "linuxOsInfo") + private LinuxOsInfo linuxOsInfo; + + /** + * Get the sourceVmId property: The source vm identifier. + * + * @return the sourceVmId value. + */ + public String sourceVmId() { + return this.sourceVmId; + } + + /** + * Set the sourceVmId property: The source vm identifier. + * + * @param sourceVmId the sourceVmId value to set. + * @return the CustomImagePropertiesFromVm object itself. + */ + public CustomImagePropertiesFromVm withSourceVmId(String sourceVmId) { + this.sourceVmId = sourceVmId; + return this; + } + + /** + * Get the windowsOsInfo property: The Windows OS information of the VM. + * + * @return the windowsOsInfo value. + */ + public WindowsOsInfo windowsOsInfo() { + return this.windowsOsInfo; + } + + /** + * Set the windowsOsInfo property: The Windows OS information of the VM. + * + * @param windowsOsInfo the windowsOsInfo value to set. + * @return the CustomImagePropertiesFromVm object itself. + */ + public CustomImagePropertiesFromVm withWindowsOsInfo(WindowsOsInfo windowsOsInfo) { + this.windowsOsInfo = windowsOsInfo; + return this; + } + + /** + * Get the linuxOsInfo property: The Linux OS information of the VM. + * + * @return the linuxOsInfo value. + */ + public LinuxOsInfo linuxOsInfo() { + return this.linuxOsInfo; + } + + /** + * Set the linuxOsInfo property: The Linux OS information of the VM. + * + * @param linuxOsInfo the linuxOsInfo value to set. + * @return the CustomImagePropertiesFromVm object itself. + */ + public CustomImagePropertiesFromVm withLinuxOsInfo(LinuxOsInfo linuxOsInfo) { + this.linuxOsInfo = linuxOsInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (windowsOsInfo() != null) { + windowsOsInfo().validate(); + } + if (linuxOsInfo() != null) { + linuxOsInfo().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImages.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImages.java new file mode 100644 index 000000000000..8b395310c03c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/CustomImages.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CustomImages. */ +public interface CustomImages { + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + CustomImage get(String resourceGroupName, String labName, String name); + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Get custom image. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + CustomImage getById(String id); + + /** + * Get custom image. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=vm)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return custom image. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete custom image. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CustomImage resource. + * + * @param name resource name. + * @return the first stage of the new CustomImage definition. + */ + CustomImage.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskProperties.java new file mode 100644 index 000000000000..ff5a950e946e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskProperties.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request body for adding a new or existing data disk to a virtual machine. */ +@Fluent +public final class DataDiskProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataDiskProperties.class); + + /* + * Specifies options to attach a new disk to the virtual machine. + */ + @JsonProperty(value = "attachNewDataDiskOptions") + private AttachNewDataDiskOptions attachNewDataDiskOptions; + + /* + * Specifies the existing lab disk id to attach to virtual machine. + */ + @JsonProperty(value = "existingLabDiskId") + private String existingLabDiskId; + + /* + * Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). + */ + @JsonProperty(value = "hostCaching") + private HostCachingOptions hostCaching; + + /** + * Get the attachNewDataDiskOptions property: Specifies options to attach a new disk to the virtual machine. + * + * @return the attachNewDataDiskOptions value. + */ + public AttachNewDataDiskOptions attachNewDataDiskOptions() { + return this.attachNewDataDiskOptions; + } + + /** + * Set the attachNewDataDiskOptions property: Specifies options to attach a new disk to the virtual machine. + * + * @param attachNewDataDiskOptions the attachNewDataDiskOptions value to set. + * @return the DataDiskProperties object itself. + */ + public DataDiskProperties withAttachNewDataDiskOptions(AttachNewDataDiskOptions attachNewDataDiskOptions) { + this.attachNewDataDiskOptions = attachNewDataDiskOptions; + return this; + } + + /** + * Get the existingLabDiskId property: Specifies the existing lab disk id to attach to virtual machine. + * + * @return the existingLabDiskId value. + */ + public String existingLabDiskId() { + return this.existingLabDiskId; + } + + /** + * Set the existingLabDiskId property: Specifies the existing lab disk id to attach to virtual machine. + * + * @param existingLabDiskId the existingLabDiskId value to set. + * @return the DataDiskProperties object itself. + */ + public DataDiskProperties withExistingLabDiskId(String existingLabDiskId) { + this.existingLabDiskId = existingLabDiskId; + return this; + } + + /** + * Get the hostCaching property: Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). + * + * @return the hostCaching value. + */ + public HostCachingOptions hostCaching() { + return this.hostCaching; + } + + /** + * Set the hostCaching property: Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). + * + * @param hostCaching the hostCaching value to set. + * @return the DataDiskProperties object itself. + */ + public DataDiskProperties withHostCaching(HostCachingOptions hostCaching) { + this.hostCaching = hostCaching; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (attachNewDataDiskOptions() != null) { + attachNewDataDiskOptions().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskStorageTypeInfo.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskStorageTypeInfo.java new file mode 100644 index 000000000000..c340fb0760d3 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DataDiskStorageTypeInfo.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Storage information about the data disks present in the custom image. */ +@Fluent +public final class DataDiskStorageTypeInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataDiskStorageTypeInfo.class); + + /* + * Disk Lun + */ + @JsonProperty(value = "lun") + private String lun; + + /* + * Disk Storage Type + */ + @JsonProperty(value = "storageType") + private StorageType storageType; + + /** + * Get the lun property: Disk Lun. + * + * @return the lun value. + */ + public String lun() { + return this.lun; + } + + /** + * Set the lun property: Disk Lun. + * + * @param lun the lun value to set. + * @return the DataDiskStorageTypeInfo object itself. + */ + public DataDiskStorageTypeInfo withLun(String lun) { + this.lun = lun; + return this; + } + + /** + * Get the storageType property: Disk Storage Type. + * + * @return the storageType value. + */ + public StorageType storageType() { + return this.storageType; + } + + /** + * Set the storageType property: Disk Storage Type. + * + * @param storageType the storageType value to set. + * @return the DataDiskStorageTypeInfo object itself. + */ + public DataDiskStorageTypeInfo withStorageType(StorageType storageType) { + this.storageType = storageType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DayDetails.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DayDetails.java new file mode 100644 index 000000000000..7341b2a692ee --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DayDetails.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a daily schedule. */ +@Fluent +public final class DayDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DayDetails.class); + + /* + * The time of day the schedule will occur. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the time property: The time of day the schedule will occur. + * + * @return the time value. + */ + public String time() { + return this.time; + } + + /** + * Set the time property: The time of day the schedule will occur. + * + * @param time the time value to set. + * @return the DayDetails object itself. + */ + public DayDetails withTime(String time) { + this.time = time; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDataDiskProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDataDiskProperties.java new file mode 100644 index 000000000000..4a551226a759 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDataDiskProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request body for detaching data disk from a virtual machine. */ +@Fluent +public final class DetachDataDiskProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DetachDataDiskProperties.class); + + /* + * Specifies the disk resource ID to detach from virtual machine. + */ + @JsonProperty(value = "existingLabDiskId") + private String existingLabDiskId; + + /** + * Get the existingLabDiskId property: Specifies the disk resource ID to detach from virtual machine. + * + * @return the existingLabDiskId value. + */ + public String existingLabDiskId() { + return this.existingLabDiskId; + } + + /** + * Set the existingLabDiskId property: Specifies the disk resource ID to detach from virtual machine. + * + * @param existingLabDiskId the existingLabDiskId value to set. + * @return the DetachDataDiskProperties object itself. + */ + public DetachDataDiskProperties withExistingLabDiskId(String existingLabDiskId) { + this.existingLabDiskId = existingLabDiskId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDiskProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDiskProperties.java new file mode 100644 index 000000000000..05dcfa0a487b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DetachDiskProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the disk to detach. */ +@Fluent +public final class DetachDiskProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DetachDiskProperties.class); + + /* + * The resource ID of the Lab VM to which the disk is attached. + */ + @JsonProperty(value = "leasedByLabVmId") + private String leasedByLabVmId; + + /** + * Get the leasedByLabVmId property: The resource ID of the Lab VM to which the disk is attached. + * + * @return the leasedByLabVmId value. + */ + public String leasedByLabVmId() { + return this.leasedByLabVmId; + } + + /** + * Set the leasedByLabVmId property: The resource ID of the Lab VM to which the disk is attached. + * + * @param leasedByLabVmId the leasedByLabVmId value to set. + * @return the DetachDiskProperties object itself. + */ + public DetachDiskProperties withLeasedByLabVmId(String leasedByLabVmId) { + this.leasedByLabVmId = leasedByLabVmId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disk.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disk.java new file mode 100644 index 000000000000..f56e6a1bb064 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disk.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.DiskInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Disk. */ +public interface Disk { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the diskType property: The storage type for the disk (i.e. Standard, Premium). + * + * @return the diskType value. + */ + StorageType diskType(); + + /** + * Gets the diskSizeGiB property: The size of the disk in Gibibytes. + * + * @return the diskSizeGiB value. + */ + Integer diskSizeGiB(); + + /** + * Gets the leasedByLabVmId property: The resource ID of the VM to which this disk is leased. + * + * @return the leasedByLabVmId value. + */ + String leasedByLabVmId(); + + /** + * Gets the diskBlobName property: When backed by a blob, the name of the VHD blob without extension. + * + * @return the diskBlobName value. + */ + String diskBlobName(); + + /** + * Gets the diskUri property: When backed by a blob, the URI of underlying blob. + * + * @return the diskUri value. + */ + String diskUri(); + + /** + * Gets the storageAccountId property: When backed by a blob, the storage account where the blob is. + * + * @return the storageAccountId value. + */ + String storageAccountId(); + + /** + * Gets the createdDate property: The creation date of the disk. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the hostCaching property: The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + * + * @return the hostCaching value. + */ + String hostCaching(); + + /** + * Gets the managedDiskId property: When backed by managed disk, this is the ID of the compute disk resource. + * + * @return the managedDiskId value. + */ + String managedDiskId(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.DiskInner object. + * + * @return the inner object. + */ + DiskInner innerModel(); + + /** The entirety of the Disk definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The Disk definition stages. */ + interface DefinitionStages { + /** The first stage of the Disk definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Disk definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the Disk definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName, username. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @return the next definition stage. + */ + WithCreate withExistingUser(String resourceGroupName, String labName, String username); + } + /** + * The stage of the Disk definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDiskType, + DefinitionStages.WithDiskSizeGiB, + DefinitionStages.WithLeasedByLabVmId, + DefinitionStages.WithDiskBlobName, + DefinitionStages.WithDiskUri, + DefinitionStages.WithStorageAccountId, + DefinitionStages.WithHostCaching, + DefinitionStages.WithManagedDiskId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Disk create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Disk create(Context context); + } + /** The stage of the Disk definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Disk definition allowing to specify diskType. */ + interface WithDiskType { + /** + * Specifies the diskType property: The storage type for the disk (i.e. Standard, Premium).. + * + * @param diskType The storage type for the disk (i.e. Standard, Premium). + * @return the next definition stage. + */ + WithCreate withDiskType(StorageType diskType); + } + /** The stage of the Disk definition allowing to specify diskSizeGiB. */ + interface WithDiskSizeGiB { + /** + * Specifies the diskSizeGiB property: The size of the disk in Gibibytes.. + * + * @param diskSizeGiB The size of the disk in Gibibytes. + * @return the next definition stage. + */ + WithCreate withDiskSizeGiB(Integer diskSizeGiB); + } + /** The stage of the Disk definition allowing to specify leasedByLabVmId. */ + interface WithLeasedByLabVmId { + /** + * Specifies the leasedByLabVmId property: The resource ID of the VM to which this disk is leased.. + * + * @param leasedByLabVmId The resource ID of the VM to which this disk is leased. + * @return the next definition stage. + */ + WithCreate withLeasedByLabVmId(String leasedByLabVmId); + } + /** The stage of the Disk definition allowing to specify diskBlobName. */ + interface WithDiskBlobName { + /** + * Specifies the diskBlobName property: When backed by a blob, the name of the VHD blob without extension.. + * + * @param diskBlobName When backed by a blob, the name of the VHD blob without extension. + * @return the next definition stage. + */ + WithCreate withDiskBlobName(String diskBlobName); + } + /** The stage of the Disk definition allowing to specify diskUri. */ + interface WithDiskUri { + /** + * Specifies the diskUri property: When backed by a blob, the URI of underlying blob.. + * + * @param diskUri When backed by a blob, the URI of underlying blob. + * @return the next definition stage. + */ + WithCreate withDiskUri(String diskUri); + } + /** The stage of the Disk definition allowing to specify storageAccountId. */ + interface WithStorageAccountId { + /** + * Specifies the storageAccountId property: When backed by a blob, the storage account where the blob is.. + * + * @param storageAccountId When backed by a blob, the storage account where the blob is. + * @return the next definition stage. + */ + WithCreate withStorageAccountId(String storageAccountId); + } + /** The stage of the Disk definition allowing to specify hostCaching. */ + interface WithHostCaching { + /** + * Specifies the hostCaching property: The host caching policy of the disk (i.e. None, ReadOnly, + * ReadWrite).. + * + * @param hostCaching The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + * @return the next definition stage. + */ + WithCreate withHostCaching(String hostCaching); + } + /** The stage of the Disk definition allowing to specify managedDiskId. */ + interface WithManagedDiskId { + /** + * Specifies the managedDiskId property: When backed by managed disk, this is the ID of the compute disk + * resource.. + * + * @param managedDiskId When backed by managed disk, this is the ID of the compute disk resource. + * @return the next definition stage. + */ + WithCreate withManagedDiskId(String managedDiskId); + } + } + /** + * Begins update for the Disk resource. + * + * @return the stage of resource update. + */ + Disk.Update update(); + + /** The template for Disk update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Disk apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Disk apply(Context context); + } + /** The Disk update stages. */ + interface UpdateStages { + /** The stage of the Disk update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Disk refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Disk refresh(Context context); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void attach(AttachDiskProperties attachDiskProperties); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void attach(AttachDiskProperties attachDiskProperties, Context context); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detach(DetachDiskProperties detachDiskProperties); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detach(DetachDiskProperties detachDiskProperties, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskFragment.java new file mode 100644 index 000000000000..e3e0362be522 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A Disk. */ +@Immutable +public final class DiskFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskFragment.class); + + /** {@inheritDoc} */ + @Override + public DiskFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskList.java new file mode 100644 index 000000000000..973192a12bcb --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DiskList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.DiskInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class DiskList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the DiskList object itself. + */ + public DiskList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the DiskList object itself. + */ + public DiskList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disks.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disks.java new file mode 100644 index 000000000000..b9ae9f616e0e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Disks.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Disks. */ +public interface Disks { + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + Disk get(String resourceGroupName, String labName, String username, String name); + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties); + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param attachDiskProperties Properties of the disk to attach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void attach( + String resourceGroupName, + String labName, + String username, + String name, + AttachDiskProperties attachDiskProperties, + Context context); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to + * complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the disk. + * @param detachDiskProperties Properties of the disk to detach. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detach( + String resourceGroupName, + String labName, + String username, + String name, + DetachDiskProperties detachDiskProperties, + Context context); + + /** + * Get disk. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + Disk getById(String id); + + /** + * Get disk. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return disk. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Disk resource. + * + * @param name resource name. + * @return the first stage of the new Disk definition. + */ + Disk.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironment.java new file mode 100644 index 000000000000..8d01a27b03a2 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironment.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.DtlEnvironmentInner; +import java.util.Map; + +/** An immutable client-side representation of DtlEnvironment. */ +public interface DtlEnvironment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the deploymentProperties property: The deployment properties of the environment. + * + * @return the deploymentProperties value. + */ + EnvironmentDeploymentProperties deploymentProperties(); + + /** + * Gets the armTemplateDisplayName property: The display name of the Azure Resource Manager template that produced + * the environment. + * + * @return the armTemplateDisplayName value. + */ + String armTemplateDisplayName(); + + /** + * Gets the resourceGroupId property: The identifier of the resource group containing the environment's resources. + * + * @return the resourceGroupId value. + */ + String resourceGroupId(); + + /** + * Gets the createdByUser property: The creator of the environment. + * + * @return the createdByUser value. + */ + String createdByUser(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.DtlEnvironmentInner object. + * + * @return the inner object. + */ + DtlEnvironmentInner innerModel(); + + /** The entirety of the DtlEnvironment definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The DtlEnvironment definition stages. */ + interface DefinitionStages { + /** The first stage of the DtlEnvironment definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DtlEnvironment definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the DtlEnvironment definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName, username. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @return the next definition stage. + */ + WithCreate withExistingUser(String resourceGroupName, String labName, String username); + } + /** + * The stage of the DtlEnvironment definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDeploymentProperties, + DefinitionStages.WithArmTemplateDisplayName { + /** + * Executes the create request. + * + * @return the created resource. + */ + DtlEnvironment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DtlEnvironment create(Context context); + } + /** The stage of the DtlEnvironment definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the DtlEnvironment definition allowing to specify deploymentProperties. */ + interface WithDeploymentProperties { + /** + * Specifies the deploymentProperties property: The deployment properties of the environment.. + * + * @param deploymentProperties The deployment properties of the environment. + * @return the next definition stage. + */ + WithCreate withDeploymentProperties(EnvironmentDeploymentProperties deploymentProperties); + } + /** The stage of the DtlEnvironment definition allowing to specify armTemplateDisplayName. */ + interface WithArmTemplateDisplayName { + /** + * Specifies the armTemplateDisplayName property: The display name of the Azure Resource Manager template + * that produced the environment.. + * + * @param armTemplateDisplayName The display name of the Azure Resource Manager template that produced the + * environment. + * @return the next definition stage. + */ + WithCreate withArmTemplateDisplayName(String armTemplateDisplayName); + } + } + /** + * Begins update for the DtlEnvironment resource. + * + * @return the stage of resource update. + */ + DtlEnvironment.Update update(); + + /** The template for DtlEnvironment update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DtlEnvironment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DtlEnvironment apply(Context context); + } + /** The DtlEnvironment update stages. */ + interface UpdateStages { + /** The stage of the DtlEnvironment update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DtlEnvironment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DtlEnvironment refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentFragment.java new file mode 100644 index 000000000000..a7a1654b7145 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** An environment, which is essentially an ARM template deployment. */ +@Immutable +public final class DtlEnvironmentFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DtlEnvironmentFragment.class); + + /** {@inheritDoc} */ + @Override + public DtlEnvironmentFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentList.java new file mode 100644 index 000000000000..e1bda4c63c84 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/DtlEnvironmentList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.DtlEnvironmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class DtlEnvironmentList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DtlEnvironmentList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the DtlEnvironmentList object itself. + */ + public DtlEnvironmentList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the DtlEnvironmentList object itself. + */ + public DtlEnvironmentList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnableStatus.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnableStatus.java new file mode 100644 index 000000000000..40d8f653e524 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnableStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EnableStatus. */ +public final class EnableStatus extends ExpandableStringEnum { + /** Static value Enabled for EnableStatus. */ + public static final EnableStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for EnableStatus. */ + public static final EnableStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a EnableStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnableStatus. + */ + @JsonCreator + public static EnableStatus fromString(String name) { + return fromString(name, EnableStatus.class); + } + + /** @return known EnableStatus values. */ + public static Collection values() { + return values(EnableStatus.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentDeploymentProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentDeploymentProperties.java new file mode 100644 index 000000000000..135c2dcbec13 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentDeploymentProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of an environment deployment. */ +@Fluent +public final class EnvironmentDeploymentProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnvironmentDeploymentProperties.class); + + /* + * The Azure Resource Manager template's identifier. + */ + @JsonProperty(value = "armTemplateId") + private String armTemplateId; + + /* + * The parameters of the Azure Resource Manager template. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /** + * Get the armTemplateId property: The Azure Resource Manager template's identifier. + * + * @return the armTemplateId value. + */ + public String armTemplateId() { + return this.armTemplateId; + } + + /** + * Set the armTemplateId property: The Azure Resource Manager template's identifier. + * + * @param armTemplateId the armTemplateId value to set. + * @return the EnvironmentDeploymentProperties object itself. + */ + public EnvironmentDeploymentProperties withArmTemplateId(String armTemplateId) { + this.armTemplateId = armTemplateId; + return this; + } + + /** + * Get the parameters property: The parameters of the Azure Resource Manager template. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters of the Azure Resource Manager template. + * + * @param parameters the parameters value to set. + * @return the EnvironmentDeploymentProperties object itself. + */ + public EnvironmentDeploymentProperties withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parameters() != null) { + parameters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentPermission.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentPermission.java new file mode 100644 index 000000000000..8382a821b631 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EnvironmentPermission.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for EnvironmentPermission. */ +public final class EnvironmentPermission extends ExpandableStringEnum { + /** Static value Reader for EnvironmentPermission. */ + public static final EnvironmentPermission READER = fromString("Reader"); + + /** Static value Contributor for EnvironmentPermission. */ + public static final EnvironmentPermission CONTRIBUTOR = fromString("Contributor"); + + /** + * Creates or finds a EnvironmentPermission from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnvironmentPermission. + */ + @JsonCreator + public static EnvironmentPermission fromString(String name) { + return fromString(name, EnvironmentPermission.class); + } + + /** @return known EnvironmentPermission values. */ + public static Collection values() { + return values(EnvironmentPermission.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Environments.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Environments.java new file mode 100644 index 000000000000..8ce166a90356 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Environments.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Environments. */ +public interface Environments { + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + DtlEnvironment get(String resourceGroupName, String labName, String username, String name); + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the environment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Get environment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + DtlEnvironment getById(String id); + + /** + * Get environment. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return environment. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DtlEnvironment resource. + * + * @param name resource name. + * @return the first stage of the new DtlEnvironment definition. + */ + DtlEnvironment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesProperties.java new file mode 100644 index 000000000000..f2162bb3b559 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for evaluating a policy set. */ +@Fluent +public final class EvaluatePoliciesProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EvaluatePoliciesProperties.class); + + /* + * The fact name. + */ + @JsonProperty(value = "factName") + private String factName; + + /* + * The fact data. + */ + @JsonProperty(value = "factData") + private String factData; + + /* + * The value offset. + */ + @JsonProperty(value = "valueOffset") + private String valueOffset; + + /* + * The user for which policies will be evaluated + */ + @JsonProperty(value = "userObjectId") + private String userObjectId; + + /** + * Get the factName property: The fact name. + * + * @return the factName value. + */ + public String factName() { + return this.factName; + } + + /** + * Set the factName property: The fact name. + * + * @param factName the factName value to set. + * @return the EvaluatePoliciesProperties object itself. + */ + public EvaluatePoliciesProperties withFactName(String factName) { + this.factName = factName; + return this; + } + + /** + * Get the factData property: The fact data. + * + * @return the factData value. + */ + public String factData() { + return this.factData; + } + + /** + * Set the factData property: The fact data. + * + * @param factData the factData value to set. + * @return the EvaluatePoliciesProperties object itself. + */ + public EvaluatePoliciesProperties withFactData(String factData) { + this.factData = factData; + return this; + } + + /** + * Get the valueOffset property: The value offset. + * + * @return the valueOffset value. + */ + public String valueOffset() { + return this.valueOffset; + } + + /** + * Set the valueOffset property: The value offset. + * + * @param valueOffset the valueOffset value to set. + * @return the EvaluatePoliciesProperties object itself. + */ + public EvaluatePoliciesProperties withValueOffset(String valueOffset) { + this.valueOffset = valueOffset; + return this; + } + + /** + * Get the userObjectId property: The user for which policies will be evaluated. + * + * @return the userObjectId value. + */ + public String userObjectId() { + return this.userObjectId; + } + + /** + * Set the userObjectId property: The user for which policies will be evaluated. + * + * @param userObjectId the userObjectId value to set. + * @return the EvaluatePoliciesProperties object itself. + */ + public EvaluatePoliciesProperties withUserObjectId(String userObjectId) { + this.userObjectId = userObjectId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesRequest.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesRequest.java new file mode 100644 index 000000000000..90cbc39b24af --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesRequest.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request body for evaluating a policy set. */ +@Fluent +public final class EvaluatePoliciesRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EvaluatePoliciesRequest.class); + + /* + * Policies to evaluate. + */ + @JsonProperty(value = "policies") + private List policies; + + /** + * Get the policies property: Policies to evaluate. + * + * @return the policies value. + */ + public List policies() { + return this.policies; + } + + /** + * Set the policies property: Policies to evaluate. + * + * @param policies the policies value to set. + * @return the EvaluatePoliciesRequest object itself. + */ + public EvaluatePoliciesRequest withPolicies(List policies) { + this.policies = policies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policies() != null) { + policies().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesResponse.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesResponse.java new file mode 100644 index 000000000000..d2d804d1a960 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/EvaluatePoliciesResponse.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.EvaluatePoliciesResponseInner; +import java.util.List; + +/** An immutable client-side representation of EvaluatePoliciesResponse. */ +public interface EvaluatePoliciesResponse { + /** + * Gets the results property: Results of evaluating a policy set. + * + * @return the results value. + */ + List results(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.EvaluatePoliciesResponseInner object. + * + * @return the inner object. + */ + EvaluatePoliciesResponseInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Event.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Event.java new file mode 100644 index 000000000000..6d413ea89e10 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Event.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An event to be notified for. */ +@Fluent +public final class Event { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Event.class); + + /* + * The event type for which this notification is enabled (i.e. + * AutoShutdown, Cost) + */ + @JsonProperty(value = "eventName") + private NotificationChannelEventType eventName; + + /** + * Get the eventName property: The event type for which this notification is enabled (i.e. AutoShutdown, Cost). + * + * @return the eventName value. + */ + public NotificationChannelEventType eventName() { + return this.eventName; + } + + /** + * Set the eventName property: The event type for which this notification is enabled (i.e. AutoShutdown, Cost). + * + * @param eventName the eventName value to set. + * @return the Event object itself. + */ + public Event withEventName(NotificationChannelEventType eventName) { + this.eventName = eventName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExportResourceUsageParameters.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExportResourceUsageParameters.java new file mode 100644 index 000000000000..d0c49961363e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExportResourceUsageParameters.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The parameters of the export operation. */ +@Fluent +public final class ExportResourceUsageParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExportResourceUsageParameters.class); + + /* + * The blob storage absolute sas uri with write permission to the container + * which the usage data needs to be uploaded to. + */ + @JsonProperty(value = "blobStorageAbsoluteSasUri") + private String blobStorageAbsoluteSasUri; + + /* + * The start time of the usage. If not provided, usage will be reported + * since the beginning of data collection. + */ + @JsonProperty(value = "usageStartDate") + private OffsetDateTime usageStartDate; + + /** + * Get the blobStorageAbsoluteSasUri property: The blob storage absolute sas uri with write permission to the + * container which the usage data needs to be uploaded to. + * + * @return the blobStorageAbsoluteSasUri value. + */ + public String blobStorageAbsoluteSasUri() { + return this.blobStorageAbsoluteSasUri; + } + + /** + * Set the blobStorageAbsoluteSasUri property: The blob storage absolute sas uri with write permission to the + * container which the usage data needs to be uploaded to. + * + * @param blobStorageAbsoluteSasUri the blobStorageAbsoluteSasUri value to set. + * @return the ExportResourceUsageParameters object itself. + */ + public ExportResourceUsageParameters withBlobStorageAbsoluteSasUri(String blobStorageAbsoluteSasUri) { + this.blobStorageAbsoluteSasUri = blobStorageAbsoluteSasUri; + return this; + } + + /** + * Get the usageStartDate property: The start time of the usage. If not provided, usage will be reported since the + * beginning of data collection. + * + * @return the usageStartDate value. + */ + public OffsetDateTime usageStartDate() { + return this.usageStartDate; + } + + /** + * Set the usageStartDate property: The start time of the usage. If not provided, usage will be reported since the + * beginning of data collection. + * + * @param usageStartDate the usageStartDate value to set. + * @return the ExportResourceUsageParameters object itself. + */ + public ExportResourceUsageParameters withUsageStartDate(OffsetDateTime usageStartDate) { + this.usageStartDate = usageStartDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExternalSubnet.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExternalSubnet.java new file mode 100644 index 000000000000..e00d9b37e999 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ExternalSubnet.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Subnet information as returned by the Microsoft.Network API. */ +@Fluent +public final class ExternalSubnet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExternalSubnet.class); + + /* + * Gets or sets the identifier. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Gets or sets the name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the id property: Gets or sets the identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Gets or sets the identifier. + * + * @param id the id value to set. + * @return the ExternalSubnet object itself. + */ + public ExternalSubnet withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Gets or sets the name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name. + * + * @param name the name value to set. + * @return the ExternalSubnet object itself. + */ + public ExternalSubnet withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FileUploadOptions.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FileUploadOptions.java new file mode 100644 index 000000000000..a4f34b587c45 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FileUploadOptions.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for FileUploadOptions. */ +public final class FileUploadOptions extends ExpandableStringEnum { + /** Static value UploadFilesAndGenerateSasTokens for FileUploadOptions. */ + public static final FileUploadOptions UPLOAD_FILES_AND_GENERATE_SAS_TOKENS = + fromString("UploadFilesAndGenerateSasTokens"); + + /** Static value None for FileUploadOptions. */ + public static final FileUploadOptions NONE = fromString("None"); + + /** + * Creates or finds a FileUploadOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding FileUploadOptions. + */ + @JsonCreator + public static FileUploadOptions fromString(String name) { + return fromString(name, FileUploadOptions.class); + } + + /** @return known FileUploadOptions values. */ + public static Collection values() { + return values(FileUploadOptions.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formula.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formula.java new file mode 100644 index 000000000000..baa7d7821960 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formula.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.FormulaInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Formula. */ +public interface Formula { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the description property: The description of the formula. + * + * @return the description value. + */ + String description(); + + /** + * Gets the author property: The author of the formula. + * + * @return the author value. + */ + String author(); + + /** + * Gets the osType property: The OS type of the formula. + * + * @return the osType value. + */ + String osType(); + + /** + * Gets the creationDate property: The creation date of the formula. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the formulaContent property: The content of the formula. + * + * @return the formulaContent value. + */ + LabVirtualMachineCreationParameter formulaContent(); + + /** + * Gets the vm property: Information about a VM from which a formula is to be created. + * + * @return the vm value. + */ + FormulaPropertiesFromVm vm(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.FormulaInner object. + * + * @return the inner object. + */ + FormulaInner innerModel(); + + /** The entirety of the Formula definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The Formula definition stages. */ + interface DefinitionStages { + /** The first stage of the Formula definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Formula definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the Formula definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the Formula definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithOsType, + DefinitionStages.WithFormulaContent, + DefinitionStages.WithVm { + /** + * Executes the create request. + * + * @return the created resource. + */ + Formula create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Formula create(Context context); + } + /** The stage of the Formula definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Formula definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the formula.. + * + * @param description The description of the formula. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Formula definition allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: The OS type of the formula.. + * + * @param osType The OS type of the formula. + * @return the next definition stage. + */ + WithCreate withOsType(String osType); + } + /** The stage of the Formula definition allowing to specify formulaContent. */ + interface WithFormulaContent { + /** + * Specifies the formulaContent property: The content of the formula.. + * + * @param formulaContent The content of the formula. + * @return the next definition stage. + */ + WithCreate withFormulaContent(LabVirtualMachineCreationParameter formulaContent); + } + /** The stage of the Formula definition allowing to specify vm. */ + interface WithVm { + /** + * Specifies the vm property: Information about a VM from which a formula is to be created.. + * + * @param vm Information about a VM from which a formula is to be created. + * @return the next definition stage. + */ + WithCreate withVm(FormulaPropertiesFromVm vm); + } + } + /** + * Begins update for the Formula resource. + * + * @return the stage of resource update. + */ + Formula.Update update(); + + /** The template for Formula update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Formula apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Formula apply(Context context); + } + /** The Formula update stages. */ + interface UpdateStages { + /** The stage of the Formula update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Formula refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Formula refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaFragment.java new file mode 100644 index 000000000000..c55a002df1bf --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A formula for creating a VM, specifying an image base and other parameters. */ +@Immutable +public final class FormulaFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FormulaFragment.class); + + /** {@inheritDoc} */ + @Override + public FormulaFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaList.java new file mode 100644 index 000000000000..8533445239a8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.FormulaInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class FormulaList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FormulaList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the FormulaList object itself. + */ + public FormulaList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the FormulaList object itself. + */ + public FormulaList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaPropertiesFromVm.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaPropertiesFromVm.java new file mode 100644 index 000000000000..fbfbd886fffa --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/FormulaPropertiesFromVm.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a VM from which a formula is to be created. */ +@Fluent +public final class FormulaPropertiesFromVm { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FormulaPropertiesFromVm.class); + + /* + * The identifier of the VM from which a formula is to be created. + */ + @JsonProperty(value = "labVmId") + private String labVmId; + + /** + * Get the labVmId property: The identifier of the VM from which a formula is to be created. + * + * @return the labVmId value. + */ + public String labVmId() { + return this.labVmId; + } + + /** + * Set the labVmId property: The identifier of the VM from which a formula is to be created. + * + * @param labVmId the labVmId value to set. + * @return the FormulaPropertiesFromVm object itself. + */ + public FormulaPropertiesFromVm withLabVmId(String labVmId) { + this.labVmId = labVmId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formulas.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formulas.java new file mode 100644 index 000000000000..420a159e91e4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Formulas.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Formulas. */ +public interface Formulas { + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + Formula get(String resourceGroupName, String labName, String name); + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Get formula. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + Formula getById(String id); + + /** + * Get formula. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return formula. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete formula. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete formula. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Formula resource. + * + * @param name resource name. + * @return the first stage of the new Formula definition. + */ + Formula.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImage.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImage.java new file mode 100644 index 000000000000..4c6b635e2ed4 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImage.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of GalleryImage. */ +public interface GalleryImage { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the author property: The author of the gallery image. + * + * @return the author value. + */ + String author(); + + /** + * Gets the createdDate property: The creation date of the gallery image. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the description property: The description of the gallery image. + * + * @return the description value. + */ + String description(); + + /** + * Gets the imageReference property: The image reference of the gallery image. + * + * @return the imageReference value. + */ + GalleryImageReference imageReference(); + + /** + * Gets the icon property: The icon of the gallery image. + * + * @return the icon value. + */ + String icon(); + + /** + * Gets the enabled property: Indicates whether this gallery image is enabled. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the planId property: The third party plan that applies to this image. + * + * @return the planId value. + */ + String planId(); + + /** + * Gets the isPlanAuthorized property: Indicates if the plan has been authorized for programmatic deployment. + * + * @return the isPlanAuthorized value. + */ + Boolean isPlanAuthorized(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageInner object. + * + * @return the inner object. + */ + GalleryImageInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageList.java new file mode 100644 index 000000000000..81f9d164936f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.GalleryImageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class GalleryImageList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the GalleryImageList object itself. + */ + public GalleryImageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the GalleryImageList object itself. + */ + public GalleryImageList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageReference.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageReference.java new file mode 100644 index 000000000000..943ffff5513d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImageReference.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The reference information for an Azure Marketplace image. */ +@Fluent +public final class GalleryImageReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GalleryImageReference.class); + + /* + * The offer of the gallery image. + */ + @JsonProperty(value = "offer") + private String offer; + + /* + * The publisher of the gallery image. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * The SKU of the gallery image. + */ + @JsonProperty(value = "sku") + private String sku; + + /* + * The OS type of the gallery image. + */ + @JsonProperty(value = "osType") + private String osType; + + /* + * The version of the gallery image. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the offer property: The offer of the gallery image. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: The offer of the gallery image. + * + * @param offer the offer value to set. + * @return the GalleryImageReference object itself. + */ + public GalleryImageReference withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the publisher property: The publisher of the gallery image. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher of the gallery image. + * + * @param publisher the publisher value to set. + * @return the GalleryImageReference object itself. + */ + public GalleryImageReference withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the sku property: The SKU of the gallery image. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the gallery image. + * + * @param sku the sku value to set. + * @return the GalleryImageReference object itself. + */ + public GalleryImageReference withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the osType property: The OS type of the gallery image. + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Set the osType property: The OS type of the gallery image. + * + * @param osType the osType value to set. + * @return the GalleryImageReference object itself. + */ + public GalleryImageReference withOsType(String osType) { + this.osType = osType; + return this; + } + + /** + * Get the version property: The version of the gallery image. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the gallery image. + * + * @param version the version value to set. + * @return the GalleryImageReference object itself. + */ + public GalleryImageReference withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImages.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImages.java new file mode 100644 index 000000000000..9f1af15099d2 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GalleryImages.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of GalleryImages. */ +public interface GalleryImages { + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateArmTemplateRequest.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateArmTemplateRequest.java new file mode 100644 index 000000000000..2ebf6f659b58 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateArmTemplateRequest.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Parameters for generating an ARM template for deploying artifacts. */ +@Fluent +public final class GenerateArmTemplateRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GenerateArmTemplateRequest.class); + + /* + * The resource name of the virtual machine. + */ + @JsonProperty(value = "virtualMachineName") + private String virtualMachineName; + + /* + * The parameters of the ARM template. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /* + * The location of the virtual machine. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Options for uploading the files for the artifact. + * UploadFilesAndGenerateSasTokens is the default value. + */ + @JsonProperty(value = "fileUploadOptions") + private FileUploadOptions fileUploadOptions; + + /** + * Get the virtualMachineName property: The resource name of the virtual machine. + * + * @return the virtualMachineName value. + */ + public String virtualMachineName() { + return this.virtualMachineName; + } + + /** + * Set the virtualMachineName property: The resource name of the virtual machine. + * + * @param virtualMachineName the virtualMachineName value to set. + * @return the GenerateArmTemplateRequest object itself. + */ + public GenerateArmTemplateRequest withVirtualMachineName(String virtualMachineName) { + this.virtualMachineName = virtualMachineName; + return this; + } + + /** + * Get the parameters property: The parameters of the ARM template. + * + * @return the parameters value. + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters of the ARM template. + * + * @param parameters the parameters value to set. + * @return the GenerateArmTemplateRequest object itself. + */ + public GenerateArmTemplateRequest withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the location property: The location of the virtual machine. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the virtual machine. + * + * @param location the location value to set. + * @return the GenerateArmTemplateRequest object itself. + */ + public GenerateArmTemplateRequest withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the fileUploadOptions property: Options for uploading the files for the artifact. + * UploadFilesAndGenerateSasTokens is the default value. + * + * @return the fileUploadOptions value. + */ + public FileUploadOptions fileUploadOptions() { + return this.fileUploadOptions; + } + + /** + * Set the fileUploadOptions property: Options for uploading the files for the artifact. + * UploadFilesAndGenerateSasTokens is the default value. + * + * @param fileUploadOptions the fileUploadOptions value to set. + * @return the GenerateArmTemplateRequest object itself. + */ + public GenerateArmTemplateRequest withFileUploadOptions(FileUploadOptions fileUploadOptions) { + this.fileUploadOptions = fileUploadOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (parameters() != null) { + parameters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriParameter.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriParameter.java new file mode 100644 index 000000000000..ae08ae55a042 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriParameter.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for generating an upload URI. */ +@Fluent +public final class GenerateUploadUriParameter { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GenerateUploadUriParameter.class); + + /* + * The blob name of the upload URI. + */ + @JsonProperty(value = "blobName") + private String blobName; + + /** + * Get the blobName property: The blob name of the upload URI. + * + * @return the blobName value. + */ + public String blobName() { + return this.blobName; + } + + /** + * Set the blobName property: The blob name of the upload URI. + * + * @param blobName the blobName value to set. + * @return the GenerateUploadUriParameter object itself. + */ + public GenerateUploadUriParameter withBlobName(String blobName) { + this.blobName = blobName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriResponse.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriResponse.java new file mode 100644 index 000000000000..4da22f594cf9 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GenerateUploadUriResponse.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.GenerateUploadUriResponseInner; + +/** An immutable client-side representation of GenerateUploadUriResponse. */ +public interface GenerateUploadUriResponse { + /** + * Gets the uploadUri property: The upload URI for the VHD. + * + * @return the uploadUri value. + */ + String uploadUri(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.GenerateUploadUriResponseInner object. + * + * @return the inner object. + */ + GenerateUploadUriResponseInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GlobalSchedules.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GlobalSchedules.java new file mode 100644 index 000000000000..ab62d09cc507 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/GlobalSchedules.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of GlobalSchedules. */ +public interface GlobalSchedules { + /** + * List schedules in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(); + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String expand, String filter, Integer top, String orderby, Context context); + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Schedule getByResourceGroup(String resourceGroupName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String name, String expand, Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String name, Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String name, Context context); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void retarget(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void retarget( + String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, Context context); + + /** + * Get schedule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Schedule getById(String id); + + /** + * Get schedule. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete schedule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete schedule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Schedule resource. + * + * @param name resource name. + * @return the first stage of the new Schedule definition. + */ + Schedule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HostCachingOptions.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HostCachingOptions.java new file mode 100644 index 000000000000..cf7e1366e07d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HostCachingOptions.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HostCachingOptions. */ +public final class HostCachingOptions extends ExpandableStringEnum { + /** Static value None for HostCachingOptions. */ + public static final HostCachingOptions NONE = fromString("None"); + + /** Static value ReadOnly for HostCachingOptions. */ + public static final HostCachingOptions READ_ONLY = fromString("ReadOnly"); + + /** Static value ReadWrite for HostCachingOptions. */ + public static final HostCachingOptions READ_WRITE = fromString("ReadWrite"); + + /** + * Creates or finds a HostCachingOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding HostCachingOptions. + */ + @JsonCreator + public static HostCachingOptions fromString(String name) { + return fromString(name, HostCachingOptions.class); + } + + /** @return known HostCachingOptions values. */ + public static Collection values() { + return values(HostCachingOptions.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HourDetails.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HourDetails.java new file mode 100644 index 000000000000..3a9be05ac25d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HourDetails.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an hourly schedule. */ +@Fluent +public final class HourDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HourDetails.class); + + /* + * Minutes of the hour the schedule will run. + */ + @JsonProperty(value = "minute") + private Integer minute; + + /** + * Get the minute property: Minutes of the hour the schedule will run. + * + * @return the minute value. + */ + public Integer minute() { + return this.minute; + } + + /** + * Set the minute property: Minutes of the hour the schedule will run. + * + * @param minute the minute value to set. + * @return the HourDetails object itself. + */ + public HourDetails withMinute(Integer minute) { + this.minute = minute; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HttpStatusCode.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HttpStatusCode.java new file mode 100644 index 000000000000..a9f425520177 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/HttpStatusCode.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HttpStatusCode. */ +public final class HttpStatusCode extends ExpandableStringEnum { + /** Static value Continue for HttpStatusCode. */ + public static final HttpStatusCode CONTINUE = fromString("Continue"); + + /** Static value SwitchingProtocols for HttpStatusCode. */ + public static final HttpStatusCode SWITCHING_PROTOCOLS = fromString("SwitchingProtocols"); + + /** Static value OK for HttpStatusCode. */ + public static final HttpStatusCode OK = fromString("OK"); + + /** Static value Created for HttpStatusCode. */ + public static final HttpStatusCode CREATED = fromString("Created"); + + /** Static value Accepted for HttpStatusCode. */ + public static final HttpStatusCode ACCEPTED = fromString("Accepted"); + + /** Static value NonAuthoritativeInformation for HttpStatusCode. */ + public static final HttpStatusCode NON_AUTHORITATIVE_INFORMATION = fromString("NonAuthoritativeInformation"); + + /** Static value NoContent for HttpStatusCode. */ + public static final HttpStatusCode NO_CONTENT = fromString("NoContent"); + + /** Static value ResetContent for HttpStatusCode. */ + public static final HttpStatusCode RESET_CONTENT = fromString("ResetContent"); + + /** Static value PartialContent for HttpStatusCode. */ + public static final HttpStatusCode PARTIAL_CONTENT = fromString("PartialContent"); + + /** Static value MultipleChoices for HttpStatusCode. */ + public static final HttpStatusCode MULTIPLE_CHOICES = fromString("MultipleChoices"); + + /** Static value Ambiguous for HttpStatusCode. */ + public static final HttpStatusCode AMBIGUOUS = fromString("Ambiguous"); + + /** Static value MovedPermanently for HttpStatusCode. */ + public static final HttpStatusCode MOVED_PERMANENTLY = fromString("MovedPermanently"); + + /** Static value Moved for HttpStatusCode. */ + public static final HttpStatusCode MOVED = fromString("Moved"); + + /** Static value Found for HttpStatusCode. */ + public static final HttpStatusCode FOUND = fromString("Found"); + + /** Static value Redirect for HttpStatusCode. */ + public static final HttpStatusCode REDIRECT = fromString("Redirect"); + + /** Static value SeeOther for HttpStatusCode. */ + public static final HttpStatusCode SEE_OTHER = fromString("SeeOther"); + + /** Static value RedirectMethod for HttpStatusCode. */ + public static final HttpStatusCode REDIRECT_METHOD = fromString("RedirectMethod"); + + /** Static value NotModified for HttpStatusCode. */ + public static final HttpStatusCode NOT_MODIFIED = fromString("NotModified"); + + /** Static value UseProxy for HttpStatusCode. */ + public static final HttpStatusCode USE_PROXY = fromString("UseProxy"); + + /** Static value Unused for HttpStatusCode. */ + public static final HttpStatusCode UNUSED = fromString("Unused"); + + /** Static value TemporaryRedirect for HttpStatusCode. */ + public static final HttpStatusCode TEMPORARY_REDIRECT = fromString("TemporaryRedirect"); + + /** Static value RedirectKeepVerb for HttpStatusCode. */ + public static final HttpStatusCode REDIRECT_KEEP_VERB = fromString("RedirectKeepVerb"); + + /** Static value BadRequest for HttpStatusCode. */ + public static final HttpStatusCode BAD_REQUEST = fromString("BadRequest"); + + /** Static value Unauthorized for HttpStatusCode. */ + public static final HttpStatusCode UNAUTHORIZED = fromString("Unauthorized"); + + /** Static value PaymentRequired for HttpStatusCode. */ + public static final HttpStatusCode PAYMENT_REQUIRED = fromString("PaymentRequired"); + + /** Static value Forbidden for HttpStatusCode. */ + public static final HttpStatusCode FORBIDDEN = fromString("Forbidden"); + + /** Static value NotFound for HttpStatusCode. */ + public static final HttpStatusCode NOT_FOUND = fromString("NotFound"); + + /** Static value MethodNotAllowed for HttpStatusCode. */ + public static final HttpStatusCode METHOD_NOT_ALLOWED = fromString("MethodNotAllowed"); + + /** Static value NotAcceptable for HttpStatusCode. */ + public static final HttpStatusCode NOT_ACCEPTABLE = fromString("NotAcceptable"); + + /** Static value ProxyAuthenticationRequired for HttpStatusCode. */ + public static final HttpStatusCode PROXY_AUTHENTICATION_REQUIRED = fromString("ProxyAuthenticationRequired"); + + /** Static value RequestTimeout for HttpStatusCode. */ + public static final HttpStatusCode REQUEST_TIMEOUT = fromString("RequestTimeout"); + + /** Static value Conflict for HttpStatusCode. */ + public static final HttpStatusCode CONFLICT = fromString("Conflict"); + + /** Static value Gone for HttpStatusCode. */ + public static final HttpStatusCode GONE = fromString("Gone"); + + /** Static value LengthRequired for HttpStatusCode. */ + public static final HttpStatusCode LENGTH_REQUIRED = fromString("LengthRequired"); + + /** Static value PreconditionFailed for HttpStatusCode. */ + public static final HttpStatusCode PRECONDITION_FAILED = fromString("PreconditionFailed"); + + /** Static value RequestEntityTooLarge for HttpStatusCode. */ + public static final HttpStatusCode REQUEST_ENTITY_TOO_LARGE = fromString("RequestEntityTooLarge"); + + /** Static value RequestUriTooLong for HttpStatusCode. */ + public static final HttpStatusCode REQUEST_URI_TOO_LONG = fromString("RequestUriTooLong"); + + /** Static value UnsupportedMediaType for HttpStatusCode. */ + public static final HttpStatusCode UNSUPPORTED_MEDIA_TYPE = fromString("UnsupportedMediaType"); + + /** Static value RequestedRangeNotSatisfiable for HttpStatusCode. */ + public static final HttpStatusCode REQUESTED_RANGE_NOT_SATISFIABLE = fromString("RequestedRangeNotSatisfiable"); + + /** Static value ExpectationFailed for HttpStatusCode. */ + public static final HttpStatusCode EXPECTATION_FAILED = fromString("ExpectationFailed"); + + /** Static value UpgradeRequired for HttpStatusCode. */ + public static final HttpStatusCode UPGRADE_REQUIRED = fromString("UpgradeRequired"); + + /** Static value InternalServerError for HttpStatusCode. */ + public static final HttpStatusCode INTERNAL_SERVER_ERROR = fromString("InternalServerError"); + + /** Static value NotImplemented for HttpStatusCode. */ + public static final HttpStatusCode NOT_IMPLEMENTED = fromString("NotImplemented"); + + /** Static value BadGateway for HttpStatusCode. */ + public static final HttpStatusCode BAD_GATEWAY = fromString("BadGateway"); + + /** Static value ServiceUnavailable for HttpStatusCode. */ + public static final HttpStatusCode SERVICE_UNAVAILABLE = fromString("ServiceUnavailable"); + + /** Static value GatewayTimeout for HttpStatusCode. */ + public static final HttpStatusCode GATEWAY_TIMEOUT = fromString("GatewayTimeout"); + + /** Static value HttpVersionNotSupported for HttpStatusCode. */ + public static final HttpStatusCode HTTP_VERSION_NOT_SUPPORTED = fromString("HttpVersionNotSupported"); + + /** + * Creates or finds a HttpStatusCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding HttpStatusCode. + */ + @JsonCreator + public static HttpStatusCode fromString(String name) { + return fromString(name, HttpStatusCode.class); + } + + /** @return known HttpStatusCode values. */ + public static Collection values() { + return values(HttpStatusCode.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/IdentityProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/IdentityProperties.java new file mode 100644 index 000000000000..cb32d4fa467e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/IdentityProperties.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a managed identity. */ +@Fluent +public final class IdentityProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IdentityProperties.class); + + /* + * Managed identity. + */ + @JsonProperty(value = "type") + private ManagedIdentityType type; + + /* + * The principal id of resource identity. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /* + * The tenant identifier of resource. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The client secret URL of the identity. + */ + @JsonProperty(value = "clientSecretUrl") + private String clientSecretUrl; + + /** + * Get the type property: Managed identity. + * + * @return the type value. + */ + public ManagedIdentityType type() { + return this.type; + } + + /** + * Set the type property: Managed identity. + * + * @param type the type value to set. + * @return the IdentityProperties object itself. + */ + public IdentityProperties withType(ManagedIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the principalId property: The principal id of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The principal id of resource identity. + * + * @param principalId the principalId value to set. + * @return the IdentityProperties object itself. + */ + public IdentityProperties withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the tenantId property: The tenant identifier of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenant identifier of resource. + * + * @param tenantId the tenantId value to set. + * @return the IdentityProperties object itself. + */ + public IdentityProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the clientSecretUrl property: The client secret URL of the identity. + * + * @return the clientSecretUrl value. + */ + public String clientSecretUrl() { + return this.clientSecretUrl; + } + + /** + * Set the clientSecretUrl property: The client secret URL of the identity. + * + * @param clientSecretUrl the clientSecretUrl value to set. + * @return the IdentityProperties object itself. + */ + public IdentityProperties withClientSecretUrl(String clientSecretUrl) { + this.clientSecretUrl = clientSecretUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ImportLabVirtualMachineRequest.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ImportLabVirtualMachineRequest.java new file mode 100644 index 000000000000..14ccbae1c578 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ImportLabVirtualMachineRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** This represents the payload required to import a virtual machine from a different lab into the current one. */ +@Fluent +public final class ImportLabVirtualMachineRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImportLabVirtualMachineRequest.class); + + /* + * The full resource ID of the virtual machine to be imported. + */ + @JsonProperty(value = "sourceVirtualMachineResourceId") + private String sourceVirtualMachineResourceId; + + /* + * The name of the virtual machine in the destination lab + */ + @JsonProperty(value = "destinationVirtualMachineName") + private String destinationVirtualMachineName; + + /** + * Get the sourceVirtualMachineResourceId property: The full resource ID of the virtual machine to be imported. + * + * @return the sourceVirtualMachineResourceId value. + */ + public String sourceVirtualMachineResourceId() { + return this.sourceVirtualMachineResourceId; + } + + /** + * Set the sourceVirtualMachineResourceId property: The full resource ID of the virtual machine to be imported. + * + * @param sourceVirtualMachineResourceId the sourceVirtualMachineResourceId value to set. + * @return the ImportLabVirtualMachineRequest object itself. + */ + public ImportLabVirtualMachineRequest withSourceVirtualMachineResourceId(String sourceVirtualMachineResourceId) { + this.sourceVirtualMachineResourceId = sourceVirtualMachineResourceId; + return this; + } + + /** + * Get the destinationVirtualMachineName property: The name of the virtual machine in the destination lab. + * + * @return the destinationVirtualMachineName value. + */ + public String destinationVirtualMachineName() { + return this.destinationVirtualMachineName; + } + + /** + * Set the destinationVirtualMachineName property: The name of the virtual machine in the destination lab. + * + * @param destinationVirtualMachineName the destinationVirtualMachineName value to set. + * @return the ImportLabVirtualMachineRequest object itself. + */ + public ImportLabVirtualMachineRequest withDestinationVirtualMachineName(String destinationVirtualMachineName) { + this.destinationVirtualMachineName = destinationVirtualMachineName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/InboundNatRule.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/InboundNatRule.java new file mode 100644 index 000000000000..aaaee9515f5c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/InboundNatRule.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A rule for NAT - exposing a VM's port (backendPort) on the public IP address using a load balancer. */ +@Fluent +public final class InboundNatRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InboundNatRule.class); + + /* + * The transport protocol for the endpoint. + */ + @JsonProperty(value = "transportProtocol") + private TransportProtocol transportProtocol; + + /* + * 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(value = "frontendPort") + private Integer frontendPort; + + /* + * The port to which the external traffic will be redirected. + */ + @JsonProperty(value = "backendPort") + private Integer backendPort; + + /** + * Get the transportProtocol property: The transport protocol for the endpoint. + * + * @return the transportProtocol value. + */ + public TransportProtocol transportProtocol() { + return this.transportProtocol; + } + + /** + * Set the transportProtocol property: The transport protocol for the endpoint. + * + * @param transportProtocol the transportProtocol value to set. + * @return the InboundNatRule object itself. + */ + public InboundNatRule withTransportProtocol(TransportProtocol transportProtocol) { + this.transportProtocol = transportProtocol; + return this; + } + + /** + * Get the frontendPort property: The external endpoint port of the inbound connection. Possible values range + * between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + * + * @return the frontendPort value. + */ + public Integer frontendPort() { + return this.frontendPort; + } + + /** + * Set the frontendPort property: The external endpoint port of the inbound connection. Possible values range + * between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + * + * @param frontendPort the frontendPort value to set. + * @return the InboundNatRule object itself. + */ + public InboundNatRule withFrontendPort(Integer frontendPort) { + this.frontendPort = frontendPort; + return this; + } + + /** + * Get the backendPort property: The port to which the external traffic will be redirected. + * + * @return the backendPort value. + */ + public Integer backendPort() { + return this.backendPort; + } + + /** + * Set the backendPort property: The port to which the external traffic will be redirected. + * + * @param backendPort the backendPort value to set. + * @return the InboundNatRule object itself. + */ + public InboundNatRule withBackendPort(Integer backendPort) { + this.backendPort = backendPort; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Lab.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Lab.java new file mode 100644 index 000000000000..9603a37c9da8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Lab.java @@ -0,0 +1,573 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Lab. */ +public interface Lab { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the defaultStorageAccount property: The lab's default storage account. + * + * @return the defaultStorageAccount value. + */ + String defaultStorageAccount(); + + /** + * Gets the defaultPremiumStorageAccount property: The lab's default premium storage account. + * + * @return the defaultPremiumStorageAccount value. + */ + String defaultPremiumStorageAccount(); + + /** + * Gets the artifactsStorageAccount property: The lab's artifact storage account. + * + * @return the artifactsStorageAccount value. + */ + String artifactsStorageAccount(); + + /** + * Gets the premiumDataDiskStorageAccount property: The lab's premium data disk storage account. + * + * @return the premiumDataDiskStorageAccount value. + */ + String premiumDataDiskStorageAccount(); + + /** + * Gets the vaultName property: The lab's Key vault. + * + * @return the vaultName value. + */ + String vaultName(); + + /** + * Gets the labStorageType property: Type of storage used by the lab. It can be either Premium or Standard. Default + * is Premium. + * + * @return the labStorageType value. + */ + StorageType labStorageType(); + + /** + * Gets the mandatoryArtifactsResourceIdsLinux property: 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. + * + * @return the mandatoryArtifactsResourceIdsLinux value. + */ + List mandatoryArtifactsResourceIdsLinux(); + + /** + * Gets the mandatoryArtifactsResourceIdsWindows property: 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. + * + * @return the mandatoryArtifactsResourceIdsWindows value. + */ + List mandatoryArtifactsResourceIdsWindows(); + + /** + * Gets the createdDate property: The creation date of the lab. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the premiumDataDisks property: 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. + * + * @return the premiumDataDisks value. + */ + PremiumDataDisk premiumDataDisks(); + + /** + * Gets the environmentPermission property: The access rights to be granted to the user when provisioning an + * environment. + * + * @return the environmentPermission value. + */ + EnvironmentPermission environmentPermission(); + + /** + * Gets the announcement property: The properties of any lab announcement associated with this lab. + * + * @return the announcement value. + */ + LabAnnouncementProperties announcement(); + + /** + * Gets the support property: The properties of any lab support message associated with this lab. + * + * @return the support value. + */ + LabSupportProperties support(); + + /** + * Gets the vmCreationResourceGroup property: The resource group in which all new lab virtual machines will be + * created. To let DevTest Labs manage resource group creation, set this value to null. + * + * @return the vmCreationResourceGroup value. + */ + String vmCreationResourceGroup(); + + /** + * Gets the publicIpId property: The public IP address for the lab's load balancer. + * + * @return the publicIpId value. + */ + String publicIpId(); + + /** + * Gets the loadBalancerId property: The load balancer used to for lab VMs that use shared IP address. + * + * @return the loadBalancerId value. + */ + String loadBalancerId(); + + /** + * Gets the networkSecurityGroupId property: The Network Security Group attached to the lab VMs Network interfaces + * to restrict open ports. + * + * @return the networkSecurityGroupId value. + */ + String networkSecurityGroupId(); + + /** + * Gets the extendedProperties property: Extended properties of the lab used for experimental features. + * + * @return the extendedProperties value. + */ + Map extendedProperties(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.LabInner object. + * + * @return the inner object. + */ + LabInner innerModel(); + + /** The entirety of the Lab definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Lab definition stages. */ + interface DefinitionStages { + /** The first stage of the Lab definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Lab definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Lab definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Lab definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithLabStorageType, + DefinitionStages.WithMandatoryArtifactsResourceIdsLinux, + DefinitionStages.WithMandatoryArtifactsResourceIdsWindows, + DefinitionStages.WithPremiumDataDisks, + DefinitionStages.WithEnvironmentPermission, + DefinitionStages.WithAnnouncement, + DefinitionStages.WithSupport, + DefinitionStages.WithExtendedProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Lab create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Lab create(Context context); + } + /** The stage of the Lab definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Lab definition allowing to specify labStorageType. */ + interface WithLabStorageType { + /** + * Specifies the labStorageType property: Type of storage used by the lab. It can be either Premium or + * Standard. Default is Premium.. + * + * @param labStorageType Type of storage used by the lab. It can be either Premium or Standard. Default is + * Premium. + * @return the next definition stage. + */ + WithCreate withLabStorageType(StorageType labStorageType); + } + /** The stage of the Lab definition allowing to specify mandatoryArtifactsResourceIdsLinux. */ + interface WithMandatoryArtifactsResourceIdsLinux { + /** + * Specifies the mandatoryArtifactsResourceIdsLinux property: 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.. + * + * @param mandatoryArtifactsResourceIdsLinux 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. + * @return the next definition stage. + */ + WithCreate withMandatoryArtifactsResourceIdsLinux(List mandatoryArtifactsResourceIdsLinux); + } + /** The stage of the Lab definition allowing to specify mandatoryArtifactsResourceIdsWindows. */ + interface WithMandatoryArtifactsResourceIdsWindows { + /** + * Specifies the mandatoryArtifactsResourceIdsWindows property: 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.. + * + * @param mandatoryArtifactsResourceIdsWindows 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. + * @return the next definition stage. + */ + WithCreate withMandatoryArtifactsResourceIdsWindows(List mandatoryArtifactsResourceIdsWindows); + } + /** The stage of the Lab definition allowing to specify premiumDataDisks. */ + interface WithPremiumDataDisks { + /** + * Specifies the premiumDataDisks property: 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.. + * + * @param premiumDataDisks 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. + * @return the next definition stage. + */ + WithCreate withPremiumDataDisks(PremiumDataDisk premiumDataDisks); + } + /** The stage of the Lab definition allowing to specify environmentPermission. */ + interface WithEnvironmentPermission { + /** + * Specifies the environmentPermission property: The access rights to be granted to the user when + * provisioning an environment. + * + * @param environmentPermission The access rights to be granted to the user when provisioning an + * environment. + * @return the next definition stage. + */ + WithCreate withEnvironmentPermission(EnvironmentPermission environmentPermission); + } + /** The stage of the Lab definition allowing to specify announcement. */ + interface WithAnnouncement { + /** + * Specifies the announcement property: The properties of any lab announcement associated with this lab. + * + * @param announcement The properties of any lab announcement associated with this lab. + * @return the next definition stage. + */ + WithCreate withAnnouncement(LabAnnouncementProperties announcement); + } + /** The stage of the Lab definition allowing to specify support. */ + interface WithSupport { + /** + * Specifies the support property: The properties of any lab support message associated with this lab. + * + * @param support The properties of any lab support message associated with this lab. + * @return the next definition stage. + */ + WithCreate withSupport(LabSupportProperties support); + } + /** The stage of the Lab definition allowing to specify extendedProperties. */ + interface WithExtendedProperties { + /** + * Specifies the extendedProperties property: Extended properties of the lab used for experimental features. + * + * @param extendedProperties Extended properties of the lab used for experimental features. + * @return the next definition stage. + */ + WithCreate withExtendedProperties(Map extendedProperties); + } + } + /** + * Begins update for the Lab resource. + * + * @return the stage of resource update. + */ + Lab.Update update(); + + /** The template for Lab update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Lab apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Lab apply(Context context); + } + /** The Lab update stages. */ + interface UpdateStages { + /** The stage of the Lab update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Lab refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Lab refresh(Context context); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claimAnyVm(); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claimAnyVm(Context context); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void createEnvironment(LabVirtualMachineCreationParameter labVirtualMachineCreationParameter); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void createEnvironment(LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, Context context); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportResourceUsage(ExportResourceUsageParameters exportResourceUsageParameters); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportResourceUsage(ExportResourceUsageParameters exportResourceUsageParameters, Context context); + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param generateUploadUriParameter Properties for generating an upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + GenerateUploadUriResponse generateUploadUri(GenerateUploadUriParameter generateUploadUriParameter); + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param generateUploadUriParameter Properties for generating an upload URI. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + Response generateUploadUriWithResponse( + GenerateUploadUriParameter generateUploadUriParameter, Context context); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importVirtualMachine(ImportLabVirtualMachineRequest importLabVirtualMachineRequest); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importVirtualMachine(ImportLabVirtualMachineRequest importLabVirtualMachineRequest, Context context); + + /** + * List disk images available for custom image creation. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listVhds(); + + /** + * List disk images available for custom image creation. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listVhds(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabAnnouncementProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabAnnouncementProperties.java new file mode 100644 index 000000000000..38dc91b4a67f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabAnnouncementProperties.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Properties of a lab's announcement banner. */ +@Fluent +public final class LabAnnouncementProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabAnnouncementProperties.class); + + /* + * The plain text title for the lab announcement + */ + @JsonProperty(value = "title") + private String title; + + /* + * The markdown text (if any) that this lab displays in the UI. If left + * empty/null, nothing will be shown. + */ + @JsonProperty(value = "markdown") + private String markdown; + + /* + * Is the lab announcement active/enabled at this time? + */ + @JsonProperty(value = "enabled") + private EnableStatus enabled; + + /* + * The time at which the announcement expires (null for never) + */ + @JsonProperty(value = "expirationDate") + private OffsetDateTime expirationDate; + + /* + * Has this announcement expired? + */ + @JsonProperty(value = "expired") + private Boolean expired; + + /* + * The provisioning status of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "uniqueIdentifier", access = JsonProperty.Access.WRITE_ONLY) + private String uniqueIdentifier; + + /** + * Get the title property: The plain text title for the lab announcement. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The plain text title for the lab announcement. + * + * @param title the title value to set. + * @return the LabAnnouncementProperties object itself. + */ + public LabAnnouncementProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the markdown property: The markdown text (if any) that this lab displays in the UI. If left empty/null, + * nothing will be shown. + * + * @return the markdown value. + */ + public String markdown() { + return this.markdown; + } + + /** + * Set the markdown property: The markdown text (if any) that this lab displays in the UI. If left empty/null, + * nothing will be shown. + * + * @param markdown the markdown value to set. + * @return the LabAnnouncementProperties object itself. + */ + public LabAnnouncementProperties withMarkdown(String markdown) { + this.markdown = markdown; + return this; + } + + /** + * Get the enabled property: Is the lab announcement active/enabled at this time?. + * + * @return the enabled value. + */ + public EnableStatus enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is the lab announcement active/enabled at this time?. + * + * @param enabled the enabled value to set. + * @return the LabAnnouncementProperties object itself. + */ + public LabAnnouncementProperties withEnabled(EnableStatus enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the expirationDate property: The time at which the announcement expires (null for never). + * + * @return the expirationDate value. + */ + public OffsetDateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set the expirationDate property: The time at which the announcement expires (null for never). + * + * @param expirationDate the expirationDate value to set. + * @return the LabAnnouncementProperties object itself. + */ + public LabAnnouncementProperties withExpirationDate(OffsetDateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get the expired property: Has this announcement expired?. + * + * @return the expired value. + */ + public Boolean expired() { + return this.expired; + } + + /** + * Set the expired property: Has this announcement expired?. + * + * @param expired the expired value to set. + * @return the LabAnnouncementProperties object itself. + */ + public LabAnnouncementProperties withExpired(Boolean expired) { + this.expired = expired; + return this; + } + + /** + * Get the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCost.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCost.java new file mode 100644 index 000000000000..09637436bb99 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCost.java @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabCostInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of LabCost. */ +public interface LabCost { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the targetCost property: The target cost properties. + * + * @return the targetCost value. + */ + TargetCostProperties targetCost(); + + /** + * Gets the labCostSummary property: The lab cost summary component of the cost data. + * + * @return the labCostSummary value. + */ + LabCostSummaryProperties labCostSummary(); + + /** + * Gets the labCostDetails property: The lab cost details component of the cost data. + * + * @return the labCostDetails value. + */ + List labCostDetails(); + + /** + * Gets the resourceCosts property: The resource cost component of the cost data. + * + * @return the resourceCosts value. + */ + List resourceCosts(); + + /** + * Gets the currencyCode property: The currency code of the cost. + * + * @return the currencyCode value. + */ + String currencyCode(); + + /** + * Gets the startDateTime property: The start time of the cost data. + * + * @return the startDateTime value. + */ + OffsetDateTime startDateTime(); + + /** + * Gets the endDateTime property: The end time of the cost data. + * + * @return the endDateTime value. + */ + OffsetDateTime endDateTime(); + + /** + * Gets the createdDate property: The creation date of the cost. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.LabCostInner object. + * + * @return the inner object. + */ + LabCostInner innerModel(); + + /** The entirety of the LabCost definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The LabCost definition stages. */ + interface DefinitionStages { + /** The first stage of the LabCost definition. */ + interface Blank extends WithLocation { + } + /** The stage of the LabCost definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the LabCost definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the LabCost definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithTargetCost, + DefinitionStages.WithCurrencyCode, + DefinitionStages.WithStartDateTime, + DefinitionStages.WithEndDateTime, + DefinitionStages.WithCreatedDate { + /** + * Executes the create request. + * + * @return the created resource. + */ + LabCost create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LabCost create(Context context); + } + /** The stage of the LabCost definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the LabCost definition allowing to specify targetCost. */ + interface WithTargetCost { + /** + * Specifies the targetCost property: The target cost properties. + * + * @param targetCost The target cost properties. + * @return the next definition stage. + */ + WithCreate withTargetCost(TargetCostProperties targetCost); + } + /** The stage of the LabCost definition allowing to specify currencyCode. */ + interface WithCurrencyCode { + /** + * Specifies the currencyCode property: The currency code of the cost.. + * + * @param currencyCode The currency code of the cost. + * @return the next definition stage. + */ + WithCreate withCurrencyCode(String currencyCode); + } + /** The stage of the LabCost definition allowing to specify startDateTime. */ + interface WithStartDateTime { + /** + * Specifies the startDateTime property: The start time of the cost data.. + * + * @param startDateTime The start time of the cost data. + * @return the next definition stage. + */ + WithCreate withStartDateTime(OffsetDateTime startDateTime); + } + /** The stage of the LabCost definition allowing to specify endDateTime. */ + interface WithEndDateTime { + /** + * Specifies the endDateTime property: The end time of the cost data.. + * + * @param endDateTime The end time of the cost data. + * @return the next definition stage. + */ + WithCreate withEndDateTime(OffsetDateTime endDateTime); + } + /** The stage of the LabCost definition allowing to specify createdDate. */ + interface WithCreatedDate { + /** + * Specifies the createdDate property: The creation date of the cost.. + * + * @param createdDate The creation date of the cost. + * @return the next definition stage. + */ + WithCreate withCreatedDate(OffsetDateTime createdDate); + } + } + /** + * Begins update for the LabCost resource. + * + * @return the stage of resource update. + */ + LabCost.Update update(); + + /** The template for LabCost update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithTargetCost, + UpdateStages.WithCurrencyCode, + UpdateStages.WithStartDateTime, + UpdateStages.WithEndDateTime, + UpdateStages.WithCreatedDate { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LabCost apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LabCost apply(Context context); + } + /** The LabCost update stages. */ + interface UpdateStages { + /** The stage of the LabCost update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the LabCost update allowing to specify targetCost. */ + interface WithTargetCost { + /** + * Specifies the targetCost property: The target cost properties. + * + * @param targetCost The target cost properties. + * @return the next definition stage. + */ + Update withTargetCost(TargetCostProperties targetCost); + } + /** The stage of the LabCost update allowing to specify currencyCode. */ + interface WithCurrencyCode { + /** + * Specifies the currencyCode property: The currency code of the cost.. + * + * @param currencyCode The currency code of the cost. + * @return the next definition stage. + */ + Update withCurrencyCode(String currencyCode); + } + /** The stage of the LabCost update allowing to specify startDateTime. */ + interface WithStartDateTime { + /** + * Specifies the startDateTime property: The start time of the cost data.. + * + * @param startDateTime The start time of the cost data. + * @return the next definition stage. + */ + Update withStartDateTime(OffsetDateTime startDateTime); + } + /** The stage of the LabCost update allowing to specify endDateTime. */ + interface WithEndDateTime { + /** + * Specifies the endDateTime property: The end time of the cost data.. + * + * @param endDateTime The end time of the cost data. + * @return the next definition stage. + */ + Update withEndDateTime(OffsetDateTime endDateTime); + } + /** The stage of the LabCost update allowing to specify createdDate. */ + interface WithCreatedDate { + /** + * Specifies the createdDate property: The creation date of the cost.. + * + * @param createdDate The creation date of the cost. + * @return the next definition stage. + */ + Update withCreatedDate(OffsetDateTime createdDate); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LabCost refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LabCost refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostDetailsProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostDetailsProperties.java new file mode 100644 index 000000000000..639e93725bea --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostDetailsProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a lab cost item. */ +@Fluent +public final class LabCostDetailsProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabCostDetailsProperties.class); + + /* + * The date of the cost item. + */ + @JsonProperty(value = "date") + private OffsetDateTime date; + + /* + * The cost component of the cost item. + */ + @JsonProperty(value = "cost") + private Double cost; + + /* + * The type of the cost. + */ + @JsonProperty(value = "costType") + private CostType costType; + + /** + * Get the date property: The date of the cost item. + * + * @return the date value. + */ + public OffsetDateTime date() { + return this.date; + } + + /** + * Set the date property: The date of the cost item. + * + * @param date the date value to set. + * @return the LabCostDetailsProperties object itself. + */ + public LabCostDetailsProperties withDate(OffsetDateTime date) { + this.date = date; + return this; + } + + /** + * Get the cost property: The cost component of the cost item. + * + * @return the cost value. + */ + public Double cost() { + return this.cost; + } + + /** + * Set the cost property: The cost component of the cost item. + * + * @param cost the cost value to set. + * @return the LabCostDetailsProperties object itself. + */ + public LabCostDetailsProperties withCost(Double cost) { + this.cost = cost; + return this; + } + + /** + * Get the costType property: The type of the cost. + * + * @return the costType value. + */ + public CostType costType() { + return this.costType; + } + + /** + * Set the costType property: The type of the cost. + * + * @param costType the costType value to set. + * @return the LabCostDetailsProperties object itself. + */ + public LabCostDetailsProperties withCostType(CostType costType) { + this.costType = costType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostSummaryProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostSummaryProperties.java new file mode 100644 index 000000000000..d9db34eebd68 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCostSummaryProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the cost summary. */ +@Fluent +public final class LabCostSummaryProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabCostSummaryProperties.class); + + /* + * The cost component of the cost item. + */ + @JsonProperty(value = "estimatedLabCost") + private Double estimatedLabCost; + + /** + * Get the estimatedLabCost property: The cost component of the cost item. + * + * @return the estimatedLabCost value. + */ + public Double estimatedLabCost() { + return this.estimatedLabCost; + } + + /** + * Set the estimatedLabCost property: The cost component of the cost item. + * + * @param estimatedLabCost the estimatedLabCost value to set. + * @return the LabCostSummaryProperties object itself. + */ + public LabCostSummaryProperties withEstimatedLabCost(Double estimatedLabCost) { + this.estimatedLabCost = estimatedLabCost; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabFragment.java new file mode 100644 index 000000000000..18296f1d5f5f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A lab. */ +@Immutable +public final class LabFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabFragment.class); + + /** {@inheritDoc} */ + @Override + public LabFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabList.java new file mode 100644 index 000000000000..be5a252f099d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class LabList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the LabList object itself. + */ + public LabList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the LabList object itself. + */ + public LabList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabResourceCostProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabResourceCostProperties.java new file mode 100644 index 000000000000..433d7ccfcd7f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabResourceCostProperties.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a resource cost item. */ +@Fluent +public final class LabResourceCostProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabResourceCostProperties.class); + + /* + * The name of the resource. + */ + @JsonProperty(value = "resourcename") + private String resourcename; + + /* + * The unique identifier of the resource. + */ + @JsonProperty(value = "resourceUId") + private String resourceUId; + + /* + * The cost component of the resource cost item. + */ + @JsonProperty(value = "resourceCost") + private Double resourceCost; + + /* + * The logical resource type (ex. virtualmachine, storageaccount) + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * The owner of the resource (ex. janedoe@microsoft.com) + */ + @JsonProperty(value = "resourceOwner") + private String resourceOwner; + + /* + * The category of the resource (ex. Premium_LRS, Standard_DS1) + */ + @JsonProperty(value = "resourcePricingTier") + private String resourcePricingTier; + + /* + * The status of the resource (ex. Active) + */ + @JsonProperty(value = "resourceStatus") + private String resourceStatus; + + /* + * The ID of the resource + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The ID of the external resource + */ + @JsonProperty(value = "externalResourceId") + private String externalResourceId; + + /** + * Get the resourcename property: The name of the resource. + * + * @return the resourcename value. + */ + public String resourcename() { + return this.resourcename; + } + + /** + * Set the resourcename property: The name of the resource. + * + * @param resourcename the resourcename value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourcename(String resourcename) { + this.resourcename = resourcename; + return this; + } + + /** + * Get the resourceUId property: The unique identifier of the resource. + * + * @return the resourceUId value. + */ + public String resourceUId() { + return this.resourceUId; + } + + /** + * Set the resourceUId property: The unique identifier of the resource. + * + * @param resourceUId the resourceUId value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceUId(String resourceUId) { + this.resourceUId = resourceUId; + return this; + } + + /** + * Get the resourceCost property: The cost component of the resource cost item. + * + * @return the resourceCost value. + */ + public Double resourceCost() { + return this.resourceCost; + } + + /** + * Set the resourceCost property: The cost component of the resource cost item. + * + * @param resourceCost the resourceCost value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceCost(Double resourceCost) { + this.resourceCost = resourceCost; + return this; + } + + /** + * Get the resourceType property: The logical resource type (ex. virtualmachine, storageaccount). + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The logical resource type (ex. virtualmachine, storageaccount). + * + * @param resourceType the resourceType value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the resourceOwner property: The owner of the resource (ex. janedoe@microsoft.com). + * + * @return the resourceOwner value. + */ + public String resourceOwner() { + return this.resourceOwner; + } + + /** + * Set the resourceOwner property: The owner of the resource (ex. janedoe@microsoft.com). + * + * @param resourceOwner the resourceOwner value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceOwner(String resourceOwner) { + this.resourceOwner = resourceOwner; + return this; + } + + /** + * Get the resourcePricingTier property: The category of the resource (ex. Premium_LRS, Standard_DS1). + * + * @return the resourcePricingTier value. + */ + public String resourcePricingTier() { + return this.resourcePricingTier; + } + + /** + * Set the resourcePricingTier property: The category of the resource (ex. Premium_LRS, Standard_DS1). + * + * @param resourcePricingTier the resourcePricingTier value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourcePricingTier(String resourcePricingTier) { + this.resourcePricingTier = resourcePricingTier; + return this; + } + + /** + * Get the resourceStatus property: The status of the resource (ex. Active). + * + * @return the resourceStatus value. + */ + public String resourceStatus() { + return this.resourceStatus; + } + + /** + * Set the resourceStatus property: The status of the resource (ex. Active). + * + * @param resourceStatus the resourceStatus value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceStatus(String resourceStatus) { + this.resourceStatus = resourceStatus; + return this; + } + + /** + * Get the resourceId property: The ID of the resource. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The ID of the resource. + * + * @param resourceId the resourceId value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the externalResourceId property: The ID of the external resource. + * + * @return the externalResourceId value. + */ + public String externalResourceId() { + return this.externalResourceId; + } + + /** + * Set the externalResourceId property: The ID of the external resource. + * + * @param externalResourceId the externalResourceId value to set. + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withExternalResourceId(String externalResourceId) { + this.externalResourceId = externalResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabSupportProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabSupportProperties.java new file mode 100644 index 000000000000..e22bb44b49cf --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabSupportProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a lab's support banner. */ +@Fluent +public final class LabSupportProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabSupportProperties.class); + + /* + * Is the lab support banner active/enabled at this time? + */ + @JsonProperty(value = "enabled") + private EnableStatus enabled; + + /* + * The markdown text (if any) that this lab displays in the UI. If left + * empty/null, nothing will be shown. + */ + @JsonProperty(value = "markdown") + private String markdown; + + /** + * Get the enabled property: Is the lab support banner active/enabled at this time?. + * + * @return the enabled value. + */ + public EnableStatus enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is the lab support banner active/enabled at this time?. + * + * @param enabled the enabled value to set. + * @return the LabSupportProperties object itself. + */ + public LabSupportProperties withEnabled(EnableStatus enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the markdown property: The markdown text (if any) that this lab displays in the UI. If left empty/null, + * nothing will be shown. + * + * @return the markdown value. + */ + public String markdown() { + return this.markdown; + } + + /** + * Set the markdown property: The markdown text (if any) that this lab displays in the UI. If left empty/null, + * nothing will be shown. + * + * @param markdown the markdown value to set. + * @return the LabSupportProperties object itself. + */ + public LabSupportProperties withMarkdown(String markdown) { + this.markdown = markdown; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhd.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhd.java new file mode 100644 index 000000000000..1cc8609b5c69 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhd.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVhdInner; + +/** An immutable client-side representation of LabVhd. */ +public interface LabVhd { + /** + * Gets the id property: The URI to the VHD. + * + * @return the id value. + */ + String id(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.LabVhdInner object. + * + * @return the inner object. + */ + LabVhdInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhdList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhdList.java new file mode 100644 index 000000000000..c56180269280 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVhdList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVhdInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class LabVhdList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabVhdList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the LabVhdList object itself. + */ + public LabVhdList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the LabVhdList object itself. + */ + public LabVhdList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachine.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachine.java new file mode 100644 index 000000000000..b98618489a9f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachine.java @@ -0,0 +1,958 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVirtualMachineInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of LabVirtualMachine. */ +public interface LabVirtualMachine { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the notes property: The notes of the virtual machine. + * + * @return the notes value. + */ + String notes(); + + /** + * Gets the ownerObjectId property: The object identifier of the owner of the virtual machine. + * + * @return the ownerObjectId value. + */ + String ownerObjectId(); + + /** + * Gets the ownerUserPrincipalName property: The user principal name of the virtual machine owner. + * + * @return the ownerUserPrincipalName value. + */ + String ownerUserPrincipalName(); + + /** + * Gets the createdByUserId property: The object identifier of the creator of the virtual machine. + * + * @return the createdByUserId value. + */ + String createdByUserId(); + + /** + * Gets the createdByUser property: The email address of creator of the virtual machine. + * + * @return the createdByUser value. + */ + String createdByUser(); + + /** + * Gets the createdDate property: The creation date of the virtual machine. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the computeId property: The resource identifier (Microsoft.Compute) of the virtual machine. + * + * @return the computeId value. + */ + String computeId(); + + /** + * Gets the customImageId property: The custom image identifier of the virtual machine. + * + * @return the customImageId value. + */ + String customImageId(); + + /** + * Gets the osType property: The OS type of the virtual machine. + * + * @return the osType value. + */ + String osType(); + + /** + * Gets the size property: The size of the virtual machine. + * + * @return the size value. + */ + String size(); + + /** + * Gets the username property: The user name of the virtual machine. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: The password of the virtual machine administrator. + * + * @return the password value. + */ + String password(); + + /** + * Gets the sshKey property: The SSH key of the virtual machine administrator. + * + * @return the sshKey value. + */ + String sshKey(); + + /** + * Gets the isAuthenticationWithSshKey property: Indicates whether this virtual machine uses an SSH key for + * authentication. + * + * @return the isAuthenticationWithSshKey value. + */ + Boolean isAuthenticationWithSshKey(); + + /** + * Gets the fqdn property: The fully-qualified domain name of the virtual machine. + * + * @return the fqdn value. + */ + String fqdn(); + + /** + * Gets the labSubnetName property: The lab subnet name of the virtual machine. + * + * @return the labSubnetName value. + */ + String labSubnetName(); + + /** + * Gets the labVirtualNetworkId property: The lab virtual network identifier of the virtual machine. + * + * @return the labVirtualNetworkId value. + */ + String labVirtualNetworkId(); + + /** + * Gets the disallowPublicIpAddress property: Indicates whether the virtual machine is to be created without a + * public IP address. + * + * @return the disallowPublicIpAddress value. + */ + Boolean disallowPublicIpAddress(); + + /** + * Gets the artifacts property: The artifacts to be installed on the virtual machine. + * + * @return the artifacts value. + */ + List artifacts(); + + /** + * Gets the artifactDeploymentStatus property: The artifact deployment status for the virtual machine. + * + * @return the artifactDeploymentStatus value. + */ + ArtifactDeploymentStatusProperties artifactDeploymentStatus(); + + /** + * Gets the galleryImageReference property: The Microsoft Azure Marketplace image reference of the virtual machine. + * + * @return the galleryImageReference value. + */ + GalleryImageReference galleryImageReference(); + + /** + * Gets the planId property: The id of the plan associated with the virtual machine image. + * + * @return the planId value. + */ + String planId(); + + /** + * Gets the computeVm property: The compute virtual machine properties. + * + * @return the computeVm value. + */ + ComputeVmProperties computeVm(); + + /** + * Gets the networkInterface property: The network interface properties. + * + * @return the networkInterface value. + */ + NetworkInterfaceProperties networkInterface(); + + /** + * Gets the applicableSchedule property: The applicable schedule for the virtual machine. + * + * @return the applicableSchedule value. + */ + ApplicableSchedule applicableSchedule(); + + /** + * Gets the expirationDate property: The expiration date for VM. + * + * @return the expirationDate value. + */ + OffsetDateTime expirationDate(); + + /** + * Gets the allowClaim property: Indicates whether another user can take ownership of the virtual machine. + * + * @return the allowClaim value. + */ + Boolean allowClaim(); + + /** + * Gets the storageType property: Storage type to use for virtual machine (i.e. Standard, Premium). + * + * @return the storageType value. + */ + String storageType(); + + /** + * Gets the virtualMachineCreationSource property: Tells source of creation of lab virtual machine. Output property + * only. + * + * @return the virtualMachineCreationSource value. + */ + VirtualMachineCreationSource virtualMachineCreationSource(); + + /** + * Gets the environmentId property: The resource ID of the environment that contains this virtual machine, if any. + * + * @return the environmentId value. + */ + String environmentId(); + + /** + * Gets the dataDiskParameters property: New or existing data disks to attach to the virtual machine after creation. + * + * @return the dataDiskParameters value. + */ + List dataDiskParameters(); + + /** + * Gets the scheduleParameters property: Virtual Machine schedules to be created. + * + * @return the scheduleParameters value. + */ + List scheduleParameters(); + + /** + * Gets the lastKnownPowerState property: Last known compute power state captured in DTL. + * + * @return the lastKnownPowerState value. + */ + String lastKnownPowerState(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.LabVirtualMachineInner object. + * + * @return the inner object. + */ + LabVirtualMachineInner innerModel(); + + /** The entirety of the LabVirtualMachine definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The LabVirtualMachine definition stages. */ + interface DefinitionStages { + /** The first stage of the LabVirtualMachine definition. */ + interface Blank extends WithLocation { + } + /** The stage of the LabVirtualMachine definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the LabVirtualMachine definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the LabVirtualMachine definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithNotes, + DefinitionStages.WithOwnerObjectId, + DefinitionStages.WithOwnerUserPrincipalName, + DefinitionStages.WithCreatedDate, + DefinitionStages.WithCustomImageId, + DefinitionStages.WithSize, + DefinitionStages.WithUsername, + DefinitionStages.WithPassword, + DefinitionStages.WithSshKey, + DefinitionStages.WithIsAuthenticationWithSshKey, + DefinitionStages.WithLabSubnetName, + DefinitionStages.WithLabVirtualNetworkId, + DefinitionStages.WithDisallowPublicIpAddress, + DefinitionStages.WithArtifacts, + DefinitionStages.WithGalleryImageReference, + DefinitionStages.WithPlanId, + DefinitionStages.WithNetworkInterface, + DefinitionStages.WithExpirationDate, + DefinitionStages.WithAllowClaim, + DefinitionStages.WithStorageType, + DefinitionStages.WithEnvironmentId, + DefinitionStages.WithDataDiskParameters, + DefinitionStages.WithScheduleParameters { + /** + * Executes the create request. + * + * @return the created resource. + */ + LabVirtualMachine create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LabVirtualMachine create(Context context); + } + /** The stage of the LabVirtualMachine definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the LabVirtualMachine definition allowing to specify notes. */ + interface WithNotes { + /** + * Specifies the notes property: The notes of the virtual machine.. + * + * @param notes The notes of the virtual machine. + * @return the next definition stage. + */ + WithCreate withNotes(String notes); + } + /** The stage of the LabVirtualMachine definition allowing to specify ownerObjectId. */ + interface WithOwnerObjectId { + /** + * Specifies the ownerObjectId property: The object identifier of the owner of the virtual machine.. + * + * @param ownerObjectId The object identifier of the owner of the virtual machine. + * @return the next definition stage. + */ + WithCreate withOwnerObjectId(String ownerObjectId); + } + /** The stage of the LabVirtualMachine definition allowing to specify ownerUserPrincipalName. */ + interface WithOwnerUserPrincipalName { + /** + * Specifies the ownerUserPrincipalName property: The user principal name of the virtual machine owner.. + * + * @param ownerUserPrincipalName The user principal name of the virtual machine owner. + * @return the next definition stage. + */ + WithCreate withOwnerUserPrincipalName(String ownerUserPrincipalName); + } + /** The stage of the LabVirtualMachine definition allowing to specify createdDate. */ + interface WithCreatedDate { + /** + * Specifies the createdDate property: The creation date of the virtual machine.. + * + * @param createdDate The creation date of the virtual machine. + * @return the next definition stage. + */ + WithCreate withCreatedDate(OffsetDateTime createdDate); + } + /** The stage of the LabVirtualMachine definition allowing to specify customImageId. */ + interface WithCustomImageId { + /** + * Specifies the customImageId property: The custom image identifier of the virtual machine.. + * + * @param customImageId The custom image identifier of the virtual machine. + * @return the next definition stage. + */ + WithCreate withCustomImageId(String customImageId); + } + /** The stage of the LabVirtualMachine definition allowing to specify size. */ + interface WithSize { + /** + * Specifies the size property: The size of the virtual machine.. + * + * @param size The size of the virtual machine. + * @return the next definition stage. + */ + WithCreate withSize(String size); + } + /** The stage of the LabVirtualMachine definition allowing to specify username. */ + interface WithUsername { + /** + * Specifies the username property: The user name of the virtual machine.. + * + * @param username The user name of the virtual machine. + * @return the next definition stage. + */ + WithCreate withUsername(String username); + } + /** The stage of the LabVirtualMachine definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: The password of the virtual machine administrator.. + * + * @param password The password of the virtual machine administrator. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + /** The stage of the LabVirtualMachine definition allowing to specify sshKey. */ + interface WithSshKey { + /** + * Specifies the sshKey property: The SSH key of the virtual machine administrator.. + * + * @param sshKey The SSH key of the virtual machine administrator. + * @return the next definition stage. + */ + WithCreate withSshKey(String sshKey); + } + /** The stage of the LabVirtualMachine definition allowing to specify isAuthenticationWithSshKey. */ + interface WithIsAuthenticationWithSshKey { + /** + * Specifies the isAuthenticationWithSshKey property: Indicates whether this virtual machine uses an SSH key + * for authentication.. + * + * @param isAuthenticationWithSshKey Indicates whether this virtual machine uses an SSH key for + * authentication. + * @return the next definition stage. + */ + WithCreate withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey); + } + /** The stage of the LabVirtualMachine definition allowing to specify labSubnetName. */ + interface WithLabSubnetName { + /** + * Specifies the labSubnetName property: The lab subnet name of the virtual machine.. + * + * @param labSubnetName The lab subnet name of the virtual machine. + * @return the next definition stage. + */ + WithCreate withLabSubnetName(String labSubnetName); + } + /** The stage of the LabVirtualMachine definition allowing to specify labVirtualNetworkId. */ + interface WithLabVirtualNetworkId { + /** + * Specifies the labVirtualNetworkId property: The lab virtual network identifier of the virtual machine.. + * + * @param labVirtualNetworkId The lab virtual network identifier of the virtual machine. + * @return the next definition stage. + */ + WithCreate withLabVirtualNetworkId(String labVirtualNetworkId); + } + /** The stage of the LabVirtualMachine definition allowing to specify disallowPublicIpAddress. */ + interface WithDisallowPublicIpAddress { + /** + * Specifies the disallowPublicIpAddress property: Indicates whether the virtual machine is to be created + * without a public IP address.. + * + * @param disallowPublicIpAddress Indicates whether the virtual machine is to be created without a public IP + * address. + * @return the next definition stage. + */ + WithCreate withDisallowPublicIpAddress(Boolean disallowPublicIpAddress); + } + /** The stage of the LabVirtualMachine definition allowing to specify artifacts. */ + interface WithArtifacts { + /** + * Specifies the artifacts property: The artifacts to be installed on the virtual machine.. + * + * @param artifacts The artifacts to be installed on the virtual machine. + * @return the next definition stage. + */ + WithCreate withArtifacts(List artifacts); + } + /** The stage of the LabVirtualMachine definition allowing to specify galleryImageReference. */ + interface WithGalleryImageReference { + /** + * Specifies the galleryImageReference property: The Microsoft Azure Marketplace image reference of the + * virtual machine.. + * + * @param galleryImageReference The Microsoft Azure Marketplace image reference of the virtual machine. + * @return the next definition stage. + */ + WithCreate withGalleryImageReference(GalleryImageReference galleryImageReference); + } + /** The stage of the LabVirtualMachine definition allowing to specify planId. */ + interface WithPlanId { + /** + * Specifies the planId property: The id of the plan associated with the virtual machine image. + * + * @param planId The id of the plan associated with the virtual machine image. + * @return the next definition stage. + */ + WithCreate withPlanId(String planId); + } + /** The stage of the LabVirtualMachine definition allowing to specify networkInterface. */ + interface WithNetworkInterface { + /** + * Specifies the networkInterface property: The network interface properties.. + * + * @param networkInterface The network interface properties. + * @return the next definition stage. + */ + WithCreate withNetworkInterface(NetworkInterfaceProperties networkInterface); + } + /** The stage of the LabVirtualMachine definition allowing to specify expirationDate. */ + interface WithExpirationDate { + /** + * Specifies the expirationDate property: The expiration date for VM.. + * + * @param expirationDate The expiration date for VM. + * @return the next definition stage. + */ + WithCreate withExpirationDate(OffsetDateTime expirationDate); + } + /** The stage of the LabVirtualMachine definition allowing to specify allowClaim. */ + interface WithAllowClaim { + /** + * Specifies the allowClaim property: Indicates whether another user can take ownership of the virtual + * machine. + * + * @param allowClaim Indicates whether another user can take ownership of the virtual machine. + * @return the next definition stage. + */ + WithCreate withAllowClaim(Boolean allowClaim); + } + /** The stage of the LabVirtualMachine definition allowing to specify storageType. */ + interface WithStorageType { + /** + * Specifies the storageType property: Storage type to use for virtual machine (i.e. Standard, Premium).. + * + * @param storageType Storage type to use for virtual machine (i.e. Standard, Premium). + * @return the next definition stage. + */ + WithCreate withStorageType(String storageType); + } + /** The stage of the LabVirtualMachine definition allowing to specify environmentId. */ + interface WithEnvironmentId { + /** + * Specifies the environmentId property: The resource ID of the environment that contains this virtual + * machine, if any.. + * + * @param environmentId The resource ID of the environment that contains this virtual machine, if any. + * @return the next definition stage. + */ + WithCreate withEnvironmentId(String environmentId); + } + /** The stage of the LabVirtualMachine definition allowing to specify dataDiskParameters. */ + interface WithDataDiskParameters { + /** + * Specifies the dataDiskParameters property: New or existing data disks to attach to the virtual machine + * after creation. + * + * @param dataDiskParameters New or existing data disks to attach to the virtual machine after creation. + * @return the next definition stage. + */ + WithCreate withDataDiskParameters(List dataDiskParameters); + } + /** The stage of the LabVirtualMachine definition allowing to specify scheduleParameters. */ + interface WithScheduleParameters { + /** + * Specifies the scheduleParameters property: Virtual Machine schedules to be created. + * + * @param scheduleParameters Virtual Machine schedules to be created. + * @return the next definition stage. + */ + WithCreate withScheduleParameters(List scheduleParameters); + } + } + /** + * Begins update for the LabVirtualMachine resource. + * + * @return the stage of resource update. + */ + LabVirtualMachine.Update update(); + + /** The template for LabVirtualMachine update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LabVirtualMachine apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LabVirtualMachine apply(Context context); + } + /** The LabVirtualMachine update stages. */ + interface UpdateStages { + /** The stage of the LabVirtualMachine update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LabVirtualMachine refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LabVirtualMachine refresh(Context context); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void addDataDisk(DataDiskProperties dataDiskProperties); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void addDataDisk(DataDiskProperties dataDiskProperties, Context context); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void applyArtifacts(ApplyArtifactsRequest applyArtifactsRequest); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void applyArtifacts(ApplyArtifactsRequest applyArtifactsRequest, Context context); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claim(); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claim(Context context); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detachDataDisk(DetachDataDiskProperties detachDataDiskProperties); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detachDataDisk(DetachDataDiskProperties detachDataDiskProperties, Context context); + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + RdpConnection getRdpFileContents(); + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + Response getRdpFileContentsWithResponse(Context context); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + ApplicableSchedule listApplicableSchedules(); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + Response listApplicableSchedulesWithResponse(Context context); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(Context context); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resize(ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resize(ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, Context context); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(Context context); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(Context context); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void transferDisks(); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void transferDisks(Context context); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void unClaim(); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void unClaim(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineCreationParameter.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineCreationParameter.java new file mode 100644 index 000000000000..d4954b1acd96 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineCreationParameter.java @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Properties for creating a virtual machine. */ +@JsonFlatten +@Fluent +public class LabVirtualMachineCreationParameter { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabVirtualMachineCreationParameter.class); + + /* + * The name of the virtual machine or environment + */ + @JsonProperty(value = "name") + private String name; + + /* + * The location of the new virtual machine or environment + */ + @JsonProperty(value = "location") + private String location; + + /* + * The tags of the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The number of virtual machine instances to create. + */ + @JsonProperty(value = "properties.bulkCreationParameters") + private BulkCreationParameters bulkCreationParameters; + + /* + * The notes of the virtual machine. + */ + @JsonProperty(value = "properties.notes") + private String notes; + + /* + * The object identifier of the owner of the virtual machine. + */ + @JsonProperty(value = "properties.ownerObjectId") + private String ownerObjectId; + + /* + * The user principal name of the virtual machine owner. + */ + @JsonProperty(value = "properties.ownerUserPrincipalName") + private String ownerUserPrincipalName; + + /* + * The creation date of the virtual machine. + */ + @JsonProperty(value = "properties.createdDate") + private OffsetDateTime createdDate; + + /* + * The custom image identifier of the virtual machine. + */ + @JsonProperty(value = "properties.customImageId") + private String customImageId; + + /* + * The size of the virtual machine. + */ + @JsonProperty(value = "properties.size") + private String size; + + /* + * The user name of the virtual machine. + */ + @JsonProperty(value = "properties.userName") + private String username; + + /* + * The password of the virtual machine administrator. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * The SSH key of the virtual machine administrator. + */ + @JsonProperty(value = "properties.sshKey") + private String sshKey; + + /* + * Indicates whether this virtual machine uses an SSH key for + * authentication. + */ + @JsonProperty(value = "properties.isAuthenticationWithSshKey") + private Boolean isAuthenticationWithSshKey; + + /* + * The lab subnet name of the virtual machine. + */ + @JsonProperty(value = "properties.labSubnetName") + private String labSubnetName; + + /* + * The lab virtual network identifier of the virtual machine. + */ + @JsonProperty(value = "properties.labVirtualNetworkId") + private String labVirtualNetworkId; + + /* + * Indicates whether the virtual machine is to be created without a public + * IP address. + */ + @JsonProperty(value = "properties.disallowPublicIpAddress") + private Boolean disallowPublicIpAddress; + + /* + * The artifacts to be installed on the virtual machine. + */ + @JsonProperty(value = "properties.artifacts") + private List artifacts; + + /* + * The Microsoft Azure Marketplace image reference of the virtual machine. + */ + @JsonProperty(value = "properties.galleryImageReference") + private GalleryImageReference galleryImageReference; + + /* + * The id of the plan associated with the virtual machine image + */ + @JsonProperty(value = "properties.planId") + private String planId; + + /* + * The network interface properties. + */ + @JsonProperty(value = "properties.networkInterface") + private NetworkInterfaceProperties networkInterface; + + /* + * The expiration date for VM. + */ + @JsonProperty(value = "properties.expirationDate") + private OffsetDateTime expirationDate; + + /* + * Indicates whether another user can take ownership of the virtual machine + */ + @JsonProperty(value = "properties.allowClaim") + private Boolean allowClaim; + + /* + * Storage type to use for virtual machine (i.e. Standard, Premium). + */ + @JsonProperty(value = "properties.storageType") + private String storageType; + + /* + * The resource ID of the environment that contains this virtual machine, + * if any. + */ + @JsonProperty(value = "properties.environmentId") + private String environmentId; + + /* + * New or existing data disks to attach to the virtual machine after + * creation + */ + @JsonProperty(value = "properties.dataDiskParameters") + private List dataDiskParameters; + + /* + * Virtual Machine schedules to be created + */ + @JsonProperty(value = "properties.scheduleParameters") + private List scheduleParameters; + + /** + * Get the name property: The name of the virtual machine or environment. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the virtual machine or environment. + * + * @param name the name value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location property: The location of the new virtual machine or environment. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the new virtual machine or environment. + * + * @param location the location value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: The tags of the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags of the resource. + * + * @param tags the tags value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the bulkCreationParameters property: The number of virtual machine instances to create. + * + * @return the bulkCreationParameters value. + */ + public BulkCreationParameters bulkCreationParameters() { + return this.bulkCreationParameters; + } + + /** + * Set the bulkCreationParameters property: The number of virtual machine instances to create. + * + * @param bulkCreationParameters the bulkCreationParameters value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withBulkCreationParameters( + BulkCreationParameters bulkCreationParameters) { + this.bulkCreationParameters = bulkCreationParameters; + return this; + } + + /** + * Get the notes property: The notes of the virtual machine. + * + * @return the notes value. + */ + public String notes() { + return this.notes; + } + + /** + * Set the notes property: The notes of the virtual machine. + * + * @param notes the notes value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withNotes(String notes) { + this.notes = notes; + return this; + } + + /** + * Get the ownerObjectId property: The object identifier of the owner of the virtual machine. + * + * @return the ownerObjectId value. + */ + public String ownerObjectId() { + return this.ownerObjectId; + } + + /** + * Set the ownerObjectId property: The object identifier of the owner of the virtual machine. + * + * @param ownerObjectId the ownerObjectId value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withOwnerObjectId(String ownerObjectId) { + this.ownerObjectId = ownerObjectId; + return this; + } + + /** + * Get the ownerUserPrincipalName property: The user principal name of the virtual machine owner. + * + * @return the ownerUserPrincipalName value. + */ + public String ownerUserPrincipalName() { + return this.ownerUserPrincipalName; + } + + /** + * Set the ownerUserPrincipalName property: The user principal name of the virtual machine owner. + * + * @param ownerUserPrincipalName the ownerUserPrincipalName value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withOwnerUserPrincipalName(String ownerUserPrincipalName) { + this.ownerUserPrincipalName = ownerUserPrincipalName; + return this; + } + + /** + * Get the createdDate property: The creation date of the virtual machine. + * + * @return the createdDate value. + */ + public OffsetDateTime createdDate() { + return this.createdDate; + } + + /** + * Set the createdDate property: The creation date of the virtual machine. + * + * @param createdDate the createdDate value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withCreatedDate(OffsetDateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the customImageId property: The custom image identifier of the virtual machine. + * + * @return the customImageId value. + */ + public String customImageId() { + return this.customImageId; + } + + /** + * Set the customImageId property: The custom image identifier of the virtual machine. + * + * @param customImageId the customImageId value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withCustomImageId(String customImageId) { + this.customImageId = customImageId; + return this; + } + + /** + * Get the size property: The size of the virtual machine. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The size of the virtual machine. + * + * @param size the size value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the username property: The user name of the virtual machine. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name of the virtual machine. + * + * @param username the username value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password of the virtual machine administrator. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password of the virtual machine administrator. + * + * @param password the password value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the sshKey property: The SSH key of the virtual machine administrator. + * + * @return the sshKey value. + */ + public String sshKey() { + return this.sshKey; + } + + /** + * Set the sshKey property: The SSH key of the virtual machine administrator. + * + * @param sshKey the sshKey value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withSshKey(String sshKey) { + this.sshKey = sshKey; + return this; + } + + /** + * Get the isAuthenticationWithSshKey property: Indicates whether this virtual machine uses an SSH key for + * authentication. + * + * @return the isAuthenticationWithSshKey value. + */ + public Boolean isAuthenticationWithSshKey() { + return this.isAuthenticationWithSshKey; + } + + /** + * Set the isAuthenticationWithSshKey property: Indicates whether this virtual machine uses an SSH key for + * authentication. + * + * @param isAuthenticationWithSshKey the isAuthenticationWithSshKey value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey) { + this.isAuthenticationWithSshKey = isAuthenticationWithSshKey; + return this; + } + + /** + * Get the labSubnetName property: The lab subnet name of the virtual machine. + * + * @return the labSubnetName value. + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set the labSubnetName property: The lab subnet name of the virtual machine. + * + * @param labSubnetName the labSubnetName value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get the labVirtualNetworkId property: The lab virtual network identifier of the virtual machine. + * + * @return the labVirtualNetworkId value. + */ + public String labVirtualNetworkId() { + return this.labVirtualNetworkId; + } + + /** + * Set the labVirtualNetworkId property: The lab virtual network identifier of the virtual machine. + * + * @param labVirtualNetworkId the labVirtualNetworkId value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withLabVirtualNetworkId(String labVirtualNetworkId) { + this.labVirtualNetworkId = labVirtualNetworkId; + return this; + } + + /** + * Get the disallowPublicIpAddress property: Indicates whether the virtual machine is to be created without a public + * IP address. + * + * @return the disallowPublicIpAddress value. + */ + public Boolean disallowPublicIpAddress() { + return this.disallowPublicIpAddress; + } + + /** + * Set the disallowPublicIpAddress property: Indicates whether the virtual machine is to be created without a public + * IP address. + * + * @param disallowPublicIpAddress the disallowPublicIpAddress value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withDisallowPublicIpAddress(Boolean disallowPublicIpAddress) { + this.disallowPublicIpAddress = disallowPublicIpAddress; + return this; + } + + /** + * Get the artifacts property: The artifacts to be installed on the virtual machine. + * + * @return the artifacts value. + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Set the artifacts property: The artifacts to be installed on the virtual machine. + * + * @param artifacts the artifacts value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withArtifacts(List artifacts) { + this.artifacts = artifacts; + return this; + } + + /** + * Get the galleryImageReference property: The Microsoft Azure Marketplace image reference of the virtual machine. + * + * @return the galleryImageReference value. + */ + public GalleryImageReference galleryImageReference() { + return this.galleryImageReference; + } + + /** + * Set the galleryImageReference property: The Microsoft Azure Marketplace image reference of the virtual machine. + * + * @param galleryImageReference the galleryImageReference value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withGalleryImageReference(GalleryImageReference galleryImageReference) { + this.galleryImageReference = galleryImageReference; + return this; + } + + /** + * Get the planId property: The id of the plan associated with the virtual machine image. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: The id of the plan associated with the virtual machine image. + * + * @param planId the planId value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the networkInterface property: The network interface properties. + * + * @return the networkInterface value. + */ + public NetworkInterfaceProperties networkInterface() { + return this.networkInterface; + } + + /** + * Set the networkInterface property: The network interface properties. + * + * @param networkInterface the networkInterface value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withNetworkInterface(NetworkInterfaceProperties networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Get the expirationDate property: The expiration date for VM. + * + * @return the expirationDate value. + */ + public OffsetDateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set the expirationDate property: The expiration date for VM. + * + * @param expirationDate the expirationDate value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withExpirationDate(OffsetDateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get the allowClaim property: Indicates whether another user can take ownership of the virtual machine. + * + * @return the allowClaim value. + */ + public Boolean allowClaim() { + return this.allowClaim; + } + + /** + * Set the allowClaim property: Indicates whether another user can take ownership of the virtual machine. + * + * @param allowClaim the allowClaim value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withAllowClaim(Boolean allowClaim) { + this.allowClaim = allowClaim; + return this; + } + + /** + * Get the storageType property: Storage type to use for virtual machine (i.e. Standard, Premium). + * + * @return the storageType value. + */ + public String storageType() { + return this.storageType; + } + + /** + * Set the storageType property: Storage type to use for virtual machine (i.e. Standard, Premium). + * + * @param storageType the storageType value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withStorageType(String storageType) { + this.storageType = storageType; + return this; + } + + /** + * Get the environmentId property: The resource ID of the environment that contains this virtual machine, if any. + * + * @return the environmentId value. + */ + public String environmentId() { + return this.environmentId; + } + + /** + * Set the environmentId property: The resource ID of the environment that contains this virtual machine, if any. + * + * @param environmentId the environmentId value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withEnvironmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Get the dataDiskParameters property: New or existing data disks to attach to the virtual machine after creation. + * + * @return the dataDiskParameters value. + */ + public List dataDiskParameters() { + return this.dataDiskParameters; + } + + /** + * Set the dataDiskParameters property: New or existing data disks to attach to the virtual machine after creation. + * + * @param dataDiskParameters the dataDiskParameters value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withDataDiskParameters(List dataDiskParameters) { + this.dataDiskParameters = dataDiskParameters; + return this; + } + + /** + * Get the scheduleParameters property: Virtual Machine schedules to be created. + * + * @return the scheduleParameters value. + */ + public List scheduleParameters() { + return this.scheduleParameters; + } + + /** + * Set the scheduleParameters property: Virtual Machine schedules to be created. + * + * @param scheduleParameters the scheduleParameters value to set. + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withScheduleParameters( + List scheduleParameters) { + this.scheduleParameters = scheduleParameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (bulkCreationParameters() != null) { + bulkCreationParameters().validate(); + } + if (artifacts() != null) { + artifacts().forEach(e -> e.validate()); + } + if (galleryImageReference() != null) { + galleryImageReference().validate(); + } + if (networkInterface() != null) { + networkInterface().validate(); + } + if (dataDiskParameters() != null) { + dataDiskParameters().forEach(e -> e.validate()); + } + if (scheduleParameters() != null) { + scheduleParameters().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineFragment.java new file mode 100644 index 000000000000..60feabce04c6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A virtual machine. */ +@Immutable +public final class LabVirtualMachineFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabVirtualMachineFragment.class); + + /** {@inheritDoc} */ + @Override + public LabVirtualMachineFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineList.java new file mode 100644 index 000000000000..5ad1986eeb9d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabVirtualMachineList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.LabVirtualMachineInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class LabVirtualMachineList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LabVirtualMachineList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the LabVirtualMachineList object itself. + */ + public LabVirtualMachineList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the LabVirtualMachineList object itself. + */ + public LabVirtualMachineList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Labs.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Labs.java new file mode 100644 index 000000000000..34261c9de4e8 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Labs.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Labs. */ +public interface Labs { + /** + * List labs in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(); + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String expand, String filter, Integer top, String orderby, Context context); + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, String expand, String filter, Integer top, String orderby, Context context); + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + Lab getByResourceGroup(String resourceGroupName, String name); + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String name, String expand, Context context); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String name); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String name, Context context); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claimAnyVm(String resourceGroupName, String name); + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claimAnyVm(String resourceGroupName, String name, Context context); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void createEnvironment( + String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void createEnvironment( + String resourceGroupName, + String name, + LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, + Context context); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportResourceUsage( + String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportResourceUsage( + String resourceGroupName, + String name, + ExportResourceUsageParameters exportResourceUsageParameters, + Context context); + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + GenerateUploadUriResponse generateUploadUri( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter); + + /** + * Generate a URI for uploading custom disk images to a Lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param generateUploadUriParameter Properties for generating an upload URI. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for generating an upload URI. + */ + Response generateUploadUriWithResponse( + String resourceGroupName, String name, GenerateUploadUriParameter generateUploadUriParameter, Context context); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importVirtualMachine( + String resourceGroupName, String name, ImportLabVirtualMachineRequest importLabVirtualMachineRequest); + + /** + * Import a virtual machine into a different lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param importLabVirtualMachineRequest This represents the payload required to import a virtual machine from a + * different lab into the current one. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void importVirtualMachine( + String resourceGroupName, + String name, + ImportLabVirtualMachineRequest importLabVirtualMachineRequest, + Context context); + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listVhds(String resourceGroupName, String name); + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listVhds(String resourceGroupName, String name, Context context); + + /** + * Get lab. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + Lab getById(String id); + + /** + * Get lab. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lab. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete lab. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Lab resource. + * + * @param name resource name. + * @return the first stage of the new Lab definition. + */ + Lab.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsInfo.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsInfo.java new file mode 100644 index 000000000000..b0fdefb03534 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsInfo.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a Linux OS. */ +@Fluent +public final class LinuxOsInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinuxOsInfo.class); + + /* + * The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, + * DeprovisionApplied). + */ + @JsonProperty(value = "linuxOsState") + private LinuxOsState linuxOsState; + + /** + * Get the linuxOsState property: The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, + * DeprovisionApplied). + * + * @return the linuxOsState value. + */ + public LinuxOsState linuxOsState() { + return this.linuxOsState; + } + + /** + * Set the linuxOsState property: The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, + * DeprovisionApplied). + * + * @param linuxOsState the linuxOsState value to set. + * @return the LinuxOsInfo object itself. + */ + public LinuxOsInfo withLinuxOsState(LinuxOsState linuxOsState) { + this.linuxOsState = linuxOsState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsState.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsState.java new file mode 100644 index 000000000000..961d1f44d9ed --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LinuxOsState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LinuxOsState. */ +public final class LinuxOsState extends ExpandableStringEnum { + /** Static value NonDeprovisioned for LinuxOsState. */ + public static final LinuxOsState NON_DEPROVISIONED = fromString("NonDeprovisioned"); + + /** Static value DeprovisionRequested for LinuxOsState. */ + public static final LinuxOsState DEPROVISION_REQUESTED = fromString("DeprovisionRequested"); + + /** Static value DeprovisionApplied for LinuxOsState. */ + public static final LinuxOsState DEPROVISION_APPLIED = fromString("DeprovisionApplied"); + + /** + * Creates or finds a LinuxOsState from its string representation. + * + * @param name a name to look for. + * @return the corresponding LinuxOsState. + */ + @JsonCreator + public static LinuxOsState fromString(String name) { + return fromString(name, LinuxOsState.class); + } + + /** @return known LinuxOsState values. */ + public static Collection values() { + return values(LinuxOsState.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ManagedIdentityType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ManagedIdentityType.java new file mode 100644 index 000000000000..1619cf9c2d25 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ManagedIdentityType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedIdentityType. */ +public final class ManagedIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedIdentityType. */ + public static final ManagedIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedIdentityType. */ + public static final ManagedIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedIdentityType. */ + public static final ManagedIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned,UserAssigned for ManagedIdentityType. */ + public static final ManagedIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates or finds a ManagedIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedIdentityType. + */ + @JsonCreator + public static ManagedIdentityType fromString(String name) { + return fromString(name, ManagedIdentityType.class); + } + + /** @return known ManagedIdentityType values. */ + public static Collection values() { + return values(ManagedIdentityType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NetworkInterfaceProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NetworkInterfaceProperties.java new file mode 100644 index 000000000000..98894826a3c0 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NetworkInterfaceProperties.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a network interface. */ +@Fluent +public final class NetworkInterfaceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkInterfaceProperties.class); + + /* + * The resource ID of the virtual network. + */ + @JsonProperty(value = "virtualNetworkId") + private String virtualNetworkId; + + /* + * The resource ID of the sub net. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /* + * The resource ID of the public IP address. + */ + @JsonProperty(value = "publicIpAddressId") + private String publicIpAddressId; + + /* + * The public IP address. + */ + @JsonProperty(value = "publicIpAddress") + private String publicIpAddress; + + /* + * The private IP address. + */ + @JsonProperty(value = "privateIpAddress") + private String privateIpAddress; + + /* + * The DNS name. + */ + @JsonProperty(value = "dnsName") + private String dnsName; + + /* + * The RdpAuthority property is a server DNS host name or IP address + * followed by the service port number for RDP (Remote Desktop Protocol). + */ + @JsonProperty(value = "rdpAuthority") + private String rdpAuthority; + + /* + * The SshAuthority property is a server DNS host name or IP address + * followed by the service port number for SSH. + */ + @JsonProperty(value = "sshAuthority") + private String sshAuthority; + + /* + * The configuration for sharing a public IP address across multiple + * virtual machines. + */ + @JsonProperty(value = "sharedPublicIpAddressConfiguration") + private SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration; + + /** + * Get the virtualNetworkId property: The resource ID of the virtual network. + * + * @return the virtualNetworkId value. + */ + public String virtualNetworkId() { + return this.virtualNetworkId; + } + + /** + * Set the virtualNetworkId property: The resource ID of the virtual network. + * + * @param virtualNetworkId the virtualNetworkId value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withVirtualNetworkId(String virtualNetworkId) { + this.virtualNetworkId = virtualNetworkId; + return this; + } + + /** + * Get the subnetId property: The resource ID of the sub net. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: The resource ID of the sub net. + * + * @param subnetId the subnetId value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the publicIpAddressId property: The resource ID of the public IP address. + * + * @return the publicIpAddressId value. + */ + public String publicIpAddressId() { + return this.publicIpAddressId; + } + + /** + * Set the publicIpAddressId property: The resource ID of the public IP address. + * + * @param publicIpAddressId the publicIpAddressId value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withPublicIpAddressId(String publicIpAddressId) { + this.publicIpAddressId = publicIpAddressId; + return this; + } + + /** + * Get the publicIpAddress property: The public IP address. + * + * @return the publicIpAddress value. + */ + public String publicIpAddress() { + return this.publicIpAddress; + } + + /** + * Set the publicIpAddress property: The public IP address. + * + * @param publicIpAddress the publicIpAddress value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withPublicIpAddress(String publicIpAddress) { + this.publicIpAddress = publicIpAddress; + return this; + } + + /** + * Get the privateIpAddress property: The private IP address. + * + * @return the privateIpAddress value. + */ + public String privateIpAddress() { + return this.privateIpAddress; + } + + /** + * Set the privateIpAddress property: The private IP address. + * + * @param privateIpAddress the privateIpAddress value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withPrivateIpAddress(String privateIpAddress) { + this.privateIpAddress = privateIpAddress; + return this; + } + + /** + * Get the dnsName property: The DNS name. + * + * @return the dnsName value. + */ + public String dnsName() { + return this.dnsName; + } + + /** + * Set the dnsName property: The DNS name. + * + * @param dnsName the dnsName value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withDnsName(String dnsName) { + this.dnsName = dnsName; + return this; + } + + /** + * Get the rdpAuthority property: The RdpAuthority property is a server DNS host name or IP address followed by the + * service port number for RDP (Remote Desktop Protocol). + * + * @return the rdpAuthority value. + */ + public String rdpAuthority() { + return this.rdpAuthority; + } + + /** + * Set the rdpAuthority property: The RdpAuthority property is a server DNS host name or IP address followed by the + * service port number for RDP (Remote Desktop Protocol). + * + * @param rdpAuthority the rdpAuthority value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withRdpAuthority(String rdpAuthority) { + this.rdpAuthority = rdpAuthority; + return this; + } + + /** + * Get the sshAuthority property: The SshAuthority property is a server DNS host name or IP address followed by the + * service port number for SSH. + * + * @return the sshAuthority value. + */ + public String sshAuthority() { + return this.sshAuthority; + } + + /** + * Set the sshAuthority property: The SshAuthority property is a server DNS host name or IP address followed by the + * service port number for SSH. + * + * @param sshAuthority the sshAuthority value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withSshAuthority(String sshAuthority) { + this.sshAuthority = sshAuthority; + return this; + } + + /** + * Get the sharedPublicIpAddressConfiguration property: The configuration for sharing a public IP address across + * multiple virtual machines. + * + * @return the sharedPublicIpAddressConfiguration value. + */ + public SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration() { + return this.sharedPublicIpAddressConfiguration; + } + + /** + * Set the sharedPublicIpAddressConfiguration property: The configuration for sharing a public IP address across + * multiple virtual machines. + * + * @param sharedPublicIpAddressConfiguration the sharedPublicIpAddressConfiguration value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withSharedPublicIpAddressConfiguration( + SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration) { + this.sharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sharedPublicIpAddressConfiguration() != null) { + sharedPublicIpAddressConfiguration().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannel.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannel.java new file mode 100644 index 000000000000..d50efd65dd96 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannel.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.NotificationChannelInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of NotificationChannel. */ +public interface NotificationChannel { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the webhookUrl property: The webhook URL to send notifications to. + * + * @return the webhookUrl value. + */ + String webhookUrl(); + + /** + * Gets the emailRecipient property: The email recipient to send notifications to (can be a list of semi-colon + * separated email addresses). + * + * @return the emailRecipient value. + */ + String emailRecipient(); + + /** + * Gets the notificationLocale property: The locale to use when sending a notification (fallback for unsupported + * languages is EN). + * + * @return the notificationLocale value. + */ + String notificationLocale(); + + /** + * Gets the description property: Description of notification. + * + * @return the description value. + */ + String description(); + + /** + * Gets the events property: The list of event for which this notification is enabled. + * + * @return the events value. + */ + List events(); + + /** + * Gets the createdDate property: The creation date of the notification channel. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.NotificationChannelInner object. + * + * @return the inner object. + */ + NotificationChannelInner innerModel(); + + /** The entirety of the NotificationChannel definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The NotificationChannel definition stages. */ + interface DefinitionStages { + /** The first stage of the NotificationChannel definition. */ + interface Blank extends WithLocation { + } + /** The stage of the NotificationChannel definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the NotificationChannel definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the NotificationChannel definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithWebhookUrl, + DefinitionStages.WithEmailRecipient, + DefinitionStages.WithNotificationLocale, + DefinitionStages.WithDescription, + DefinitionStages.WithEvents { + /** + * Executes the create request. + * + * @return the created resource. + */ + NotificationChannel create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NotificationChannel create(Context context); + } + /** The stage of the NotificationChannel definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the NotificationChannel definition allowing to specify webhookUrl. */ + interface WithWebhookUrl { + /** + * Specifies the webhookUrl property: The webhook URL to send notifications to.. + * + * @param webhookUrl The webhook URL to send notifications to. + * @return the next definition stage. + */ + WithCreate withWebhookUrl(String webhookUrl); + } + /** The stage of the NotificationChannel definition allowing to specify emailRecipient. */ + interface WithEmailRecipient { + /** + * Specifies the emailRecipient property: The email recipient to send notifications to (can be a list of + * semi-colon separated email addresses).. + * + * @param emailRecipient The email recipient to send notifications to (can be a list of semi-colon separated + * email addresses). + * @return the next definition stage. + */ + WithCreate withEmailRecipient(String emailRecipient); + } + /** The stage of the NotificationChannel definition allowing to specify notificationLocale. */ + interface WithNotificationLocale { + /** + * Specifies the notificationLocale property: The locale to use when sending a notification (fallback for + * unsupported languages is EN).. + * + * @param notificationLocale The locale to use when sending a notification (fallback for unsupported + * languages is EN). + * @return the next definition stage. + */ + WithCreate withNotificationLocale(String notificationLocale); + } + /** The stage of the NotificationChannel definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of notification.. + * + * @param description Description of notification. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the NotificationChannel definition allowing to specify events. */ + interface WithEvents { + /** + * Specifies the events property: The list of event for which this notification is enabled.. + * + * @param events The list of event for which this notification is enabled. + * @return the next definition stage. + */ + WithCreate withEvents(List events); + } + } + /** + * Begins update for the NotificationChannel resource. + * + * @return the stage of resource update. + */ + NotificationChannel.Update update(); + + /** The template for NotificationChannel update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NotificationChannel apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NotificationChannel apply(Context context); + } + /** The NotificationChannel update stages. */ + interface UpdateStages { + /** The stage of the NotificationChannel update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NotificationChannel refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NotificationChannel refresh(Context context); + + /** + * Send notification to provided channel. + * + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void notify(NotifyParameters notifyParameters); + + /** + * Send notification to provided channel. + * + * @param notifyParameters Properties for generating a Notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response notifyWithResponse(NotifyParameters notifyParameters, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelEventType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelEventType.java new file mode 100644 index 000000000000..b8474b8e9856 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelEventType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NotificationChannelEventType. */ +public final class NotificationChannelEventType extends ExpandableStringEnum { + /** Static value AutoShutdown for NotificationChannelEventType. */ + public static final NotificationChannelEventType AUTO_SHUTDOWN = fromString("AutoShutdown"); + + /** Static value Cost for NotificationChannelEventType. */ + public static final NotificationChannelEventType COST = fromString("Cost"); + + /** + * Creates or finds a NotificationChannelEventType from its string representation. + * + * @param name a name to look for. + * @return the corresponding NotificationChannelEventType. + */ + @JsonCreator + public static NotificationChannelEventType fromString(String name) { + return fromString(name, NotificationChannelEventType.class); + } + + /** @return known NotificationChannelEventType values. */ + public static Collection values() { + return values(NotificationChannelEventType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelFragment.java new file mode 100644 index 000000000000..f95756995d12 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A notification. */ +@Immutable +public final class NotificationChannelFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotificationChannelFragment.class); + + /** {@inheritDoc} */ + @Override + public NotificationChannelFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelList.java new file mode 100644 index 000000000000..83b46fcd73d1 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannelList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.NotificationChannelInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class NotificationChannelList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotificationChannelList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the NotificationChannelList object itself. + */ + public NotificationChannelList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the NotificationChannelList object itself. + */ + public NotificationChannelList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannels.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannels.java new file mode 100644 index 000000000000..60e368e43878 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationChannels.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of NotificationChannels. */ +public interface NotificationChannels { + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + NotificationChannel get(String resourceGroupName, String labName, String name); + + /** + * Get notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void notify(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters); + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notification channel. + * @param notifyParameters Properties for generating a Notification. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response notifyWithResponse( + String resourceGroupName, String labName, String name, NotifyParameters notifyParameters, Context context); + + /** + * Get notification channel. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + NotificationChannel getById(String id); + + /** + * Get notification channel. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return notification channel. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete notification channel. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete notification channel. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NotificationChannel resource. + * + * @param name resource name. + * @return the first stage of the new NotificationChannel definition. + */ + NotificationChannel.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationSettings.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationSettings.java new file mode 100644 index 000000000000..18dded9cf6f6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotificationSettings.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Notification settings for a schedule. */ +@Fluent +public final class NotificationSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotificationSettings.class); + + /* + * If notifications are enabled for this schedule (i.e. Enabled, Disabled). + */ + @JsonProperty(value = "status") + private EnableStatus status; + + /* + * Time in minutes before event at which notification will be sent. + */ + @JsonProperty(value = "timeInMinutes") + private Integer timeInMinutes; + + /* + * The webhook URL to which the notification will be sent. + */ + @JsonProperty(value = "webhookUrl") + private String webhookUrl; + + /* + * The email recipient to send notifications to (can be a list of + * semi-colon separated email addresses). + */ + @JsonProperty(value = "emailRecipient") + private String emailRecipient; + + /* + * The locale to use when sending a notification (fallback for unsupported + * languages is EN). + */ + @JsonProperty(value = "notificationLocale") + private String notificationLocale; + + /** + * Get the status property: If notifications are enabled for this schedule (i.e. Enabled, Disabled). + * + * @return the status value. + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status property: If notifications are enabled for this schedule (i.e. Enabled, Disabled). + * + * @param status the status value to set. + * @return the NotificationSettings object itself. + */ + public NotificationSettings withStatus(EnableStatus status) { + this.status = status; + return this; + } + + /** + * Get the timeInMinutes property: Time in minutes before event at which notification will be sent. + * + * @return the timeInMinutes value. + */ + public Integer timeInMinutes() { + return this.timeInMinutes; + } + + /** + * Set the timeInMinutes property: Time in minutes before event at which notification will be sent. + * + * @param timeInMinutes the timeInMinutes value to set. + * @return the NotificationSettings object itself. + */ + public NotificationSettings withTimeInMinutes(Integer timeInMinutes) { + this.timeInMinutes = timeInMinutes; + return this; + } + + /** + * Get the webhookUrl property: The webhook URL to which the notification will be sent. + * + * @return the webhookUrl value. + */ + public String webhookUrl() { + return this.webhookUrl; + } + + /** + * Set the webhookUrl property: The webhook URL to which the notification will be sent. + * + * @param webhookUrl the webhookUrl value to set. + * @return the NotificationSettings object itself. + */ + public NotificationSettings withWebhookUrl(String webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + + /** + * Get the emailRecipient property: The email recipient to send notifications to (can be a list of semi-colon + * separated email addresses). + * + * @return the emailRecipient value. + */ + public String emailRecipient() { + return this.emailRecipient; + } + + /** + * Set the emailRecipient property: The email recipient to send notifications to (can be a list of semi-colon + * separated email addresses). + * + * @param emailRecipient the emailRecipient value to set. + * @return the NotificationSettings object itself. + */ + public NotificationSettings withEmailRecipient(String emailRecipient) { + this.emailRecipient = emailRecipient; + return this; + } + + /** + * Get the notificationLocale property: The locale to use when sending a notification (fallback for unsupported + * languages is EN). + * + * @return the notificationLocale value. + */ + public String notificationLocale() { + return this.notificationLocale; + } + + /** + * Set the notificationLocale property: The locale to use when sending a notification (fallback for unsupported + * languages is EN). + * + * @param notificationLocale the notificationLocale value to set. + * @return the NotificationSettings object itself. + */ + public NotificationSettings withNotificationLocale(String notificationLocale) { + this.notificationLocale = notificationLocale; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotifyParameters.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotifyParameters.java new file mode 100644 index 000000000000..20e6544caad5 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/NotifyParameters.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for generating a Notification. */ +@Fluent +public final class NotifyParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotifyParameters.class); + + /* + * The type of event (i.e. AutoShutdown, Cost) + */ + @JsonProperty(value = "eventName") + private NotificationChannelEventType eventName; + + /* + * Properties for the notification in json format. + */ + @JsonProperty(value = "jsonPayload") + private String jsonPayload; + + /** + * Get the eventName property: The type of event (i.e. AutoShutdown, Cost). + * + * @return the eventName value. + */ + public NotificationChannelEventType eventName() { + return this.eventName; + } + + /** + * Set the eventName property: The type of event (i.e. AutoShutdown, Cost). + * + * @param eventName the eventName value to set. + * @return the NotifyParameters object itself. + */ + public NotifyParameters withEventName(NotificationChannelEventType eventName) { + this.eventName = eventName; + return this; + } + + /** + * Get the jsonPayload property: Properties for the notification in json format. + * + * @return the jsonPayload value. + */ + public String jsonPayload() { + return this.jsonPayload; + } + + /** + * Set the jsonPayload property: Properties for the notification in json format. + * + * @param jsonPayload the jsonPayload value to set. + * @return the NotifyParameters object itself. + */ + public NotifyParameters withJsonPayload(String jsonPayload) { + this.jsonPayload = jsonPayload; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationError.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationError.java new file mode 100644 index 000000000000..884d343f4ee6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationError.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Error details for the operation in case of a failure. */ +@Fluent +public final class OperationError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationError.class); + + /* + * The error code of the operation error. + */ + @JsonProperty(value = "code") + private String code; + + /* + * The error message of the operation error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: The error code of the operation error. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The error code of the operation error. + * + * @param code the code value to set. + * @return the OperationError object itself. + */ + public OperationError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The error message of the operation error. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The error message of the operation error. + * + * @param message the message value to set. + * @return the OperationError object itself. + */ + public OperationError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadata.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadata.java new file mode 100644 index 000000000000..0d7fd511882e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadata.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner; + +/** An immutable client-side representation of OperationMetadata. */ +public interface OperationMetadata { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that describes the operations. + * + * @return the display value. + */ + OperationMetadataDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner object. + * + * @return the inner object. + */ + OperationMetadataInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadataDisplay.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadataDisplay.java new file mode 100644 index 000000000000..14f2384dc435 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationMetadataDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that describes the operations. */ +@Fluent +public final class OperationMetadataDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationMetadataDisplay.class); + + /* + * Friendly name of the resource provider + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation type: read, write, delete, listKeys/action, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Friendly name of the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Friendly name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Friendly name of the resource provider. + * + * @param provider the provider value to set. + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource type on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource type on which the operation is performed. + * + * @param resource the resource value to set. + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type: read, write, delete, listKeys/action, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: read, write, delete, listKeys/action, etc. + * + * @param operation the operation value to set. + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Friendly name of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Friendly name of the operation. + * + * @param description the description value to set. + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationResult.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationResult.java new file mode 100644 index 000000000000..36df0a9465e5 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/OperationResult.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationResultInner; + +/** An immutable client-side representation of OperationResult. */ +public interface OperationResult { + /** + * Gets the status property: The operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the statusCode property: The status code for the operation. + * + * @return the statusCode value. + */ + HttpStatusCode statusCode(); + + /** + * Gets the error property: Error details for the operation in case of a failure. + * + * @return the error value. + */ + OperationError error(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.OperationResultInner object. + * + * @return the inner object. + */ + OperationResultInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Operations.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Operations.java new file mode 100644 index 000000000000..fb6620b923f7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Operations.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + OperationResult get(String locationName, String name); + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return operation. + */ + Response getWithResponse(String locationName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParameterInfo.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParameterInfo.java new file mode 100644 index 000000000000..49be37a38a74 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParameterInfo.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about an artifact's parameter. */ +@Fluent +public final class ParameterInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ParameterInfo.class); + + /* + * The name of the artifact parameter. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the artifact parameter. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the artifact parameter. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the artifact parameter. + * + * @param name the name value to set. + * @return the ParameterInfo object itself. + */ + public ParameterInfo withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the artifact parameter. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the artifact parameter. + * + * @param value the value value to set. + * @return the ParameterInfo object itself. + */ + public ParameterInfo withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParametersValueFileInfo.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParametersValueFileInfo.java new file mode 100644 index 000000000000..5e468a8e3fb2 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ParametersValueFileInfo.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A file containing a set of parameter values for an ARM template. */ +@Fluent +public final class ParametersValueFileInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ParametersValueFileInfo.class); + + /* + * File name. + */ + @JsonProperty(value = "fileName") + private String fileName; + + /* + * Contents of the file. + */ + @JsonProperty(value = "parametersValueInfo") + private Object parametersValueInfo; + + /** + * Get the fileName property: File name. + * + * @return the fileName value. + */ + public String fileName() { + return this.fileName; + } + + /** + * Set the fileName property: File name. + * + * @param fileName the fileName value to set. + * @return the ParametersValueFileInfo object itself. + */ + public ParametersValueFileInfo withFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get the parametersValueInfo property: Contents of the file. + * + * @return the parametersValueInfo value. + */ + public Object parametersValueInfo() { + return this.parametersValueInfo; + } + + /** + * Set the parametersValueInfo property: Contents of the file. + * + * @param parametersValueInfo the parametersValueInfo value to set. + * @return the ParametersValueFileInfo object itself. + */ + public ParametersValueFileInfo withParametersValueInfo(Object parametersValueInfo) { + this.parametersValueInfo = parametersValueInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PercentageCostThresholdProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PercentageCostThresholdProperties.java new file mode 100644 index 000000000000..706208c05507 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PercentageCostThresholdProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a percentage cost threshold. */ +@Fluent +public final class PercentageCostThresholdProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PercentageCostThresholdProperties.class); + + /* + * The cost threshold value. + */ + @JsonProperty(value = "thresholdValue") + private Double thresholdValue; + + /** + * Get the thresholdValue property: The cost threshold value. + * + * @return the thresholdValue value. + */ + public Double thresholdValue() { + return this.thresholdValue; + } + + /** + * Set the thresholdValue property: The cost threshold value. + * + * @param thresholdValue the thresholdValue value to set. + * @return the PercentageCostThresholdProperties object itself. + */ + public PercentageCostThresholdProperties withThresholdValue(Double thresholdValue) { + this.thresholdValue = thresholdValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policies.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policies.java new file mode 100644 index 000000000000..7f152836281d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policies.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Policies. */ +public interface Policies { + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String policySetName); + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String policySetName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + Policy get(String resourceGroupName, String labName, String policySetName, String name); + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + Response getWithResponse( + String resourceGroupName, String labName, String policySetName, String name, String expand, Context context); + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String policySetName, String name); + + /** + * Delete policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String labName, String policySetName, String name, Context context); + + /** + * Get policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + Policy getById(String id); + + /** + * Get policy. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=description)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return policy. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete policy. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Policy resource. + * + * @param name resource name. + * @return the first stage of the new Policy definition. + */ + Policy.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policy.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policy.java new file mode 100644 index 000000000000..80351b877744 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Policy.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.PolicyInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Policy. */ +public interface Policy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the description property: The description of the policy. + * + * @return the description value. + */ + String description(); + + /** + * Gets the status property: The status of the policy. + * + * @return the status value. + */ + PolicyStatus status(); + + /** + * Gets the factName property: The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. + * + * @return the factName value. + */ + PolicyFactName factName(); + + /** + * Gets the factData property: The fact data of the policy. + * + * @return the factData value. + */ + String factData(); + + /** + * Gets the threshold property: The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of + * values for AllowedValuesPolicy). + * + * @return the threshold value. + */ + String threshold(); + + /** + * Gets the evaluatorType property: The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). + * + * @return the evaluatorType value. + */ + PolicyEvaluatorType evaluatorType(); + + /** + * Gets the createdDate property: The creation date of the policy. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.PolicyInner object. + * + * @return the inner object. + */ + PolicyInner innerModel(); + + /** The entirety of the Policy definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The Policy definition stages. */ + interface DefinitionStages { + /** The first stage of the Policy definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Policy definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the Policy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName, policySetName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @return the next definition stage. + */ + WithCreate withExistingPolicyset(String resourceGroupName, String labName, String policySetName); + } + /** + * The stage of the Policy definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithStatus, + DefinitionStages.WithFactName, + DefinitionStages.WithFactData, + DefinitionStages.WithThreshold, + DefinitionStages.WithEvaluatorType { + /** + * Executes the create request. + * + * @return the created resource. + */ + Policy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Policy create(Context context); + } + /** The stage of the Policy definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Policy definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the policy.. + * + * @param description The description of the policy. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Policy definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: The status of the policy.. + * + * @param status The status of the policy. + * @return the next definition stage. + */ + WithCreate withStatus(PolicyStatus status); + } + /** The stage of the Policy definition allowing to specify factName. */ + interface WithFactName { + /** + * Specifies the factName property: The fact name of the policy (e.g. LabVmCount, LabVmSize, + * MaxVmsAllowedPerLab, etc.. + * + * @param factName The fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. + * @return the next definition stage. + */ + WithCreate withFactName(PolicyFactName factName); + } + /** The stage of the Policy definition allowing to specify factData. */ + interface WithFactData { + /** + * Specifies the factData property: The fact data of the policy.. + * + * @param factData The fact data of the policy. + * @return the next definition stage. + */ + WithCreate withFactData(String factData); + } + /** The stage of the Policy definition allowing to specify threshold. */ + interface WithThreshold { + /** + * Specifies the threshold property: The threshold of the policy (i.e. a number for MaxValuePolicy, and a + * JSON array of values for AllowedValuesPolicy).. + * + * @param threshold The threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of + * values for AllowedValuesPolicy). + * @return the next definition stage. + */ + WithCreate withThreshold(String threshold); + } + /** The stage of the Policy definition allowing to specify evaluatorType. */ + interface WithEvaluatorType { + /** + * Specifies the evaluatorType property: The evaluator type of the policy (i.e. AllowedValuesPolicy, + * MaxValuePolicy).. + * + * @param evaluatorType The evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). + * @return the next definition stage. + */ + WithCreate withEvaluatorType(PolicyEvaluatorType evaluatorType); + } + } + /** + * Begins update for the Policy resource. + * + * @return the stage of resource update. + */ + Policy.Update update(); + + /** The template for Policy update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Policy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Policy apply(Context context); + } + /** The Policy update stages. */ + interface UpdateStages { + /** The stage of the Policy update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Policy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Policy refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyEvaluatorType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyEvaluatorType.java new file mode 100644 index 000000000000..89b029a68bf5 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyEvaluatorType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PolicyEvaluatorType. */ +public final class PolicyEvaluatorType extends ExpandableStringEnum { + /** Static value AllowedValuesPolicy for PolicyEvaluatorType. */ + public static final PolicyEvaluatorType ALLOWED_VALUES_POLICY = fromString("AllowedValuesPolicy"); + + /** Static value MaxValuePolicy for PolicyEvaluatorType. */ + public static final PolicyEvaluatorType MAX_VALUE_POLICY = fromString("MaxValuePolicy"); + + /** + * Creates or finds a PolicyEvaluatorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PolicyEvaluatorType. + */ + @JsonCreator + public static PolicyEvaluatorType fromString(String name) { + return fromString(name, PolicyEvaluatorType.class); + } + + /** @return known PolicyEvaluatorType values. */ + public static Collection values() { + return values(PolicyEvaluatorType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFactName.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFactName.java new file mode 100644 index 000000000000..c3de33885945 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFactName.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PolicyFactName. */ +public final class PolicyFactName extends ExpandableStringEnum { + /** Static value UserOwnedLabVmCount for PolicyFactName. */ + public static final PolicyFactName USER_OWNED_LAB_VM_COUNT = fromString("UserOwnedLabVmCount"); + + /** Static value UserOwnedLabPremiumVmCount for PolicyFactName. */ + public static final PolicyFactName USER_OWNED_LAB_PREMIUM_VM_COUNT = fromString("UserOwnedLabPremiumVmCount"); + + /** Static value LabVmCount for PolicyFactName. */ + public static final PolicyFactName LAB_VM_COUNT = fromString("LabVmCount"); + + /** Static value LabPremiumVmCount for PolicyFactName. */ + public static final PolicyFactName LAB_PREMIUM_VM_COUNT = fromString("LabPremiumVmCount"); + + /** Static value LabVmSize for PolicyFactName. */ + public static final PolicyFactName LAB_VM_SIZE = fromString("LabVmSize"); + + /** Static value GalleryImage for PolicyFactName. */ + public static final PolicyFactName GALLERY_IMAGE = fromString("GalleryImage"); + + /** Static value UserOwnedLabVmCountInSubnet for PolicyFactName. */ + public static final PolicyFactName USER_OWNED_LAB_VM_COUNT_IN_SUBNET = fromString("UserOwnedLabVmCountInSubnet"); + + /** Static value LabTargetCost for PolicyFactName. */ + public static final PolicyFactName LAB_TARGET_COST = fromString("LabTargetCost"); + + /** Static value EnvironmentTemplate for PolicyFactName. */ + public static final PolicyFactName ENVIRONMENT_TEMPLATE = fromString("EnvironmentTemplate"); + + /** Static value ScheduleEditPermission for PolicyFactName. */ + public static final PolicyFactName SCHEDULE_EDIT_PERMISSION = fromString("ScheduleEditPermission"); + + /** + * Creates or finds a PolicyFactName from its string representation. + * + * @param name a name to look for. + * @return the corresponding PolicyFactName. + */ + @JsonCreator + public static PolicyFactName fromString(String name) { + return fromString(name, PolicyFactName.class); + } + + /** @return known PolicyFactName values. */ + public static Collection values() { + return values(PolicyFactName.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFragment.java new file mode 100644 index 000000000000..92b3b1f13b57 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A Policy. */ +@Immutable +public final class PolicyFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyFragment.class); + + /** {@inheritDoc} */ + @Override + public PolicyFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyList.java new file mode 100644 index 000000000000..322f4cb081eb --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.PolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class PolicyList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the PolicyList object itself. + */ + public PolicyList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the PolicyList object itself. + */ + public PolicyList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySetResult.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySetResult.java new file mode 100644 index 000000000000..a1e279f54b3a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySetResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of a policy set evaluation. */ +@Fluent +public final class PolicySetResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicySetResult.class); + + /* + * A value indicating whether this policy set evaluation has discovered + * violations. + */ + @JsonProperty(value = "hasError") + private Boolean hasError; + + /* + * The list of policy violations. + */ + @JsonProperty(value = "policyViolations") + private List policyViolations; + + /** + * Get the hasError property: A value indicating whether this policy set evaluation has discovered violations. + * + * @return the hasError value. + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Set the hasError property: A value indicating whether this policy set evaluation has discovered violations. + * + * @param hasError the hasError value to set. + * @return the PolicySetResult object itself. + */ + public PolicySetResult withHasError(Boolean hasError) { + this.hasError = hasError; + return this; + } + + /** + * Get the policyViolations property: The list of policy violations. + * + * @return the policyViolations value. + */ + public List policyViolations() { + return this.policyViolations; + } + + /** + * Set the policyViolations property: The list of policy violations. + * + * @param policyViolations the policyViolations value to set. + * @return the PolicySetResult object itself. + */ + public PolicySetResult withPolicyViolations(List policyViolations) { + this.policyViolations = policyViolations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyViolations() != null) { + policyViolations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySets.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySets.java new file mode 100644 index 000000000000..51b4e62b90f7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicySets.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PolicySets. */ +public interface PolicySets { + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + EvaluatePoliciesResponse evaluatePolicies( + String resourceGroupName, String labName, String name, EvaluatePoliciesRequest evaluatePoliciesRequest); + + /** + * Evaluates lab policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the policy set. + * @param evaluatePoliciesRequest Request body for evaluating a policy set. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response body for evaluating a policy set. + */ + Response evaluatePoliciesWithResponse( + String resourceGroupName, + String labName, + String name, + EvaluatePoliciesRequest evaluatePoliciesRequest, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyStatus.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyStatus.java new file mode 100644 index 000000000000..be277ac42b8d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PolicyStatus. */ +public final class PolicyStatus extends ExpandableStringEnum { + /** Static value Enabled for PolicyStatus. */ + public static final PolicyStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for PolicyStatus. */ + public static final PolicyStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PolicyStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PolicyStatus. + */ + @JsonCreator + public static PolicyStatus fromString(String name) { + return fromString(name, PolicyStatus.class); + } + + /** @return known PolicyStatus values. */ + public static Collection values() { + return values(PolicyStatus.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyViolation.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyViolation.java new file mode 100644 index 000000000000..c019bb40d437 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PolicyViolation.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Policy violation. */ +@Fluent +public final class PolicyViolation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyViolation.class); + + /* + * The code of the policy violation. + */ + @JsonProperty(value = "code") + private String code; + + /* + * The message of the policy violation. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: The code of the policy violation. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The code of the policy violation. + * + * @param code the code value to set. + * @return the PolicyViolation object itself. + */ + public PolicyViolation withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The message of the policy violation. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message of the policy violation. + * + * @param message the message value to set. + * @return the PolicyViolation object itself. + */ + public PolicyViolation withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Port.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Port.java new file mode 100644 index 000000000000..50c21d139e0a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Port.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a network port. */ +@Fluent +public final class Port { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Port.class); + + /* + * Protocol type of the port. + */ + @JsonProperty(value = "transportProtocol") + private TransportProtocol transportProtocol; + + /* + * Backend port of the target virtual machine. + */ + @JsonProperty(value = "backendPort") + private Integer backendPort; + + /** + * Get the transportProtocol property: Protocol type of the port. + * + * @return the transportProtocol value. + */ + public TransportProtocol transportProtocol() { + return this.transportProtocol; + } + + /** + * Set the transportProtocol property: Protocol type of the port. + * + * @param transportProtocol the transportProtocol value to set. + * @return the Port object itself. + */ + public Port withTransportProtocol(TransportProtocol transportProtocol) { + this.transportProtocol = transportProtocol; + return this; + } + + /** + * Get the backendPort property: Backend port of the target virtual machine. + * + * @return the backendPort value. + */ + public Integer backendPort() { + return this.backendPort; + } + + /** + * Set the backendPort property: Backend port of the target virtual machine. + * + * @param backendPort the backendPort value to set. + * @return the Port object itself. + */ + public Port withBackendPort(Integer backendPort) { + this.backendPort = backendPort; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PremiumDataDisk.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PremiumDataDisk.java new file mode 100644 index 000000000000..1bf867b1639a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/PremiumDataDisk.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PremiumDataDisk. */ +public final class PremiumDataDisk extends ExpandableStringEnum { + /** Static value Disabled for PremiumDataDisk. */ + public static final PremiumDataDisk DISABLED = fromString("Disabled"); + + /** Static value Enabled for PremiumDataDisk. */ + public static final PremiumDataDisk ENABLED = fromString("Enabled"); + + /** + * Creates or finds a PremiumDataDisk from its string representation. + * + * @param name a name to look for. + * @return the corresponding PremiumDataDisk. + */ + @JsonCreator + public static PremiumDataDisk fromString(String name) { + return fromString(name, PremiumDataDisk.class); + } + + /** @return known PremiumDataDisk values. */ + public static Collection values() { + return values(PremiumDataDisk.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperationResult.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperationResult.java new file mode 100644 index 000000000000..7e20c5515d5e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperationResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.OperationMetadataInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list REST API operations. */ +@Fluent +public final class ProviderOperationResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProviderOperationResult.class); + + /* + * List of operations supported by the resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the resource provider. + * + * @param value the value value to set. + * @return the ProviderOperationResult object itself. + */ + public ProviderOperationResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperations.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperations.java new file mode 100644 index 000000000000..309352292976 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ProviderOperations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ProviderOperations. */ +public interface ProviderOperations { + /** + * Result of the request to list REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + PagedIterable list(); + + /** + * Result of the request to list REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RdpConnection.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RdpConnection.java new file mode 100644 index 000000000000..0c8a496ee958 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RdpConnection.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.resourcemanager.devtestlabs.fluent.models.RdpConnectionInner; + +/** An immutable client-side representation of RdpConnection. */ +public interface RdpConnection { + /** + * Gets the contents property: The contents of the .rdp file. + * + * @return the contents value. + */ + String contents(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.RdpConnectionInner object. + * + * @return the inner object. + */ + RdpConnectionInner innerModel(); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ReportingCycleType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ReportingCycleType.java new file mode 100644 index 000000000000..fdee9be20ff7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ReportingCycleType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReportingCycleType. */ +public final class ReportingCycleType extends ExpandableStringEnum { + /** Static value CalendarMonth for ReportingCycleType. */ + public static final ReportingCycleType CALENDAR_MONTH = fromString("CalendarMonth"); + + /** Static value Custom for ReportingCycleType. */ + public static final ReportingCycleType CUSTOM = fromString("Custom"); + + /** + * Creates or finds a ReportingCycleType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReportingCycleType. + */ + @JsonCreator + public static ReportingCycleType fromString(String name) { + return fromString(name, ReportingCycleType.class); + } + + /** @return known ReportingCycleType values. */ + public static Collection values() { + return values(ReportingCycleType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ResizeLabVirtualMachineProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ResizeLabVirtualMachineProperties.java new file mode 100644 index 000000000000..160abf518c2a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ResizeLabVirtualMachineProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request body for resizing a virtual machine. */ +@Fluent +public final class ResizeLabVirtualMachineProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResizeLabVirtualMachineProperties.class); + + /* + * Specifies the size of the virtual machine. + */ + @JsonProperty(value = "size") + private String size; + + /** + * Get the size property: Specifies the size of the virtual machine. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: Specifies the size of the virtual machine. + * + * @param size the size value to set. + * @return the ResizeLabVirtualMachineProperties object itself. + */ + public ResizeLabVirtualMachineProperties withSize(String size) { + this.size = size; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RetargetScheduleProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RetargetScheduleProperties.java new file mode 100644 index 000000000000..1ae64a6eb84d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/RetargetScheduleProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for retargeting a virtual machine schedule. */ +@Fluent +public final class RetargetScheduleProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RetargetScheduleProperties.class); + + /* + * The resource Id of the virtual machine on which the schedule operates + */ + @JsonProperty(value = "currentResourceId") + private String currentResourceId; + + /* + * The resource Id of the virtual machine that the schedule should be + * retargeted to + */ + @JsonProperty(value = "targetResourceId") + private String targetResourceId; + + /** + * Get the currentResourceId property: The resource Id of the virtual machine on which the schedule operates. + * + * @return the currentResourceId value. + */ + public String currentResourceId() { + return this.currentResourceId; + } + + /** + * Set the currentResourceId property: The resource Id of the virtual machine on which the schedule operates. + * + * @param currentResourceId the currentResourceId value to set. + * @return the RetargetScheduleProperties object itself. + */ + public RetargetScheduleProperties withCurrentResourceId(String currentResourceId) { + this.currentResourceId = currentResourceId; + return this; + } + + /** + * Get the targetResourceId property: The resource Id of the virtual machine that the schedule should be retargeted + * to. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: The resource Id of the virtual machine that the schedule should be retargeted + * to. + * + * @param targetResourceId the targetResourceId value to set. + * @return the RetargetScheduleProperties object itself. + */ + public RetargetScheduleProperties withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedule.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedule.java new file mode 100644 index 000000000000..fd2feb3572ab --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedule.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of Schedule. */ +public interface Schedule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the status property: The status of the schedule (i.e. Enabled, Disabled). + * + * @return the status value. + */ + EnableStatus status(); + + /** + * Gets the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @return the taskType value. + */ + String taskType(); + + /** + * Gets the weeklyRecurrence property: If the schedule will occur only some days of the week, specify the weekly + * recurrence. + * + * @return the weeklyRecurrence value. + */ + WeekDetails weeklyRecurrence(); + + /** + * Gets the dailyRecurrence property: If the schedule will occur once each day of the week, specify the daily + * recurrence. + * + * @return the dailyRecurrence value. + */ + DayDetails dailyRecurrence(); + + /** + * Gets the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the hourly + * recurrence. + * + * @return the hourlyRecurrence value. + */ + HourDetails hourlyRecurrence(); + + /** + * Gets the timeZoneId property: The time zone ID (e.g. Pacific Standard time). + * + * @return the timeZoneId value. + */ + String timeZoneId(); + + /** + * Gets the notificationSettings property: Notification settings. + * + * @return the notificationSettings value. + */ + NotificationSettings notificationSettings(); + + /** + * Gets the createdDate property: The creation date of the schedule. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the targetResourceId property: The resource ID to which the schedule belongs. + * + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner object. + * + * @return the inner object. + */ + ScheduleInner innerModel(); + + /** The entirety of the Schedule definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Schedule definition stages. */ + interface DefinitionStages { + /** The first stage of the Schedule definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Schedule definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Schedule definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Schedule definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithStatus, + DefinitionStages.WithTaskType, + DefinitionStages.WithWeeklyRecurrence, + DefinitionStages.WithDailyRecurrence, + DefinitionStages.WithHourlyRecurrence, + DefinitionStages.WithTimeZoneId, + DefinitionStages.WithNotificationSettings, + DefinitionStages.WithTargetResourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + Schedule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Schedule create(Context context); + } + /** The stage of the Schedule definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Schedule definition allowing to specify status. */ + interface WithStatus { + /** + * Specifies the status property: The status of the schedule (i.e. Enabled, Disabled). + * + * @param status The status of the schedule (i.e. Enabled, Disabled). + * @return the next definition stage. + */ + WithCreate withStatus(EnableStatus status); + } + /** The stage of the Schedule definition allowing to specify taskType. */ + interface WithTaskType { + /** + * Specifies the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, + * LabVmAutoStart).. + * + * @param taskType The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * @return the next definition stage. + */ + WithCreate withTaskType(String taskType); + } + /** The stage of the Schedule definition allowing to specify weeklyRecurrence. */ + interface WithWeeklyRecurrence { + /** + * Specifies the weeklyRecurrence property: If the schedule will occur only some days of the week, specify + * the weekly recurrence.. + * + * @param weeklyRecurrence If the schedule will occur only some days of the week, specify the weekly + * recurrence. + * @return the next definition stage. + */ + WithCreate withWeeklyRecurrence(WeekDetails weeklyRecurrence); + } + /** The stage of the Schedule definition allowing to specify dailyRecurrence. */ + interface WithDailyRecurrence { + /** + * Specifies the dailyRecurrence property: If the schedule will occur once each day of the week, specify the + * daily recurrence.. + * + * @param dailyRecurrence If the schedule will occur once each day of the week, specify the daily + * recurrence. + * @return the next definition stage. + */ + WithCreate withDailyRecurrence(DayDetails dailyRecurrence); + } + /** The stage of the Schedule definition allowing to specify hourlyRecurrence. */ + interface WithHourlyRecurrence { + /** + * Specifies the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the + * hourly recurrence.. + * + * @param hourlyRecurrence If the schedule will occur multiple times a day, specify the hourly recurrence. + * @return the next definition stage. + */ + WithCreate withHourlyRecurrence(HourDetails hourlyRecurrence); + } + /** The stage of the Schedule definition allowing to specify timeZoneId. */ + interface WithTimeZoneId { + /** + * Specifies the timeZoneId property: The time zone ID (e.g. Pacific Standard time).. + * + * @param timeZoneId The time zone ID (e.g. Pacific Standard time). + * @return the next definition stage. + */ + WithCreate withTimeZoneId(String timeZoneId); + } + /** The stage of the Schedule definition allowing to specify notificationSettings. */ + interface WithNotificationSettings { + /** + * Specifies the notificationSettings property: Notification settings.. + * + * @param notificationSettings Notification settings. + * @return the next definition stage. + */ + WithCreate withNotificationSettings(NotificationSettings notificationSettings); + } + /** The stage of the Schedule definition allowing to specify targetResourceId. */ + interface WithTargetResourceId { + /** + * Specifies the targetResourceId property: The resource ID to which the schedule belongs. + * + * @param targetResourceId The resource ID to which the schedule belongs. + * @return the next definition stage. + */ + WithCreate withTargetResourceId(String targetResourceId); + } + } + /** + * Begins update for the Schedule resource. + * + * @return the stage of resource update. + */ + Schedule.Update update(); + + /** The template for Schedule update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Schedule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Schedule apply(Context context); + } + /** The Schedule update stages. */ + interface UpdateStages { + /** The stage of the Schedule update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Schedule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Schedule refresh(Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(Context context); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void retarget(RetargetScheduleProperties retargetScheduleProperties); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void retarget(RetargetScheduleProperties retargetScheduleProperties, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleCreationParameter.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleCreationParameter.java new file mode 100644 index 000000000000..df984223e28b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleCreationParameter.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Properties for creating a schedule. */ +@JsonFlatten +@Fluent +public class ScheduleCreationParameter { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScheduleCreationParameter.class); + + /* + * The name of the virtual machine or environment + */ + @JsonProperty(value = "name") + private String name; + + /* + * The location of the new virtual machine or environment + */ + @JsonProperty(value = "location") + private String location; + + /* + * The tags of the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The status of the schedule (i.e. Enabled, Disabled) + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /* + * The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + */ + @JsonProperty(value = "properties.taskType") + private String taskType; + + /* + * If the schedule will occur only some days of the week, specify the + * weekly recurrence. + */ + @JsonProperty(value = "properties.weeklyRecurrence") + private WeekDetails weeklyRecurrence; + + /* + * If the schedule will occur once each day of the week, specify the daily + * recurrence. + */ + @JsonProperty(value = "properties.dailyRecurrence") + private DayDetails dailyRecurrence; + + /* + * If the schedule will occur multiple times a day, specify the hourly + * recurrence. + */ + @JsonProperty(value = "properties.hourlyRecurrence") + private HourDetails hourlyRecurrence; + + /* + * The time zone ID (e.g. Pacific Standard time). + */ + @JsonProperty(value = "properties.timeZoneId") + private String timeZoneId; + + /* + * Notification settings. + */ + @JsonProperty(value = "properties.notificationSettings") + private NotificationSettings notificationSettings; + + /* + * The resource ID to which the schedule belongs + */ + @JsonProperty(value = "properties.targetResourceId") + private String targetResourceId; + + /** + * Get the name property: The name of the virtual machine or environment. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the virtual machine or environment. + * + * @param name the name value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location property: The location of the new virtual machine or environment. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the new virtual machine or environment. + * + * @param location the location value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: The tags of the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags of the resource. + * + * @param tags the tags value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the status property: The status of the schedule (i.e. Enabled, Disabled). + * + * @return the status value. + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status property: The status of the schedule (i.e. Enabled, Disabled). + * + * @param status the status value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withStatus(EnableStatus status) { + this.status = status; + return this; + } + + /** + * Get the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @return the taskType value. + */ + public String taskType() { + return this.taskType; + } + + /** + * Set the taskType property: The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @param taskType the taskType value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withTaskType(String taskType) { + this.taskType = taskType; + return this; + } + + /** + * Get the weeklyRecurrence property: If the schedule will occur only some days of the week, specify the weekly + * recurrence. + * + * @return the weeklyRecurrence value. + */ + public WeekDetails weeklyRecurrence() { + return this.weeklyRecurrence; + } + + /** + * Set the weeklyRecurrence property: If the schedule will occur only some days of the week, specify the weekly + * recurrence. + * + * @param weeklyRecurrence the weeklyRecurrence value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.weeklyRecurrence = weeklyRecurrence; + return this; + } + + /** + * Get the dailyRecurrence property: If the schedule will occur once each day of the week, specify the daily + * recurrence. + * + * @return the dailyRecurrence value. + */ + public DayDetails dailyRecurrence() { + return this.dailyRecurrence; + } + + /** + * Set the dailyRecurrence property: If the schedule will occur once each day of the week, specify the daily + * recurrence. + * + * @param dailyRecurrence the dailyRecurrence value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withDailyRecurrence(DayDetails dailyRecurrence) { + this.dailyRecurrence = dailyRecurrence; + return this; + } + + /** + * Get the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the hourly + * recurrence. + * + * @return the hourlyRecurrence value. + */ + public HourDetails hourlyRecurrence() { + return this.hourlyRecurrence; + } + + /** + * Set the hourlyRecurrence property: If the schedule will occur multiple times a day, specify the hourly + * recurrence. + * + * @param hourlyRecurrence the hourlyRecurrence value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.hourlyRecurrence = hourlyRecurrence; + return this; + } + + /** + * Get the timeZoneId property: The time zone ID (e.g. Pacific Standard time). + * + * @return the timeZoneId value. + */ + public String timeZoneId() { + return this.timeZoneId; + } + + /** + * Set the timeZoneId property: The time zone ID (e.g. Pacific Standard time). + * + * @param timeZoneId the timeZoneId value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withTimeZoneId(String timeZoneId) { + this.timeZoneId = timeZoneId; + return this; + } + + /** + * Get the notificationSettings property: Notification settings. + * + * @return the notificationSettings value. + */ + public NotificationSettings notificationSettings() { + return this.notificationSettings; + } + + /** + * Set the notificationSettings property: Notification settings. + * + * @param notificationSettings the notificationSettings value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withNotificationSettings(NotificationSettings notificationSettings) { + this.notificationSettings = notificationSettings; + return this; + } + + /** + * Get the targetResourceId property: The resource ID to which the schedule belongs. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: The resource ID to which the schedule belongs. + * + * @param targetResourceId the targetResourceId value to set. + * @return the ScheduleCreationParameter object itself. + */ + public ScheduleCreationParameter withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (weeklyRecurrence() != null) { + weeklyRecurrence().validate(); + } + if (dailyRecurrence() != null) { + dailyRecurrence().validate(); + } + if (hourlyRecurrence() != null) { + hourlyRecurrence().validate(); + } + if (notificationSettings() != null) { + notificationSettings().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleFragment.java new file mode 100644 index 000000000000..6b6cab823f1c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A schedule. */ +@Immutable +public final class ScheduleFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScheduleFragment.class); + + /** {@inheritDoc} */ + @Override + public ScheduleFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleList.java new file mode 100644 index 000000000000..d0ac150bb546 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ScheduleList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class ScheduleList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScheduleList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the ScheduleList object itself. + */ + public ScheduleList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ScheduleList object itself. + */ + public ScheduleList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedules.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedules.java new file mode 100644 index 000000000000..0106062e12c6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Schedules.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; + +/** Resource collection API of Schedules. */ +public interface Schedules { + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Schedule get(String resourceGroupName, String labName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Schedule createOrUpdate(String resourceGroupName, String labName, String name, ScheduleInner schedule); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, String labName, String name, ScheduleInner schedule, Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Schedule update(String resourceGroupName, String labName, String name, ScheduleFragment schedule); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Response updateWithResponse( + String resourceGroupName, String labName, String name, ScheduleFragment schedule, Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String labName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String labName, String name, Context context); + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listApplicable(String resourceGroupName, String labName, String name); + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable listApplicable(String resourceGroupName, String labName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secret.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secret.java new file mode 100644 index 000000000000..2a2ceaceca42 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secret.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.SecretInner; +import java.util.Map; + +/** An immutable client-side representation of Secret. */ +public interface Secret { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the value property: The value of the secret for secret creation. + * + * @return the value value. + */ + String value(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.SecretInner object. + * + * @return the inner object. + */ + SecretInner innerModel(); + + /** The entirety of the Secret definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The Secret definition stages. */ + interface DefinitionStages { + /** The first stage of the Secret definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Secret definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the Secret definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName, username. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @return the next definition stage. + */ + WithCreate withExistingUser(String resourceGroupName, String labName, String username); + } + /** + * The stage of the Secret definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithValue { + /** + * Executes the create request. + * + * @return the created resource. + */ + Secret create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Secret create(Context context); + } + /** The stage of the Secret definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Secret definition allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: The value of the secret for secret creation.. + * + * @param value The value of the secret for secret creation. + * @return the next definition stage. + */ + WithCreate withValue(String value); + } + } + /** + * Begins update for the Secret resource. + * + * @return the stage of resource update. + */ + Secret.Update update(); + + /** The template for Secret update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Secret apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Secret apply(Context context); + } + /** The Secret update stages. */ + interface UpdateStages { + /** The stage of the Secret update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Secret refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Secret refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretFragment.java new file mode 100644 index 000000000000..979efbf3b2ad --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A secret. */ +@Immutable +public final class SecretFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecretFragment.class); + + /** {@inheritDoc} */ + @Override + public SecretFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretList.java new file mode 100644 index 000000000000..4bd6052f8032 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SecretList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.SecretInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class SecretList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SecretList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the SecretList object itself. + */ + public SecretList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the SecretList object itself. + */ + public SecretList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secrets.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secrets.java new file mode 100644 index 000000000000..95983b15e491 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Secrets.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Secrets. */ +public interface Secrets { + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + Secret get(String resourceGroupName, String labName, String username, String name); + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the secret. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Get secret. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + Secret getById(String id); + + /** + * Get secret. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=value)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return secret. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete secret. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete secret. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Secret resource. + * + * @param name resource name. + * @return the first stage of the new Secret definition. + */ + Secret.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabric.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabric.java new file mode 100644 index 000000000000..52867db8817e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabric.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceFabricInner; +import java.util.Map; + +/** An immutable client-side representation of ServiceFabric. */ +public interface ServiceFabric { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the externalServiceFabricId property: The backing service fabric resource's id. + * + * @return the externalServiceFabricId value. + */ + String externalServiceFabricId(); + + /** + * Gets the environmentId property: The resource id of the environment under which the service fabric resource is + * present. + * + * @return the environmentId value. + */ + String environmentId(); + + /** + * Gets the applicableSchedule property: The applicable schedule for the virtual machine. + * + * @return the applicableSchedule value. + */ + ApplicableSchedule applicableSchedule(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ServiceFabricInner object. + * + * @return the inner object. + */ + ServiceFabricInner innerModel(); + + /** The entirety of the ServiceFabric definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The ServiceFabric definition stages. */ + interface DefinitionStages { + /** The first stage of the ServiceFabric definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ServiceFabric definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ServiceFabric definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName, username. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @return the next definition stage. + */ + WithCreate withExistingUser(String resourceGroupName, String labName, String username); + } + /** + * The stage of the ServiceFabric definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithExternalServiceFabricId, + DefinitionStages.WithEnvironmentId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceFabric create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceFabric create(Context context); + } + /** The stage of the ServiceFabric definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ServiceFabric definition allowing to specify externalServiceFabricId. */ + interface WithExternalServiceFabricId { + /** + * Specifies the externalServiceFabricId property: The backing service fabric resource's id. + * + * @param externalServiceFabricId The backing service fabric resource's id. + * @return the next definition stage. + */ + WithCreate withExternalServiceFabricId(String externalServiceFabricId); + } + /** The stage of the ServiceFabric definition allowing to specify environmentId. */ + interface WithEnvironmentId { + /** + * Specifies the environmentId property: The resource id of the environment under which the service fabric + * resource is present. + * + * @param environmentId The resource id of the environment under which the service fabric resource is + * present. + * @return the next definition stage. + */ + WithCreate withEnvironmentId(String environmentId); + } + } + /** + * Begins update for the ServiceFabric resource. + * + * @return the stage of resource update. + */ + ServiceFabric.Update update(); + + /** The template for ServiceFabric update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServiceFabric apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServiceFabric apply(Context context); + } + /** The ServiceFabric update stages. */ + interface UpdateStages { + /** The stage of the ServiceFabric update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceFabric refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceFabric refresh(Context context); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + ApplicableSchedule listApplicableSchedules(); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + Response listApplicableSchedulesWithResponse(Context context); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricFragment.java new file mode 100644 index 000000000000..62f21e5a80ac --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A Service Fabric. */ +@Immutable +public final class ServiceFabricFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceFabricFragment.class); + + /** {@inheritDoc} */ + @Override + public ServiceFabricFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricList.java new file mode 100644 index 000000000000..87703cf4c31d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceFabricInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class ServiceFabricList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceFabricList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the ServiceFabricList object itself. + */ + public ServiceFabricList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ServiceFabricList object itself. + */ + public ServiceFabricList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricSchedules.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricSchedules.java new file mode 100644 index 000000000000..ce7640d86d44 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabricSchedules.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; + +/** Resource collection API of ServiceFabricSchedules. */ +public interface ServiceFabricSchedules { + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String username, String serviceFabricName); + + /** + * List schedules in a given service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Schedule get(String resourceGroupName, String labName, String username, String serviceFabricName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Response getWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + String expand, + Context context); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Schedule createOrUpdate( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleInner schedule, + Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String serviceFabricName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Schedule update( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Response updateWithResponse( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + ScheduleFragment schedule, + Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String labName, String username, String serviceFabricName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param serviceFabricName The name of the service fabric. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute( + String resourceGroupName, + String labName, + String username, + String serviceFabricName, + String name, + Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabrics.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabrics.java new file mode 100644 index 000000000000..d2dd3d08907b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceFabrics.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServiceFabrics. */ +public interface ServiceFabrics { + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String username); + + /** + * List service fabrics in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String username, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + ServiceFabric get(String resourceGroupName, String labName, String username, String name); + + /** + * Get service fabric. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + Response getWithResponse( + String resourceGroupName, String labName, String username, String name, String expand, Context context); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String name); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + ApplicableSchedule listApplicableSchedules(String resourceGroupName, String labName, String username, String name); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String labName, String username, String name); + + /** + * Start a service fabric. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String labName, String username, String name); + + /** + * Stop a service fabric This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param username The name of the user profile. + * @param name The name of the service fabric. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String labName, String username, String name, Context context); + + /** + * Get service fabric. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + ServiceFabric getById(String id); + + /** + * Get service fabric. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($expand=applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service fabric. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete service fabric. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServiceFabric resource. + * + * @param name resource name. + * @return the first stage of the new ServiceFabric definition. + */ + ServiceFabric.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunner.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunner.java new file mode 100644 index 000000000000..f6e77c327644 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunner.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ServiceRunnerInner; +import java.util.Map; + +/** An immutable client-side representation of ServiceRunner. */ +public interface ServiceRunner { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + IdentityProperties identity(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.ServiceRunnerInner object. + * + * @return the inner object. + */ + ServiceRunnerInner innerModel(); + + /** The entirety of the ServiceRunner definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The ServiceRunner definition stages. */ + interface DefinitionStages { + /** The first stage of the ServiceRunner definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ServiceRunner definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ServiceRunner definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the ServiceRunner definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceRunner create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceRunner create(Context context); + } + /** The stage of the ServiceRunner definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ServiceRunner definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(IdentityProperties identity); + } + } + /** + * Begins update for the ServiceRunner resource. + * + * @return the stage of resource update. + */ + ServiceRunner.Update update(); + + /** The template for ServiceRunner update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServiceRunner apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServiceRunner apply(Context context); + } + /** The ServiceRunner update stages. */ + interface UpdateStages { + /** The stage of the ServiceRunner update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ServiceRunner update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + Update withIdentity(IdentityProperties identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceRunner refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceRunner refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunners.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunners.java new file mode 100644 index 000000000000..03fc9e24f09b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/ServiceRunners.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServiceRunners. */ +public interface ServiceRunners { + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + ServiceRunner get(String resourceGroupName, String labName, String name); + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + Response getWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String labName, String name, Context context); + + /** + * Get service runner. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + ServiceRunner getById(String id); + + /** + * Get service runner. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return service runner. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete service runner. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete service runner. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServiceRunner resource. + * + * @param name resource name. + * @return the first stage of the new ServiceRunner definition. + */ + ServiceRunner.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SharedPublicIpAddressConfiguration.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SharedPublicIpAddressConfiguration.java new file mode 100644 index 000000000000..4214baa898c6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SharedPublicIpAddressConfiguration.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a virtual machine that determine how it is connected to a load balancer. */ +@Fluent +public final class SharedPublicIpAddressConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SharedPublicIpAddressConfiguration.class); + + /* + * The incoming NAT rules + */ + @JsonProperty(value = "inboundNatRules") + private List inboundNatRules; + + /** + * Get the inboundNatRules property: The incoming NAT rules. + * + * @return the inboundNatRules value. + */ + public List inboundNatRules() { + return this.inboundNatRules; + } + + /** + * Set the inboundNatRules property: The incoming NAT rules. + * + * @param inboundNatRules the inboundNatRules value to set. + * @return the SharedPublicIpAddressConfiguration object itself. + */ + public SharedPublicIpAddressConfiguration withInboundNatRules(List inboundNatRules) { + this.inboundNatRules = inboundNatRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (inboundNatRules() != null) { + inboundNatRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SourceControlType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SourceControlType.java new file mode 100644 index 000000000000..51c46ff3bc6d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SourceControlType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SourceControlType. */ +public final class SourceControlType extends ExpandableStringEnum { + /** Static value VsoGit for SourceControlType. */ + public static final SourceControlType VSO_GIT = fromString("VsoGit"); + + /** Static value GitHub for SourceControlType. */ + public static final SourceControlType GIT_HUB = fromString("GitHub"); + + /** Static value StorageAccount for SourceControlType. */ + public static final SourceControlType STORAGE_ACCOUNT = fromString("StorageAccount"); + + /** + * Creates or finds a SourceControlType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceControlType. + */ + @JsonCreator + public static SourceControlType fromString(String name) { + return fromString(name, SourceControlType.class); + } + + /** @return known SourceControlType values. */ + public static Collection values() { + return values(SourceControlType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/StorageType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/StorageType.java new file mode 100644 index 000000000000..fd27ad84058c --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/StorageType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageType. */ +public final class StorageType extends ExpandableStringEnum { + /** Static value Standard for StorageType. */ + public static final StorageType STANDARD = fromString("Standard"); + + /** Static value Premium for StorageType. */ + public static final StorageType PREMIUM = fromString("Premium"); + + /** Static value StandardSSD for StorageType. */ + public static final StorageType STANDARD_SSD = fromString("StandardSSD"); + + /** + * Creates or finds a StorageType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageType. + */ + @JsonCreator + public static StorageType fromString(String name) { + return fromString(name, StorageType.class); + } + + /** @return known StorageType values. */ + public static Collection values() { + return values(StorageType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Subnet.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Subnet.java new file mode 100644 index 000000000000..cc4eeb54b82d --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Subnet.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Subnet information. */ +@Fluent +public final class Subnet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Subnet.class); + + /* + * The resource ID of the subnet. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The name of the subnet as seen in the lab. + */ + @JsonProperty(value = "labSubnetName") + private String labSubnetName; + + /* + * The permission policy of the subnet for allowing public IP addresses + * (i.e. Allow, Deny)). + */ + @JsonProperty(value = "allowPublicIp") + private UsagePermissionType allowPublicIp; + + /** + * Get the resourceId property: The resource ID of the subnet. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource ID of the subnet. + * + * @param resourceId the resourceId value to set. + * @return the Subnet object itself. + */ + public Subnet withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the labSubnetName property: The name of the subnet as seen in the lab. + * + * @return the labSubnetName value. + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set the labSubnetName property: The name of the subnet as seen in the lab. + * + * @param labSubnetName the labSubnetName value to set. + * @return the Subnet object itself. + */ + public Subnet withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get the allowPublicIp property: The permission policy of the subnet for allowing public IP addresses (i.e. Allow, + * Deny)). + * + * @return the allowPublicIp value. + */ + public UsagePermissionType allowPublicIp() { + return this.allowPublicIp; + } + + /** + * Set the allowPublicIp property: The permission policy of the subnet for allowing public IP addresses (i.e. Allow, + * Deny)). + * + * @param allowPublicIp the allowPublicIp value to set. + * @return the Subnet object itself. + */ + public Subnet withAllowPublicIp(UsagePermissionType allowPublicIp) { + this.allowPublicIp = allowPublicIp; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetOverride.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetOverride.java new file mode 100644 index 000000000000..ca16fd91c0be --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetOverride.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Property overrides on a subnet of a virtual network. */ +@Fluent +public final class SubnetOverride { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubnetOverride.class); + + /* + * The resource ID of the subnet. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The name given to the subnet within the lab. + */ + @JsonProperty(value = "labSubnetName") + private String labSubnetName; + + /* + * Indicates whether this subnet can be used during virtual machine + * creation (i.e. Allow, Deny). + */ + @JsonProperty(value = "useInVmCreationPermission") + private UsagePermissionType useInVmCreationPermission; + + /* + * Indicates whether public IP addresses can be assigned to virtual + * machines on this subnet (i.e. Allow, Deny). + */ + @JsonProperty(value = "usePublicIpAddressPermission") + private UsagePermissionType usePublicIpAddressPermission; + + /* + * Properties that virtual machines on this subnet will share. + */ + @JsonProperty(value = "sharedPublicIpAddressConfiguration") + private SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration; + + /* + * The virtual network pool associated with this subnet. + */ + @JsonProperty(value = "virtualNetworkPoolName") + private String virtualNetworkPoolName; + + /** + * Get the resourceId property: The resource ID of the subnet. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource ID of the subnet. + * + * @param resourceId the resourceId value to set. + * @return the SubnetOverride object itself. + */ + public SubnetOverride withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the labSubnetName property: The name given to the subnet within the lab. + * + * @return the labSubnetName value. + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set the labSubnetName property: The name given to the subnet within the lab. + * + * @param labSubnetName the labSubnetName value to set. + * @return the SubnetOverride object itself. + */ + public SubnetOverride withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get the useInVmCreationPermission property: Indicates whether this subnet can be used during virtual machine + * creation (i.e. Allow, Deny). + * + * @return the useInVmCreationPermission value. + */ + public UsagePermissionType useInVmCreationPermission() { + return this.useInVmCreationPermission; + } + + /** + * Set the useInVmCreationPermission property: Indicates whether this subnet can be used during virtual machine + * creation (i.e. Allow, Deny). + * + * @param useInVmCreationPermission the useInVmCreationPermission value to set. + * @return the SubnetOverride object itself. + */ + public SubnetOverride withUseInVmCreationPermission(UsagePermissionType useInVmCreationPermission) { + this.useInVmCreationPermission = useInVmCreationPermission; + return this; + } + + /** + * Get the usePublicIpAddressPermission property: Indicates whether public IP addresses can be assigned to virtual + * machines on this subnet (i.e. Allow, Deny). + * + * @return the usePublicIpAddressPermission value. + */ + public UsagePermissionType usePublicIpAddressPermission() { + return this.usePublicIpAddressPermission; + } + + /** + * Set the usePublicIpAddressPermission property: Indicates whether public IP addresses can be assigned to virtual + * machines on this subnet (i.e. Allow, Deny). + * + * @param usePublicIpAddressPermission the usePublicIpAddressPermission value to set. + * @return the SubnetOverride object itself. + */ + public SubnetOverride withUsePublicIpAddressPermission(UsagePermissionType usePublicIpAddressPermission) { + this.usePublicIpAddressPermission = usePublicIpAddressPermission; + return this; + } + + /** + * Get the sharedPublicIpAddressConfiguration property: Properties that virtual machines on this subnet will share. + * + * @return the sharedPublicIpAddressConfiguration value. + */ + public SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration() { + return this.sharedPublicIpAddressConfiguration; + } + + /** + * Set the sharedPublicIpAddressConfiguration property: Properties that virtual machines on this subnet will share. + * + * @param sharedPublicIpAddressConfiguration the sharedPublicIpAddressConfiguration value to set. + * @return the SubnetOverride object itself. + */ + public SubnetOverride withSharedPublicIpAddressConfiguration( + SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration) { + this.sharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + return this; + } + + /** + * Get the virtualNetworkPoolName property: The virtual network pool associated with this subnet. + * + * @return the virtualNetworkPoolName value. + */ + public String virtualNetworkPoolName() { + return this.virtualNetworkPoolName; + } + + /** + * Set the virtualNetworkPoolName property: The virtual network pool associated with this subnet. + * + * @param virtualNetworkPoolName the virtualNetworkPoolName value to set. + * @return the SubnetOverride object itself. + */ + public SubnetOverride withVirtualNetworkPoolName(String virtualNetworkPoolName) { + this.virtualNetworkPoolName = virtualNetworkPoolName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sharedPublicIpAddressConfiguration() != null) { + sharedPublicIpAddressConfiguration().validate(); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetSharedPublicIpAddressConfiguration.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetSharedPublicIpAddressConfiguration.java new file mode 100644 index 000000000000..55ac07024eb5 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/SubnetSharedPublicIpAddressConfiguration.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Configuration for public IP address sharing. */ +@Fluent +public final class SubnetSharedPublicIpAddressConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SubnetSharedPublicIpAddressConfiguration.class); + + /* + * Backend ports that virtual machines on this subnet are allowed to expose + */ + @JsonProperty(value = "allowedPorts") + private List allowedPorts; + + /** + * Get the allowedPorts property: Backend ports that virtual machines on this subnet are allowed to expose. + * + * @return the allowedPorts value. + */ + public List allowedPorts() { + return this.allowedPorts; + } + + /** + * Set the allowedPorts property: Backend ports that virtual machines on this subnet are allowed to expose. + * + * @param allowedPorts the allowedPorts value to set. + * @return the SubnetSharedPublicIpAddressConfiguration object itself. + */ + public SubnetSharedPublicIpAddressConfiguration withAllowedPorts(List allowedPorts) { + this.allowedPorts = allowedPorts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allowedPorts() != null) { + allowedPorts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostProperties.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostProperties.java new file mode 100644 index 000000000000..36b5422f83cd --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostProperties.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a cost target. */ +@Fluent +public final class TargetCostProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TargetCostProperties.class); + + /* + * Target cost status + */ + @JsonProperty(value = "status") + private TargetCostStatus status; + + /* + * Lab target cost + */ + @JsonProperty(value = "target") + private Integer target; + + /* + * Cost thresholds. + */ + @JsonProperty(value = "costThresholds") + private List costThresholds; + + /* + * Reporting cycle start date. + */ + @JsonProperty(value = "cycleStartDateTime") + private OffsetDateTime cycleStartDateTime; + + /* + * Reporting cycle end date. + */ + @JsonProperty(value = "cycleEndDateTime") + private OffsetDateTime cycleEndDateTime; + + /* + * Reporting cycle type. + */ + @JsonProperty(value = "cycleType") + private ReportingCycleType cycleType; + + /** + * Get the status property: Target cost status. + * + * @return the status value. + */ + public TargetCostStatus status() { + return this.status; + } + + /** + * Set the status property: Target cost status. + * + * @param status the status value to set. + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withStatus(TargetCostStatus status) { + this.status = status; + return this; + } + + /** + * Get the target property: Lab target cost. + * + * @return the target value. + */ + public Integer target() { + return this.target; + } + + /** + * Set the target property: Lab target cost. + * + * @param target the target value to set. + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withTarget(Integer target) { + this.target = target; + return this; + } + + /** + * Get the costThresholds property: Cost thresholds. + * + * @return the costThresholds value. + */ + public List costThresholds() { + return this.costThresholds; + } + + /** + * Set the costThresholds property: Cost thresholds. + * + * @param costThresholds the costThresholds value to set. + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCostThresholds(List costThresholds) { + this.costThresholds = costThresholds; + return this; + } + + /** + * Get the cycleStartDateTime property: Reporting cycle start date. + * + * @return the cycleStartDateTime value. + */ + public OffsetDateTime cycleStartDateTime() { + return this.cycleStartDateTime; + } + + /** + * Set the cycleStartDateTime property: Reporting cycle start date. + * + * @param cycleStartDateTime the cycleStartDateTime value to set. + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCycleStartDateTime(OffsetDateTime cycleStartDateTime) { + this.cycleStartDateTime = cycleStartDateTime; + return this; + } + + /** + * Get the cycleEndDateTime property: Reporting cycle end date. + * + * @return the cycleEndDateTime value. + */ + public OffsetDateTime cycleEndDateTime() { + return this.cycleEndDateTime; + } + + /** + * Set the cycleEndDateTime property: Reporting cycle end date. + * + * @param cycleEndDateTime the cycleEndDateTime value to set. + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCycleEndDateTime(OffsetDateTime cycleEndDateTime) { + this.cycleEndDateTime = cycleEndDateTime; + return this; + } + + /** + * Get the cycleType property: Reporting cycle type. + * + * @return the cycleType value. + */ + public ReportingCycleType cycleType() { + return this.cycleType; + } + + /** + * Set the cycleType property: Reporting cycle type. + * + * @param cycleType the cycleType value to set. + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCycleType(ReportingCycleType cycleType) { + this.cycleType = cycleType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (costThresholds() != null) { + costThresholds().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostStatus.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostStatus.java new file mode 100644 index 000000000000..73fbcaf289b7 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TargetCostStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TargetCostStatus. */ +public final class TargetCostStatus extends ExpandableStringEnum { + /** Static value Enabled for TargetCostStatus. */ + public static final TargetCostStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for TargetCostStatus. */ + public static final TargetCostStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a TargetCostStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TargetCostStatus. + */ + @JsonCreator + public static TargetCostStatus fromString(String name) { + return fromString(name, TargetCostStatus.class); + } + + /** @return known TargetCostStatus values. */ + public static Collection values() { + return values(TargetCostStatus.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TransportProtocol.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TransportProtocol.java new file mode 100644 index 000000000000..72b92b62143b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/TransportProtocol.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TransportProtocol. */ +public final class TransportProtocol extends ExpandableStringEnum { + /** Static value Tcp for TransportProtocol. */ + public static final TransportProtocol TCP = fromString("Tcp"); + + /** Static value Udp for TransportProtocol. */ + public static final TransportProtocol UDP = fromString("Udp"); + + /** + * Creates or finds a TransportProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding TransportProtocol. + */ + @JsonCreator + public static TransportProtocol fromString(String name) { + return fromString(name, TransportProtocol.class); + } + + /** @return known TransportProtocol values. */ + public static Collection values() { + return values(TransportProtocol.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UpdateResource.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UpdateResource.java new file mode 100644 index 000000000000..610fd09c3948 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UpdateResource.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents an update resource. */ +@Fluent +public class UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateResource.class); + + /* + * The tags of the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: The tags of the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags of the resource. + * + * @param tags the tags value to set. + * @return the UpdateResource object itself. + */ + public UpdateResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UsagePermissionType.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UsagePermissionType.java new file mode 100644 index 000000000000..bad2975a35cf --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UsagePermissionType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UsagePermissionType. */ +public final class UsagePermissionType extends ExpandableStringEnum { + /** Static value Default for UsagePermissionType. */ + public static final UsagePermissionType DEFAULT = fromString("Default"); + + /** Static value Deny for UsagePermissionType. */ + public static final UsagePermissionType DENY = fromString("Deny"); + + /** Static value Allow for UsagePermissionType. */ + public static final UsagePermissionType ALLOW = fromString("Allow"); + + /** + * Creates or finds a UsagePermissionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsagePermissionType. + */ + @JsonCreator + public static UsagePermissionType fromString(String name) { + return fromString(name, UsagePermissionType.class); + } + + /** @return known UsagePermissionType values. */ + public static Collection values() { + return values(UsagePermissionType.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/User.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/User.java new file mode 100644 index 000000000000..3374ce601058 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/User.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.UserInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of User. */ +public interface User { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The identity of the user. + * + * @return the identity value. + */ + UserIdentity identity(); + + /** + * Gets the secretStore property: The secret store of the user. + * + * @return the secretStore value. + */ + UserSecretStore secretStore(); + + /** + * Gets the createdDate property: The creation date of the user profile. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.UserInner object. + * + * @return the inner object. + */ + UserInner innerModel(); + + /** The entirety of the User definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The User definition stages. */ + interface DefinitionStages { + /** The first stage of the User definition. */ + interface Blank extends WithLocation { + } + /** The stage of the User definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the User definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the User definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithSecretStore { + /** + * Executes the create request. + * + * @return the created resource. + */ + User create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + User create(Context context); + } + /** The stage of the User definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the User definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the user.. + * + * @param identity The identity of the user. + * @return the next definition stage. + */ + WithCreate withIdentity(UserIdentity identity); + } + /** The stage of the User definition allowing to specify secretStore. */ + interface WithSecretStore { + /** + * Specifies the secretStore property: The secret store of the user.. + * + * @param secretStore The secret store of the user. + * @return the next definition stage. + */ + WithCreate withSecretStore(UserSecretStore secretStore); + } + } + /** + * Begins update for the User resource. + * + * @return the stage of resource update. + */ + User.Update update(); + + /** The template for User update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + User apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + User apply(Context context); + } + /** The User update stages. */ + interface UpdateStages { + /** The stage of the User update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + User refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + User refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserFragment.java new file mode 100644 index 000000000000..e2b92acdcd07 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** Profile of a lab user. */ +@Immutable +public final class UserFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserFragment.class); + + /** {@inheritDoc} */ + @Override + public UserFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserIdentity.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserIdentity.java new file mode 100644 index 000000000000..34a4b9f8f2b6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserIdentity.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Identity attributes of a lab user. */ +@Fluent +public class UserIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserIdentity.class); + + /* + * Set to the principal name / UPN of the client JWT making the request. + */ + @JsonProperty(value = "principalName") + private String principalName; + + /* + * Set to the principal Id of the client JWT making the request. Service + * principal will not have the principal Id. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /* + * Set to the tenant ID of the client JWT making the request. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * 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(value = "objectId") + private String objectId; + + /* + * Set to the app Id of the client JWT making the request. + */ + @JsonProperty(value = "appId") + private String appId; + + /** + * Get the principalName property: Set to the principal name / UPN of the client JWT making the request. + * + * @return the principalName value. + */ + public String principalName() { + return this.principalName; + } + + /** + * Set the principalName property: Set to the principal name / UPN of the client JWT making the request. + * + * @param principalName the principalName value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withPrincipalName(String principalName) { + this.principalName = principalName; + return this; + } + + /** + * Get the principalId property: Set to the principal Id of the client JWT making the request. Service principal + * will not have the principal Id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: Set to the principal Id of the client JWT making the request. Service principal + * will not have the principal Id. + * + * @param principalId the principalId value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the tenantId property: Set to the tenant ID of the client JWT making the request. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Set to the tenant ID of the client JWT making the request. + * + * @param tenantId the tenantId value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the objectId property: 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. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId property: 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. + * + * @param objectId the objectId value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the appId property: Set to the app Id of the client JWT making the request. + * + * @return the appId value. + */ + public String appId() { + return this.appId; + } + + /** + * Set the appId property: Set to the app Id of the client JWT making the request. + * + * @param appId the appId value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserList.java new file mode 100644 index 000000000000..f605804172b3 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.UserInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class UserList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the UserList object itself. + */ + public UserList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the UserList object itself. + */ + public UserList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserSecretStore.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserSecretStore.java new file mode 100644 index 000000000000..5e1e609b65f6 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/UserSecretStore.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a user's secret store. */ +@Fluent +public final class UserSecretStore { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserSecretStore.class); + + /* + * The URI of the user's Key vault. + */ + @JsonProperty(value = "keyVaultUri") + private String keyVaultUri; + + /* + * The ID of the user's Key vault. + */ + @JsonProperty(value = "keyVaultId") + private String keyVaultId; + + /** + * Get the keyVaultUri property: The URI of the user's Key vault. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: The URI of the user's Key vault. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the UserSecretStore object itself. + */ + public UserSecretStore withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the keyVaultId property: The ID of the user's Key vault. + * + * @return the keyVaultId value. + */ + public String keyVaultId() { + return this.keyVaultId; + } + + /** + * Set the keyVaultId property: The ID of the user's Key vault. + * + * @param keyVaultId the keyVaultId value to set. + * @return the UserSecretStore object itself. + */ + public UserSecretStore withKeyVaultId(String keyVaultId) { + this.keyVaultId = keyVaultId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Users.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Users.java new file mode 100644 index 000000000000..4ed220c5034a --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/Users.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Users. */ +public interface Users { + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + User get(String resourceGroupName, String labName, String name); + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Get user profile. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + User getById(String id); + + /** + * Get user profile. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($select=identity)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return user profile. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new User resource. + * + * @param name resource name. + * @return the first stage of the new User definition. + */ + User.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineCreationSource.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineCreationSource.java new file mode 100644 index 000000000000..f1e24ea3de17 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineCreationSource.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualMachineCreationSource. */ +public final class VirtualMachineCreationSource extends ExpandableStringEnum { + /** Static value FromCustomImage for VirtualMachineCreationSource. */ + public static final VirtualMachineCreationSource FROM_CUSTOM_IMAGE = fromString("FromCustomImage"); + + /** Static value FromGalleryImage for VirtualMachineCreationSource. */ + public static final VirtualMachineCreationSource FROM_GALLERY_IMAGE = fromString("FromGalleryImage"); + + /** Static value FromSharedGalleryImage for VirtualMachineCreationSource. */ + public static final VirtualMachineCreationSource FROM_SHARED_GALLERY_IMAGE = fromString("FromSharedGalleryImage"); + + /** + * Creates or finds a VirtualMachineCreationSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualMachineCreationSource. + */ + @JsonCreator + public static VirtualMachineCreationSource fromString(String name) { + return fromString(name, VirtualMachineCreationSource.class); + } + + /** @return known VirtualMachineCreationSource values. */ + public static Collection values() { + return values(VirtualMachineCreationSource.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineSchedules.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineSchedules.java new file mode 100644 index 000000000000..eca90c4d6233 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachineSchedules.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.ScheduleInner; + +/** Resource collection API of VirtualMachineSchedules. */ +public interface VirtualMachineSchedules { + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName, String virtualMachineName); + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String virtualMachineName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Schedule get(String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedule. + */ + Response getWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + String expand, + Context context); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Schedule createOrUpdate( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule); + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleInner schedule, + Context context); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String labName, String virtualMachineName, String name, Context context); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Schedule update( + String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule); + + /** + * Allows modifying tags of schedules. All other properties will be ignored. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a schedule. + */ + Response updateWithResponse( + String resourceGroupName, + String labName, + String virtualMachineName, + String name, + ScheduleFragment schedule, + Context context); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void execute(String resourceGroupName, String labName, String virtualMachineName, String name, Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachines.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachines.java new file mode 100644 index 000000000000..0d5d8797dd50 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualMachines.java @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualMachines. */ +public interface VirtualMachines { + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + LabVirtualMachine get(String resourceGroupName, String labName, String name); + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void addDataDisk(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties); + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void addDataDisk( + String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, Context context); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void applyArtifacts( + String resourceGroupName, String labName, String name, ApplyArtifactsRequest applyArtifactsRequest); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param applyArtifactsRequest Request body for applying artifacts to a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void applyArtifacts( + String resourceGroupName, + String labName, + String name, + ApplyArtifactsRequest applyArtifactsRequest, + Context context); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claim(String resourceGroupName, String labName, String name); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void claim(String resourceGroupName, String labName, String name, Context context); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detachDataDisk( + String resourceGroupName, String labName, String name, DetachDataDiskProperties detachDataDiskProperties); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param detachDataDiskProperties Request body for detaching data disk from a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void detachDataDisk( + String resourceGroupName, + String labName, + String name, + DetachDataDiskProperties detachDataDiskProperties, + Context context); + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + RdpConnection getRdpFileContents(String resourceGroupName, String labName, String name); + + /** + * Gets a string that represents the contents of the RDP file for the virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a string that represents the contents of the RDP file for the virtual machine. + */ + Response getRdpFileContentsWithResponse( + String resourceGroupName, String labName, String name, Context context); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + ApplicableSchedule listApplicableSchedules(String resourceGroupName, String labName, String name); + + /** + * Lists the applicable start/stop schedules, if any. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schedules applicable to a virtual machine. + */ + Response listApplicableSchedulesWithResponse( + String resourceGroupName, String labName, String name, Context context); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String labName, String name); + + /** + * Redeploy a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void redeploy(String resourceGroupName, String labName, String name, Context context); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties); + + /** + * Resize Virtual Machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param resizeLabVirtualMachineProperties Request body for resizing a virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void resize( + String resourceGroupName, + String labName, + String name, + ResizeLabVirtualMachineProperties resizeLabVirtualMachineProperties, + Context context); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String labName, String name); + + /** + * Restart a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String labName, String name, Context context); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String labName, String name); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String labName, String name, Context context); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String labName, String name); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String labName, String name, Context context); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void transferDisks(String resourceGroupName, String labName, String name); + + /** + * Transfers all data disks attached to the virtual machine to be owned by the current user. This operation can take + * a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void transferDisks(String resourceGroupName, String labName, String name, Context context); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void unClaim(String resourceGroupName, String labName, String name); + + /** + * Release ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void unClaim(String resourceGroupName, String labName, String name, Context context); + + /** + * Get virtual machine. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + LabVirtualMachine getById(String id); + + /** + * Get virtual machine. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: + * 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual machine. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete virtual machine. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LabVirtualMachine resource. + * + * @param name resource name. + * @return the first stage of the new LabVirtualMachine definition. + */ + LabVirtualMachine.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetwork.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetwork.java new file mode 100644 index 000000000000..fe8cba896747 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetwork.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devtestlabs.fluent.models.VirtualNetworkInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of VirtualNetwork. */ +public interface VirtualNetwork { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the allowedSubnets property: The allowed subnets of the virtual network. + * + * @return the allowedSubnets value. + */ + List allowedSubnets(); + + /** + * Gets the description property: The description of the virtual network. + * + * @return the description value. + */ + String description(); + + /** + * Gets the externalProviderResourceId property: The Microsoft.Network resource identifier of the virtual network. + * + * @return the externalProviderResourceId value. + */ + String externalProviderResourceId(); + + /** + * Gets the externalSubnets property: The external subnet properties. + * + * @return the externalSubnets value. + */ + List externalSubnets(); + + /** + * Gets the subnetOverrides property: The subnet overrides of the virtual network. + * + * @return the subnetOverrides value. + */ + List subnetOverrides(); + + /** + * Gets the createdDate property: The creation date of the virtual network. + * + * @return the createdDate value. + */ + OffsetDateTime createdDate(); + + /** + * Gets the provisioningState property: The provisioning status of the resource. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the uniqueIdentifier property: The unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devtestlabs.fluent.models.VirtualNetworkInner object. + * + * @return the inner object. + */ + VirtualNetworkInner innerModel(); + + /** The entirety of the VirtualNetwork definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The VirtualNetwork definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualNetwork definition. */ + interface Blank extends WithLocation { + } + /** The stage of the VirtualNetwork definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the VirtualNetwork definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, labName. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @return the next definition stage. + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + /** + * The stage of the VirtualNetwork definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithAllowedSubnets, + DefinitionStages.WithDescription, + DefinitionStages.WithExternalProviderResourceId, + DefinitionStages.WithSubnetOverrides { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualNetwork create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualNetwork create(Context context); + } + /** The stage of the VirtualNetwork definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the VirtualNetwork definition allowing to specify allowedSubnets. */ + interface WithAllowedSubnets { + /** + * Specifies the allowedSubnets property: The allowed subnets of the virtual network.. + * + * @param allowedSubnets The allowed subnets of the virtual network. + * @return the next definition stage. + */ + WithCreate withAllowedSubnets(List allowedSubnets); + } + /** The stage of the VirtualNetwork definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the virtual network.. + * + * @param description The description of the virtual network. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the VirtualNetwork definition allowing to specify externalProviderResourceId. */ + interface WithExternalProviderResourceId { + /** + * Specifies the externalProviderResourceId property: The Microsoft.Network resource identifier of the + * virtual network.. + * + * @param externalProviderResourceId The Microsoft.Network resource identifier of the virtual network. + * @return the next definition stage. + */ + WithCreate withExternalProviderResourceId(String externalProviderResourceId); + } + /** The stage of the VirtualNetwork definition allowing to specify subnetOverrides. */ + interface WithSubnetOverrides { + /** + * Specifies the subnetOverrides property: The subnet overrides of the virtual network.. + * + * @param subnetOverrides The subnet overrides of the virtual network. + * @return the next definition stage. + */ + WithCreate withSubnetOverrides(List subnetOverrides); + } + } + /** + * Begins update for the VirtualNetwork resource. + * + * @return the stage of resource update. + */ + VirtualNetwork.Update update(); + + /** The template for VirtualNetwork update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualNetwork apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualNetwork apply(Context context); + } + /** The VirtualNetwork update stages. */ + interface UpdateStages { + /** The stage of the VirtualNetwork update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the resource.. + * + * @param tags The tags of the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualNetwork refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualNetwork refresh(Context context); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkFragment.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkFragment.java new file mode 100644 index 000000000000..c428930a8331 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkFragment.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** A virtual network. */ +@Immutable +public final class VirtualNetworkFragment extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkFragment.class); + + /** {@inheritDoc} */ + @Override + public VirtualNetworkFragment withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkList.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkList.java new file mode 100644 index 000000000000..c2ae99b6f30e --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworkList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devtestlabs.fluent.models.VirtualNetworkInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a list operation. */ +@Fluent +public final class VirtualNetworkList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkList.class); + + /* + * Results of the list operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link for next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Results of the list operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Results of the list operation. + * + * @param value the value value to set. + * @return the VirtualNetworkList object itself. + */ + public VirtualNetworkList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link for next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link for next set of results. + * + * @param nextLink the nextLink value to set. + * @return the VirtualNetworkList object itself. + */ + public VirtualNetworkList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworks.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworks.java new file mode 100644 index 000000000000..454e0143f737 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/VirtualNetworks.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualNetworks. */ +public interface VirtualNetworks { + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list(String resourceGroupName, String labName); + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param filter The filter to apply to the operation. Example: '$filter=contains(name,'myName'). + * @param top The maximum number of resources to return from the operation. Example: '$top=10'. + * @param orderby The ordering expression for the results, using OData notation. Example: '$orderby=name desc'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a list operation. + */ + PagedIterable list( + String resourceGroupName, + String labName, + String expand, + String filter, + Integer top, + String orderby, + Context context); + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + VirtualNetwork get(String resourceGroupName, String labName, String name); + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + Response getWithResponse( + String resourceGroupName, String labName, String name, String expand, Context context); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String labName, String name, Context context); + + /** + * Get virtual network. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + VirtualNetwork getById(String id); + + /** + * Get virtual network. + * + * @param id the resource ID. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)'. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual network. + */ + Response getByIdWithResponse(String id, String expand, Context context); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete virtual network. This operation can take a while to complete. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new VirtualNetwork resource. + * + * @param name resource name. + * @return the first stage of the new VirtualNetwork definition. + */ + VirtualNetwork.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WeekDetails.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WeekDetails.java new file mode 100644 index 000000000000..9f185eee2ec3 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WeekDetails.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a weekly schedule. */ +@Fluent +public final class WeekDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WeekDetails.class); + + /* + * The days of the week for which the schedule is set (e.g. Sunday, Monday, + * Tuesday, etc.). + */ + @JsonProperty(value = "weekdays") + private List weekdays; + + /* + * The time of the day the schedule will occur. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the weekdays property: The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, + * etc.). + * + * @return the weekdays value. + */ + public List weekdays() { + return this.weekdays; + } + + /** + * Set the weekdays property: The days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, + * etc.). + * + * @param weekdays the weekdays value to set. + * @return the WeekDetails object itself. + */ + public WeekDetails withWeekdays(List weekdays) { + this.weekdays = weekdays; + return this; + } + + /** + * Get the time property: The time of the day the schedule will occur. + * + * @return the time value. + */ + public String time() { + return this.time; + } + + /** + * Set the time property: The time of the day the schedule will occur. + * + * @param time the time value to set. + * @return the WeekDetails object itself. + */ + public WeekDetails withTime(String time) { + this.time = time; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsInfo.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsInfo.java new file mode 100644 index 000000000000..55fb6f4a1ce3 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsInfo.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a Windows OS. */ +@Fluent +public final class WindowsOsInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WindowsOsInfo.class); + + /* + * The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + * SysprepApplied). + */ + @JsonProperty(value = "windowsOsState") + private WindowsOsState windowsOsState; + + /** + * Get the windowsOsState property: The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + * SysprepApplied). + * + * @return the windowsOsState value. + */ + public WindowsOsState windowsOsState() { + return this.windowsOsState; + } + + /** + * Set the windowsOsState property: The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + * SysprepApplied). + * + * @param windowsOsState the windowsOsState value to set. + * @return the WindowsOsInfo object itself. + */ + public WindowsOsInfo withWindowsOsState(WindowsOsState windowsOsState) { + this.windowsOsState = windowsOsState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsState.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsState.java new file mode 100644 index 000000000000..bbdc49888d7f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/WindowsOsState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devtestlabs.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for WindowsOsState. */ +public final class WindowsOsState extends ExpandableStringEnum { + /** Static value NonSysprepped for WindowsOsState. */ + public static final WindowsOsState NON_SYSPREPPED = fromString("NonSysprepped"); + + /** Static value SysprepRequested for WindowsOsState. */ + public static final WindowsOsState SYSPREP_REQUESTED = fromString("SysprepRequested"); + + /** Static value SysprepApplied for WindowsOsState. */ + public static final WindowsOsState SYSPREP_APPLIED = fromString("SysprepApplied"); + + /** + * Creates or finds a WindowsOsState from its string representation. + * + * @param name a name to look for. + * @return the corresponding WindowsOsState. + */ + @JsonCreator + public static WindowsOsState fromString(String name) { + return fromString(name, WindowsOsState.class); + } + + /** @return known WindowsOsState values. */ + public static Collection values() { + return values(WindowsOsState.class); + } +} diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/package-info.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/package-info.java new file mode 100644 index 000000000000..d28a83562d3f --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for DevTestLabsClient. The DevTest Labs Client. */ +package com.azure.resourcemanager.devtestlabs.models; diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/package-info.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/package-info.java new file mode 100644 index 000000000000..ac1d64eb7494 --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for DevTestLabsClient. The DevTest Labs Client. */ +package com.azure.resourcemanager.devtestlabs; diff --git a/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/module-info.java b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/module-info.java new file mode 100644 index 000000000000..eda7eb733d1b --- /dev/null +++ b/sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.devtestlabs { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.devtestlabs; + exports com.azure.resourcemanager.devtestlabs.fluent; + exports com.azure.resourcemanager.devtestlabs.fluent.models; + exports com.azure.resourcemanager.devtestlabs.models; + + opens com.azure.resourcemanager.devtestlabs.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.devtestlabs.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/devtestlabs/ci.yml b/sdk/devtestlabs/ci.yml new file mode 100644 index 000000000000..331b58c74367 --- /dev/null +++ b/sdk/devtestlabs/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/devtestlabs/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devtestlabs/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: devtestlabs + Artifacts: + - name: azure-resourcemanager-devtestlabs + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdevtestlabs diff --git a/sdk/devtestlabs/pom.xml b/sdk/devtestlabs/pom.xml new file mode 100644 index 000000000000..63f52811248e --- /dev/null +++ b/sdk/devtestlabs/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-devtestlabs-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-devtestlabs + + + +