From 9ad5c58e665e9427a9967a7df60557078abe7e0c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 20 Nov 2020 02:23:36 +0000 Subject: [PATCH] CodeGen from PR 11724 in Azure/azure-rest-api-specs [T2] devtestlabs for python track2 (#11724) * python track2 * python --- .../mgmt-v2015_05_21_preview/pom.xml | 135 ++ .../ApplyArtifactsRequest.java | 44 + .../v2015_05_21_preview/ArmTemplateInfo.java | 30 + .../v2015_05_21_preview/Artifact.java | 78 + .../ArtifactDeploymentStatusProperties.java | 95 + .../ArtifactInstallProperties.java | 70 + .../ArtifactParameterProperties.java | 69 + .../v2015_05_21_preview/ArtifactSource.java | 367 ++++ .../v2015_05_21_preview/ArtifactSources.java | 53 + .../v2015_05_21_preview/Artifacts.java | 55 + .../devtestlabs/v2015_05_21_preview/Cost.java | 59 + .../v2015_05_21_preview/CostInsight.java | 64 + .../v2015_05_21_preview/CostInsights.java | 52 + .../CostPerDayProperties.java | 97 + .../v2015_05_21_preview/CostPropertyType.java | 44 + .../v2015_05_21_preview/Costs.java | 52 + .../v2015_05_21_preview/CustomImage.java | 339 +++ .../CustomImageOsType.java | 44 + .../CustomImagePropertiesCustom.java | 69 + .../CustomImagePropertiesFromVm.java | 121 ++ .../v2015_05_21_preview/CustomImages.java | 53 + .../v2015_05_21_preview/DayDetails.java | 43 + .../v2015_05_21_preview/EnableStatus.java | 41 + .../EvaluatePoliciesProperties.java | 95 + .../EvaluatePoliciesRequest.java | 44 + .../EvaluatePoliciesResponse.java | 26 + .../v2015_05_21_preview/Formula.java | 340 +++ .../FormulaPropertiesFromVm.java | 43 + .../v2015_05_21_preview/Formulas.java | 53 + .../v2015_05_21_preview/GalleryImage.java | 77 + .../GalleryImageReference.java | 147 ++ .../v2015_05_21_preview/GalleryImages.java | 29 + .../GenerateArmTemplateRequest.java | 96 + .../GenerateUploadUriParameter.java | 43 + .../GenerateUploadUriResponse.java | 25 + .../v2015_05_21_preview/HourDetails.java | 43 + .../devtestlabs/v2015_05_21_preview/Lab.java | 302 +++ .../v2015_05_21_preview/LabStorageType.java | 41 + .../v2015_05_21_preview/LabVhd.java | 25 + .../LabVirtualMachine.java | 716 +++++++ .../devtestlabs/v2015_05_21_preview/Labs.java | 58 + .../v2015_05_21_preview/LinuxOsInfo.java | 44 + .../v2015_05_21_preview/LinuxOsState.java | 44 + .../v2015_05_21_preview/ParameterInfo.java | 69 + .../v2015_05_21_preview/Policy.java | 339 +++ .../PolicyEvaluatorType.java | 41 + .../v2015_05_21_preview/PolicyFactName.java | 50 + .../v2015_05_21_preview/PolicySetResult.java | 71 + .../v2015_05_21_preview/PolicySets.java | 30 + .../v2015_05_21_preview/PolicyStatus.java | 41 + .../v2015_05_21_preview/PolicyViolation.java | 69 + .../v2015_05_21_preview/Policys.java | 56 + .../v2015_05_21_preview/Schedule.java | 338 +++ .../v2015_05_21_preview/Schedules.java | 64 + .../SourceControlType.java | 41 + .../v2015_05_21_preview/Subnet.java | 95 + .../v2015_05_21_preview/SubnetOverride.java | 124 ++ .../SubscriptionNotification.java | 96 + .../SubscriptionNotificationProperties.java | 43 + .../SubscriptionNotificationState.java | 53 + .../v2015_05_21_preview/TaskType.java | 44 + .../UsagePermissionType.java | 44 + .../v2015_05_21_preview/VMCostProperties.java | 95 + .../v2015_05_21_preview/VirtualMachines.java | 86 + .../v2015_05_21_preview/VirtualNetwork.java | 281 +++ .../v2015_05_21_preview/VirtualNetworks.java | 53 + .../v2015_05_21_preview/WeekDetails.java | 70 + .../v2015_05_21_preview/WindowsOsInfo.java | 44 + .../v2015_05_21_preview/WindowsOsState.java | 44 + .../implementation/ArmTemplateInfoImpl.java | 36 + .../implementation/ArmTemplateInfoInner.java | 69 + .../implementation/ArtifactImpl.java | 101 + .../implementation/ArtifactInner.java | 176 ++ .../implementation/ArtifactSourceImpl.java | 207 ++ .../implementation/ArtifactSourceInner.java | 232 ++ .../implementation/ArtifactSourcesImpl.java | 85 + .../implementation/ArtifactSourcesInner.java | 848 ++++++++ .../implementation/ArtifactsImpl.java | 83 + .../implementation/ArtifactsInner.java | 674 ++++++ .../implementation/CostImpl.java | 81 + .../implementation/CostInner.java | 74 + .../implementation/CostInsightImpl.java | 86 + .../implementation/CostInsightInner.java | 100 + .../implementation/CostInsightsImpl.java | 76 + .../implementation/CostInsightsInner.java | 712 ++++++ .../implementation/CostsImpl.java | 76 + .../implementation/CostsInner.java | 712 ++++++ .../implementation/CustomImageImpl.java | 198 ++ .../implementation/CustomImageInner.java | 207 ++ .../implementation/CustomImagesImpl.java | 85 + .../implementation/CustomImagesInner.java | 909 ++++++++ .../implementation/DevTestLabsClientImpl.java | 364 ++++ .../implementation/DevTestLabsManager.java | 243 +++ .../EvaluatePoliciesResponseImpl.java | 33 + .../EvaluatePoliciesResponseInner.java | 45 + .../implementation/FormulaImpl.java | 202 ++ .../implementation/FormulaInner.java | 204 ++ .../implementation/FormulasImpl.java | 85 + .../implementation/FormulasInner.java | 830 +++++++ .../implementation/GalleryImageImpl.java | 88 + .../implementation/GalleryImageInner.java | 178 ++ .../implementation/GalleryImagesImpl.java | 53 + .../implementation/GalleryImagesInner.java | 437 ++++ .../GenerateUploadUriResponseImpl.java | 31 + .../GenerateUploadUriResponseInner.java | 43 + .../implementation/IdParsingUtils.java | 57 + .../implementation/LabImpl.java | 137 ++ .../implementation/LabInner.java | 232 ++ .../implementation/LabVhdImpl.java | 31 + .../implementation/LabVhdInner.java | 43 + .../implementation/LabVirtualMachineImpl.java | 341 +++ .../LabVirtualMachineInner.java | 546 +++++ .../implementation/LabsImpl.java | 176 ++ .../implementation/LabsInner.java | 1904 +++++++++++++++++ .../implementation/PageImpl.java | 75 + .../implementation/PolicyImpl.java | 200 ++ .../implementation/PolicyInner.java | 209 ++ .../implementation/PolicySetsImpl.java | 42 + .../implementation/PolicySetsInner.java | 254 +++ .../implementation/PolicysImpl.java | 85 + .../implementation/PolicysInner.java | 892 ++++++++ .../implementation/ScheduleImpl.java | 199 ++ .../implementation/ScheduleInner.java | 209 ++ .../implementation/SchedulesImpl.java | 91 + .../implementation/SchedulesInner.java | 1192 +++++++++++ .../implementation/VirtualMachinesImpl.java | 103 + .../implementation/VirtualMachinesInner.java | 1725 +++++++++++++++ .../implementation/VirtualNetworkImpl.java | 175 ++ .../implementation/VirtualNetworkInner.java | 153 ++ .../implementation/VirtualNetworksImpl.java | 85 + .../implementation/VirtualNetworksInner.java | 1015 +++++++++ .../implementation/package-info.java | 11 + .../v2015_05_21_preview/package-info.java | 11 + 133 files changed, 25602 insertions(+) create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/pom.xml create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ApplyArtifactsRequest.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArmTemplateInfo.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifact.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactDeploymentStatusProperties.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactInstallProperties.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactParameterProperties.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSource.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSources.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifacts.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Cost.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsight.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsights.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPerDayProperties.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPropertyType.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Costs.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImage.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImageOsType.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesCustom.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesFromVm.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImages.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/DayDetails.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EnableStatus.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesProperties.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesRequest.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesResponse.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formula.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/FormulaPropertiesFromVm.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formulas.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImage.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImageReference.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImages.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateArmTemplateRequest.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriParameter.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriResponse.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/HourDetails.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Lab.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabStorageType.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVhd.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVirtualMachine.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Labs.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsInfo.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsState.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ParameterInfo.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policy.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyEvaluatorType.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyFactName.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySetResult.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySets.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyStatus.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyViolation.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policys.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedule.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedules.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SourceControlType.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Subnet.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubnetOverride.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotification.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationProperties.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationState.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/TaskType.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/UsagePermissionType.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VMCostProperties.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualMachines.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetwork.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetworks.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WeekDetails.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsInfo.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsState.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsClientImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsManager.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/IdParsingUtils.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PageImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksImpl.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksInner.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/package-info.java create mode 100644 sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/package-info.java diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/pom.xml b/sdk/devtestlabs/mgmt-v2015_05_21_preview/pom.xml new file mode 100644 index 0000000000000..12c0beb97359c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.devtestlabs.v2015_05_21_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-devtestlabs + 1.0.0-beta + jar + Microsoft Azure SDK for DevTestLabs Management + This package contains Microsoft DevTestLabs Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ApplyArtifactsRequest.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ApplyArtifactsRequest.java new file mode 100644 index 0000000000000..9a42b55274653 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ApplyArtifactsRequest.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request body for applying artifacts to a virtual machine. + */ +public class ApplyArtifactsRequest { + /** + * The list of artifacts to apply. + */ + @JsonProperty(value = "artifacts") + private List artifacts; + + /** + * Get the list of artifacts to apply. + * + * @return the artifacts value + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArmTemplateInfo.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArmTemplateInfo.java new file mode 100644 index 0000000000000..7b9571705f571 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArmTemplateInfo.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.ArmTemplateInfoInner; + +/** + * Type representing ArmTemplateInfo. + */ +public interface ArmTemplateInfo extends HasInner, HasManager { + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the template value. + */ + Object template(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifact.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifact.java new file mode 100644 index 0000000000000..7f1e3972416b0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifact.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.ArtifactInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.Map; + +/** + * Type representing Artifact. + */ +public interface Artifact extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the filePath value. + */ + String filePath(); + + /** + * @return the icon value. + */ + String icon(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parameters value. + */ + Object parameters(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the targetOsType value. + */ + String targetOsType(); + + /** + * @return the title value. + */ + String title(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactDeploymentStatusProperties.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactDeploymentStatusProperties.java new file mode 100644 index 0000000000000..ff92dbaf26f19 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactDeploymentStatusProperties.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an artifact deployment. + */ +public class ArtifactDeploymentStatusProperties { + /** + * 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 deployment status of the artifact. + * + * @return the deploymentStatus value + */ + public String deploymentStatus() { + return this.deploymentStatus; + } + + /** + * Set 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 total count of the artifacts that were successfully applied. + * + * @return the artifactsApplied value + */ + public Integer artifactsApplied() { + return this.artifactsApplied; + } + + /** + * Set 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 total count of the artifacts that were tentatively applied. + * + * @return the totalArtifacts value + */ + public Integer totalArtifacts() { + return this.totalArtifacts; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactInstallProperties.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactInstallProperties.java new file mode 100644 index 0000000000000..1dd57a61313d3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactInstallProperties.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an artifact. + */ +public class ArtifactInstallProperties { + /** + * The artifact's identifier. + */ + @JsonProperty(value = "artifactId") + private String artifactId; + + /** + * The parameters of the artifact. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /** + * Get the artifact's identifier. + * + * @return the artifactId value + */ + public String artifactId() { + return this.artifactId; + } + + /** + * Set 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 parameters of the artifact. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactParameterProperties.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactParameterProperties.java new file mode 100644 index 0000000000000..81f42fe7d1007 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactParameterProperties.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an artifact parameter. + */ +public class ArtifactParameterProperties { + /** + * 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 of the artifact parameter. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set 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 of the artifact parameter. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSource.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSource.java new file mode 100644 index 0000000000000..d65622666a488 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSource.java @@ -0,0 +1,367 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.ArtifactSourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.Map; + +/** + * Type representing ArtifactSource. + */ +public interface ArtifactSource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the branchRef value. + */ + String branchRef(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the folderPath value. + */ + String folderPath(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the securityToken value. + */ + String securityToken(); + + /** + * @return the sourceType value. + */ + SourceControlType sourceType(); + + /** + * @return the status value. + */ + EnableStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uri value. + */ + String uri(); + + /** + * The entirety of the ArtifactSource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of ArtifactSource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ArtifactSource definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the artifactsource definition allowing to specify Lab. + */ + interface WithLab { + /** + * Specifies resourceGroupName, labName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @return the next definition stage + */ + WithLocation withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the artifactsource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the artifactsource definition allowing to specify BranchRef. + */ + interface WithBranchRef { + /** + * Specifies branchRef. + * @param branchRef The branch reference of the artifact source + * @return the next definition stage + */ + WithCreate withBranchRef(String branchRef); + } + + /** + * The stage of the artifactsource definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the artifact source + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the artifactsource definition allowing to specify FolderPath. + */ + interface WithFolderPath { + /** + * Specifies folderPath. + * @param folderPath The folder path of the artifact source + * @return the next definition stage + */ + WithCreate withFolderPath(String folderPath); + } + + /** + * The stage of the artifactsource definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the artifactsource definition allowing to specify SecurityToken. + */ + interface WithSecurityToken { + /** + * Specifies securityToken. + * @param securityToken The security token of the artifact source + * @return the next definition stage + */ + WithCreate withSecurityToken(String securityToken); + } + + /** + * The stage of the artifactsource definition allowing to specify SourceType. + */ + interface WithSourceType { + /** + * Specifies sourceType. + * @param sourceType The type of the artifact source. Possible values include: 'VsoGit', 'GitHub' + * @return the next definition stage + */ + WithCreate withSourceType(SourceControlType sourceType); + } + + /** + * The stage of the artifactsource definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the artifact source. Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withStatus(EnableStatus status); + } + + /** + * The stage of the artifactsource definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the artifactsource definition allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + * @param uri The URI of the artifact source + * @return the next definition stage + */ + WithCreate withUri(String uri); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithBranchRef, DefinitionStages.WithDisplayName, DefinitionStages.WithFolderPath, DefinitionStages.WithProvisioningState, DefinitionStages.WithSecurityToken, DefinitionStages.WithSourceType, DefinitionStages.WithStatus, DefinitionStages.WithTags, DefinitionStages.WithUri { + } + } + /** + * The template for a ArtifactSource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBranchRef, UpdateStages.WithDisplayName, UpdateStages.WithFolderPath, UpdateStages.WithProvisioningState, UpdateStages.WithSecurityToken, UpdateStages.WithSourceType, UpdateStages.WithStatus, UpdateStages.WithTags, UpdateStages.WithUri { + } + + /** + * Grouping of ArtifactSource update stages. + */ + interface UpdateStages { + /** + * The stage of the artifactsource update allowing to specify BranchRef. + */ + interface WithBranchRef { + /** + * Specifies branchRef. + * @param branchRef The branch reference of the artifact source + * @return the next update stage + */ + Update withBranchRef(String branchRef); + } + + /** + * The stage of the artifactsource update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The display name of the artifact source + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the artifactsource update allowing to specify FolderPath. + */ + interface WithFolderPath { + /** + * Specifies folderPath. + * @param folderPath The folder path of the artifact source + * @return the next update stage + */ + Update withFolderPath(String folderPath); + } + + /** + * The stage of the artifactsource update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the artifactsource update allowing to specify SecurityToken. + */ + interface WithSecurityToken { + /** + * Specifies securityToken. + * @param securityToken The security token of the artifact source + * @return the next update stage + */ + Update withSecurityToken(String securityToken); + } + + /** + * The stage of the artifactsource update allowing to specify SourceType. + */ + interface WithSourceType { + /** + * Specifies sourceType. + * @param sourceType The type of the artifact source. Possible values include: 'VsoGit', 'GitHub' + * @return the next update stage + */ + Update withSourceType(SourceControlType sourceType); + } + + /** + * The stage of the artifactsource update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the artifact source. Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withStatus(EnableStatus status); + } + + /** + * The stage of the artifactsource update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the artifactsource update allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + * @param uri The URI of the artifact source + * @return the next update stage + */ + Update withUri(String uri); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSources.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSources.java new file mode 100644 index 0000000000000..e339f425ace33 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ArtifactSources.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.ArtifactSourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ArtifactSources. + */ +public interface ArtifactSources extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteResourceAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifacts.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifacts.java new file mode 100644 index 0000000000000..887c490b22486 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Artifacts.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.ArtifactsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Artifacts. + */ +public interface Artifacts extends HasInner { + /** + * 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 the GenerateArmTemplateRequest value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable generateArmTemplateAsync(String resourceGroupName, String labName, String artifactSourceName, String name, GenerateArmTemplateRequest generateArmTemplateRequest); + + /** + * 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 + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String artifactSourceName, String name); + + /** + * List artifacts. + * + * @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 + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String artifactSourceName); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Cost.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Cost.java new file mode 100644 index 0000000000000..a868f9dfcd523 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Cost.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.CostInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing Cost. + */ +public interface Cost extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the costs value. + */ + List costs(); + + /** + * @return the currencyCode value. + */ + String currencyCode(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsight.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsight.java new file mode 100644 index 0000000000000..3a90573ac25bb --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsight.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.CostInsightInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.Map; +import java.util.List; + +/** + * Type representing CostInsight. + */ +public interface CostInsight extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the currencyCode value. + */ + String currencyCode(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the vmCosts value. + */ + List vmCosts(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsights.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsights.java new file mode 100644 index 0000000000000..864f74f3f33d8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostInsights.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.CostInsightsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing CostInsights. + */ +public interface CostInsights extends HasInner { + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable refreshDataAsync(String resourceGroupName, String labName, String name); + + /** + * Get cost insight. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPerDayProperties.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPerDayProperties.java new file mode 100644 index 0000000000000..104f26c56dcf4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPerDayProperties.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The per-day properties of a cost item. + */ +public class CostPerDayProperties { + /** + * The date of the cost item. + */ + @JsonProperty(value = "date") + private DateTime dateProperty; + + /** + * The cost of the cost item. + */ + @JsonProperty(value = "cost") + private Double cost; + + /** + * The type of the cost. Possible values include: 'Unavailable', + * 'Reported', 'Projected'. + */ + @JsonProperty(value = "costType") + private CostPropertyType costType; + + /** + * Get the date of the cost item. + * + * @return the dateProperty value + */ + public DateTime dateProperty() { + return this.dateProperty; + } + + /** + * Set the date of the cost item. + * + * @param dateProperty the dateProperty value to set + * @return the CostPerDayProperties object itself. + */ + public CostPerDayProperties withDateProperty(DateTime dateProperty) { + this.dateProperty = dateProperty; + return this; + } + + /** + * Get the cost of the cost item. + * + * @return the cost value + */ + public Double cost() { + return this.cost; + } + + /** + * Set the cost of the cost item. + * + * @param cost the cost value to set + * @return the CostPerDayProperties object itself. + */ + public CostPerDayProperties withCost(Double cost) { + this.cost = cost; + return this; + } + + /** + * Get the type of the cost. Possible values include: 'Unavailable', 'Reported', 'Projected'. + * + * @return the costType value + */ + public CostPropertyType costType() { + return this.costType; + } + + /** + * Set the type of the cost. Possible values include: 'Unavailable', 'Reported', 'Projected'. + * + * @param costType the costType value to set + * @return the CostPerDayProperties object itself. + */ + public CostPerDayProperties withCostType(CostPropertyType costType) { + this.costType = costType; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPropertyType.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPropertyType.java new file mode 100644 index 0000000000000..07d6dc6f8dec1 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CostPropertyType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CostPropertyType. + */ +public final class CostPropertyType extends ExpandableStringEnum { + /** Static value Unavailable for CostPropertyType. */ + public static final CostPropertyType UNAVAILABLE = fromString("Unavailable"); + + /** Static value Reported for CostPropertyType. */ + public static final CostPropertyType REPORTED = fromString("Reported"); + + /** Static value Projected for CostPropertyType. */ + public static final CostPropertyType PROJECTED = fromString("Projected"); + + /** + * Creates or finds a CostPropertyType from its string representation. + * @param name a name to look for + * @return the corresponding CostPropertyType + */ + @JsonCreator + public static CostPropertyType fromString(String name) { + return fromString(name, CostPropertyType.class); + } + + /** + * @return known CostPropertyType values + */ + public static Collection values() { + return values(CostPropertyType.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Costs.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Costs.java new file mode 100644 index 0000000000000..50989f2cd601b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Costs.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.CostsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Costs. + */ +public interface Costs extends HasInner { + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @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 + * @return the observable for the request + */ + Completable refreshDataAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImage.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImage.java new file mode 100644 index 0000000000000..d47293300c3a8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImage.java @@ -0,0 +1,339 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.CustomImageInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing CustomImage. + */ +public interface CustomImage extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the author value. + */ + String author(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the osType value. + */ + CustomImageOsType osType(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the vhd value. + */ + CustomImagePropertiesCustom vhd(); + + /** + * @return the vm value. + */ + CustomImagePropertiesFromVm vm(); + + /** + * The entirety of the CustomImage definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of CustomImage definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CustomImage definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the customimage definition allowing to specify Lab. + */ + interface WithLab { + /** + * Specifies resourceGroupName, labName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @return the next definition stage + */ + WithLocation withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the customimage definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the customimage definition allowing to specify Author. + */ + interface WithAuthor { + /** + * Specifies author. + * @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 CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The creation date of the custom image + * @return the next definition stage + */ + WithCreate withCreationDate(DateTime creationDate); + } + + /** + * The stage of the customimage definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @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 OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @param osType The OS type of the custom image. Possible values include: 'Windows', 'Linux', 'None' + * @return the next definition stage + */ + WithCreate withOsType(CustomImageOsType osType); + } + + /** + * The stage of the customimage definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the customimage definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the customimage definition allowing to specify Vhd. + */ + interface WithVhd { + /** + * Specifies vhd. + * @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 Vm. + */ + interface WithVm { + /** + * Specifies vm. + * @param vm the vm parameter value + * @return the next definition stage + */ + WithCreate withVm(CustomImagePropertiesFromVm vm); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAuthor, DefinitionStages.WithCreationDate, DefinitionStages.WithDescription, DefinitionStages.WithOsType, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithVhd, DefinitionStages.WithVm { + } + } + /** + * The template for a CustomImage update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuthor, UpdateStages.WithCreationDate, UpdateStages.WithDescription, UpdateStages.WithOsType, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithVhd, UpdateStages.WithVm { + } + + /** + * Grouping of CustomImage update stages. + */ + interface UpdateStages { + /** + * The stage of the customimage update allowing to specify Author. + */ + interface WithAuthor { + /** + * Specifies author. + * @param author The author of the custom image + * @return the next update stage + */ + Update withAuthor(String author); + } + + /** + * The stage of the customimage update allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The creation date of the custom image + * @return the next update stage + */ + Update withCreationDate(DateTime creationDate); + } + + /** + * The stage of the customimage update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The description of the custom image + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the customimage update allowing to specify OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @param osType The OS type of the custom image. Possible values include: 'Windows', 'Linux', 'None' + * @return the next update stage + */ + Update withOsType(CustomImageOsType osType); + } + + /** + * The stage of the customimage update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the customimage update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the customimage update allowing to specify Vhd. + */ + interface WithVhd { + /** + * Specifies vhd. + * @param vhd The VHD from which the image is to be created + * @return the next update stage + */ + Update withVhd(CustomImagePropertiesCustom vhd); + } + + /** + * The stage of the customimage update allowing to specify Vm. + */ + interface WithVm { + /** + * Specifies vm. + * @param vm the vm parameter value + * @return the next update stage + */ + Update withVm(CustomImagePropertiesFromVm vm); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImageOsType.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImageOsType.java new file mode 100644 index 0000000000000..018f94bbd314e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImageOsType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesCustom.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesCustom.java new file mode 100644 index 0000000000000..a45188d91d989 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesCustom.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for creating a custom image from a VHD. + */ +public class CustomImagePropertiesCustom { + /** + * The image name. + */ + @JsonProperty(value = "imageName") + private String imageName; + + /** + * Indicates whether sysprep has been run on the VHD. + */ + @JsonProperty(value = "sysPrep") + private Boolean sysPrep; + + /** + * Get the image name. + * + * @return the imageName value + */ + public String imageName() { + return this.imageName; + } + + /** + * Set 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 indicates whether sysprep has been run on the VHD. + * + * @return the sysPrep value + */ + public Boolean sysPrep() { + return this.sysPrep; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesFromVm.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesFromVm.java new file mode 100644 index 0000000000000..27ba91b57b65e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImagePropertiesFromVm.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for creating a custom image from a virtual machine. + */ +public class CustomImagePropertiesFromVm { + /** + * The source vm identifier. + */ + @JsonProperty(value = "sourceVmId") + private String sourceVmId; + + /** + * Indicates whether sysprep has been run on the VHD. + */ + @JsonProperty(value = "sysPrep") + private Boolean sysPrep; + + /** + * 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 source vm identifier. + * + * @return the sourceVmId value + */ + public String sourceVmId() { + return this.sourceVmId; + } + + /** + * Set 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 indicates whether sysprep has been run on the VHD. + * + * @return the sysPrep value + */ + public Boolean sysPrep() { + return this.sysPrep; + } + + /** + * Set indicates whether sysprep has been run on the VHD. + * + * @param sysPrep the sysPrep value to set + * @return the CustomImagePropertiesFromVm object itself. + */ + public CustomImagePropertiesFromVm withSysPrep(Boolean sysPrep) { + this.sysPrep = sysPrep; + return this; + } + + /** + * Get the Windows OS information of the VM. + * + * @return the windowsOsInfo value + */ + public WindowsOsInfo windowsOsInfo() { + return this.windowsOsInfo; + } + + /** + * Set 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 Linux OS information of the VM. + * + * @return the linuxOsInfo value + */ + public LinuxOsInfo linuxOsInfo() { + return this.linuxOsInfo; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImages.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImages.java new file mode 100644 index 0000000000000..abb56ae5d52eb --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/CustomImages.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.CustomImagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing CustomImages. + */ +public interface CustomImages extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteResourceAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/DayDetails.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/DayDetails.java new file mode 100644 index 0000000000000..583bade899fd4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/DayDetails.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a daily schedule. + */ +public class DayDetails { + /** + * The time property. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the time value. + * + * @return the time value + */ + public String time() { + return this.time; + } + + /** + * Set the time value. + * + * @param time the time value to set + * @return the DayDetails object itself. + */ + public DayDetails withTime(String time) { + this.time = time; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EnableStatus.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EnableStatus.java new file mode 100644 index 0000000000000..5cd67281d168e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EnableStatus.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesProperties.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesProperties.java new file mode 100644 index 0000000000000..f3a05a0aa04e0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesProperties.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for evaluating a policy set. + */ +public class EvaluatePoliciesProperties { + /** + * 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; + + /** + * Get the fact name. + * + * @return the factName value + */ + public String factName() { + return this.factName; + } + + /** + * Set 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 fact data. + * + * @return the factData value + */ + public String factData() { + return this.factData; + } + + /** + * Set 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 value offset. + * + * @return the valueOffset value + */ + public String valueOffset() { + return this.valueOffset; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesRequest.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesRequest.java new file mode 100644 index 0000000000000..3d5506e5ea91b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesRequest.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request body for evaluating a policy set. + */ +public class EvaluatePoliciesRequest { + /** + * Policies to evaluate. + */ + @JsonProperty(value = "policies") + private List policies; + + /** + * Get policies to evaluate. + * + * @return the policies value + */ + public List policies() { + return this.policies; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesResponse.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesResponse.java new file mode 100644 index 0000000000000..6ea262aab960d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/EvaluatePoliciesResponse.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.EvaluatePoliciesResponseInner; +import java.util.List; + +/** + * Type representing EvaluatePoliciesResponse. + */ +public interface EvaluatePoliciesResponse extends HasInner, HasManager { + /** + * @return the results value. + */ + List results(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formula.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formula.java new file mode 100644 index 0000000000000..6ebb3fe3dbf8f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formula.java @@ -0,0 +1,340 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.FormulaInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import org.joda.time.DateTime; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.LabVirtualMachineInner; + +/** + * Type representing Formula. + */ +public interface Formula extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the author value. + */ + String author(); + + /** + * @return the creationDate value. + */ + DateTime creationDate(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the formulaContent value. + */ + LabVirtualMachine formulaContent(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the osType value. + */ + String osType(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the vm value. + */ + FormulaPropertiesFromVm vm(); + + /** + * The entirety of the Formula definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Formula definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Formula definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the formula definition allowing to specify Lab. + */ + interface WithLab { + /** + * Specifies resourceGroupName, labName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @return the next definition stage + */ + WithLocation withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the formula definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the formula definition allowing to specify Author. + */ + interface WithAuthor { + /** + * Specifies author. + * @param author The author of the formula + * @return the next definition stage + */ + WithCreate withAuthor(String author); + } + + /** + * The stage of the formula definition allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The creation date of the formula + * @return the next definition stage + */ + WithCreate withCreationDate(DateTime creationDate); + } + + /** + * The stage of the formula definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @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 FormulaContent. + */ + interface WithFormulaContent { + /** + * Specifies formulaContent. + * @param formulaContent The content of the formula + * @return the next definition stage + */ + WithCreate withFormulaContent(LabVirtualMachineInner formulaContent); + } + + /** + * The stage of the formula definition allowing to specify OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @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 ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the formula definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the formula definition allowing to specify Vm. + */ + interface WithVm { + /** + * Specifies vm. + * @param vm Information about a VM from which a formula is to be created + * @return the next definition stage + */ + WithCreate withVm(FormulaPropertiesFromVm vm); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAuthor, DefinitionStages.WithCreationDate, DefinitionStages.WithDescription, DefinitionStages.WithFormulaContent, DefinitionStages.WithOsType, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithVm { + } + } + /** + * The template for a Formula update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuthor, UpdateStages.WithCreationDate, UpdateStages.WithDescription, UpdateStages.WithFormulaContent, UpdateStages.WithOsType, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithVm { + } + + /** + * Grouping of Formula update stages. + */ + interface UpdateStages { + /** + * The stage of the formula update allowing to specify Author. + */ + interface WithAuthor { + /** + * Specifies author. + * @param author The author of the formula + * @return the next update stage + */ + Update withAuthor(String author); + } + + /** + * The stage of the formula update allowing to specify CreationDate. + */ + interface WithCreationDate { + /** + * Specifies creationDate. + * @param creationDate The creation date of the formula + * @return the next update stage + */ + Update withCreationDate(DateTime creationDate); + } + + /** + * The stage of the formula update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The description of the formula + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the formula update allowing to specify FormulaContent. + */ + interface WithFormulaContent { + /** + * Specifies formulaContent. + * @param formulaContent The content of the formula + * @return the next update stage + */ + Update withFormulaContent(LabVirtualMachineInner formulaContent); + } + + /** + * The stage of the formula update allowing to specify OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @param osType The OS type of the formula + * @return the next update stage + */ + Update withOsType(String osType); + } + + /** + * The stage of the formula update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the formula update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the formula update allowing to specify Vm. + */ + interface WithVm { + /** + * Specifies vm. + * @param vm Information about a VM from which a formula is to be created + * @return the next update stage + */ + Update withVm(FormulaPropertiesFromVm vm); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/FormulaPropertiesFromVm.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/FormulaPropertiesFromVm.java new file mode 100644 index 0000000000000..a693acfacc4c6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/FormulaPropertiesFromVm.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a VM from which a formula is to be created. + */ +public class FormulaPropertiesFromVm { + /** + * The identifier of the VM from which a formula is to be created. + */ + @JsonProperty(value = "labVmId") + private String labVmId; + + /** + * Get 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 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formulas.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formulas.java new file mode 100644 index 0000000000000..77deecda97608 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Formulas.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.FormulasInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Formulas. + */ +public interface Formulas extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteResourceAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImage.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImage.java new file mode 100644 index 0000000000000..ca9df9f9ea850 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImage.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.GalleryImageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing GalleryImage. + */ +public interface GalleryImage extends HasInner, HasManager { + /** + * @return the author value. + */ + String author(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the icon value. + */ + String icon(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the imageReference value. + */ + GalleryImageReference imageReference(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImageReference.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImageReference.java new file mode 100644 index 0000000000000..2873bb0144661 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImageReference.java @@ -0,0 +1,147 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The reference information for an Azure Marketplace image. + */ +public class GalleryImageReference { + /** + * 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 of the gallery image. + * + * @return the offer value + */ + public String offer() { + return this.offer; + } + + /** + * Set 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 of the gallery image. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Set 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 of the gallery image. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Set 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 OS type of the gallery image. + * + * @return the osType value + */ + public String osType() { + return this.osType; + } + + /** + * Set 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 of the gallery image. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImages.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImages.java new file mode 100644 index 0000000000000..ba213461ee834 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GalleryImages.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.GalleryImagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GalleryImages. + */ +public interface GalleryImages extends HasInner { + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateArmTemplateRequest.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateArmTemplateRequest.java new file mode 100644 index 0000000000000..710a7db33e02f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateArmTemplateRequest.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for generating an ARM template for deploying artifacts. + */ +public class GenerateArmTemplateRequest { + /** + * 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; + + /** + * Get the resource name of the virtual machine. + * + * @return the virtualMachineName value + */ + public String virtualMachineName() { + return this.virtualMachineName; + } + + /** + * Set 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 of the ARM template. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Set 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 of the virtual machine. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriParameter.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriParameter.java new file mode 100644 index 0000000000000..8aa2c714089cf --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriParameter.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for generating an upload URI. + */ +public class GenerateUploadUriParameter { + /** + * The blob name of the upload URI. + */ + @JsonProperty(value = "blobName") + private String blobName; + + /** + * Get the blob name of the upload URI. + * + * @return the blobName value + */ + public String blobName() { + return this.blobName; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriResponse.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriResponse.java new file mode 100644 index 0000000000000..dea57426d1718 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/GenerateUploadUriResponse.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.GenerateUploadUriResponseInner; + +/** + * Type representing GenerateUploadUriResponse. + */ +public interface GenerateUploadUriResponse extends HasInner, HasManager { + /** + * @return the uploadUri value. + */ + String uploadUri(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/HourDetails.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/HourDetails.java new file mode 100644 index 0000000000000..eaa2087cdf900 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/HourDetails.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an hourly schedule. + */ +public class HourDetails { + /** + * Minutes of the hour the schedule will run. + */ + @JsonProperty(value = "minute") + private Integer minute; + + /** + * Get minutes of the hour the schedule will run. + * + * @return the minute value + */ + public Integer minute() { + return this.minute; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Lab.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Lab.java new file mode 100644 index 0000000000000..e141d313b0998 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Lab.java @@ -0,0 +1,302 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.List; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.LabInner; + +/** + * Type representing Lab. + */ +public interface Lab extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the artifactsStorageAccount value. + */ + String artifactsStorageAccount(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the defaultStorageAccount value. + */ + String defaultStorageAccount(); + + /** + * @return the defaultVirtualNetworkId value. + */ + String defaultVirtualNetworkId(); + + /** + * @return the labStorageType value. + */ + LabStorageType labStorageType(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the storageAccounts value. + */ + List storageAccounts(); + + /** + * @return the vaultName value. + */ + String vaultName(); + + /** + * The entirety of the Lab definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Lab definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Lab definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Lab definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the lab definition allowing to specify ArtifactsStorageAccount. + */ + interface WithArtifactsStorageAccount { + /** + * Specifies artifactsStorageAccount. + * @param artifactsStorageAccount The artifact storage account of the lab + * @return the next definition stage + */ + WithCreate withArtifactsStorageAccount(String artifactsStorageAccount); + } + + /** + * The stage of the lab definition allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The creation date of the lab + * @return the next definition stage + */ + WithCreate withCreatedDate(DateTime createdDate); + } + + /** + * The stage of the lab definition allowing to specify DefaultStorageAccount. + */ + interface WithDefaultStorageAccount { + /** + * Specifies defaultStorageAccount. + * @param defaultStorageAccount The lab's default storage account + * @return the next definition stage + */ + WithCreate withDefaultStorageAccount(String defaultStorageAccount); + } + + /** + * The stage of the lab definition allowing to specify DefaultVirtualNetworkId. + */ + interface WithDefaultVirtualNetworkId { + /** + * Specifies defaultVirtualNetworkId. + * @param defaultVirtualNetworkId The default virtual network identifier of the lab + * @return the next definition stage + */ + WithCreate withDefaultVirtualNetworkId(String defaultVirtualNetworkId); + } + + /** + * The stage of the lab definition allowing to specify LabStorageType. + */ + interface WithLabStorageType { + /** + * Specifies labStorageType. + * @param labStorageType The type of the lab storage. Possible values include: 'Standard', 'Premium' + * @return the next definition stage + */ + WithCreate withLabStorageType(LabStorageType labStorageType); + } + + /** + * The stage of the lab definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the lab definition allowing to specify StorageAccounts. + */ + interface WithStorageAccounts { + /** + * Specifies storageAccounts. + * @param storageAccounts The storage accounts of the lab + * @return the next definition stage + */ + WithCreate withStorageAccounts(List storageAccounts); + } + + /** + * The stage of the lab definition allowing to specify VaultName. + */ + interface WithVaultName { + /** + * Specifies vaultName. + * @param vaultName The name of the key vault of the lab + * @return the next definition stage + */ + WithCreate withVaultName(String vaultName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithArtifactsStorageAccount, DefinitionStages.WithCreatedDate, DefinitionStages.WithDefaultStorageAccount, DefinitionStages.WithDefaultVirtualNetworkId, DefinitionStages.WithLabStorageType, DefinitionStages.WithProvisioningState, DefinitionStages.WithStorageAccounts, DefinitionStages.WithVaultName { + } + } + /** + * The template for a Lab update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithArtifactsStorageAccount, UpdateStages.WithCreatedDate, UpdateStages.WithDefaultStorageAccount, UpdateStages.WithDefaultVirtualNetworkId, UpdateStages.WithLabStorageType, UpdateStages.WithProvisioningState, UpdateStages.WithStorageAccounts, UpdateStages.WithVaultName { + } + + /** + * Grouping of Lab update stages. + */ + interface UpdateStages { + /** + * The stage of the lab update allowing to specify ArtifactsStorageAccount. + */ + interface WithArtifactsStorageAccount { + /** + * Specifies artifactsStorageAccount. + * @param artifactsStorageAccount The artifact storage account of the lab + * @return the next update stage + */ + Update withArtifactsStorageAccount(String artifactsStorageAccount); + } + + /** + * The stage of the lab update allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The creation date of the lab + * @return the next update stage + */ + Update withCreatedDate(DateTime createdDate); + } + + /** + * The stage of the lab update allowing to specify DefaultStorageAccount. + */ + interface WithDefaultStorageAccount { + /** + * Specifies defaultStorageAccount. + * @param defaultStorageAccount The lab's default storage account + * @return the next update stage + */ + Update withDefaultStorageAccount(String defaultStorageAccount); + } + + /** + * The stage of the lab update allowing to specify DefaultVirtualNetworkId. + */ + interface WithDefaultVirtualNetworkId { + /** + * Specifies defaultVirtualNetworkId. + * @param defaultVirtualNetworkId The default virtual network identifier of the lab + * @return the next update stage + */ + Update withDefaultVirtualNetworkId(String defaultVirtualNetworkId); + } + + /** + * The stage of the lab update allowing to specify LabStorageType. + */ + interface WithLabStorageType { + /** + * Specifies labStorageType. + * @param labStorageType The type of the lab storage. Possible values include: 'Standard', 'Premium' + * @return the next update stage + */ + Update withLabStorageType(LabStorageType labStorageType); + } + + /** + * The stage of the lab update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the lab update allowing to specify StorageAccounts. + */ + interface WithStorageAccounts { + /** + * Specifies storageAccounts. + * @param storageAccounts The storage accounts of the lab + * @return the next update stage + */ + Update withStorageAccounts(List storageAccounts); + } + + /** + * The stage of the lab update allowing to specify VaultName. + */ + interface WithVaultName { + /** + * Specifies vaultName. + * @param vaultName The name of the key vault of the lab + * @return the next update stage + */ + Update withVaultName(String vaultName); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabStorageType.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabStorageType.java new file mode 100644 index 0000000000000..c03ed5b9a9b95 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabStorageType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LabStorageType. + */ +public final class LabStorageType extends ExpandableStringEnum { + /** Static value Standard for LabStorageType. */ + public static final LabStorageType STANDARD = fromString("Standard"); + + /** Static value Premium for LabStorageType. */ + public static final LabStorageType PREMIUM = fromString("Premium"); + + /** + * Creates or finds a LabStorageType from its string representation. + * @param name a name to look for + * @return the corresponding LabStorageType + */ + @JsonCreator + public static LabStorageType fromString(String name) { + return fromString(name, LabStorageType.class); + } + + /** + * @return known LabStorageType values + */ + public static Collection values() { + return values(LabStorageType.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVhd.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVhd.java new file mode 100644 index 0000000000000..d60a67f89077e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVhd.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.LabVhdInner; + +/** + * Type representing LabVhd. + */ +public interface LabVhd extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVirtualMachine.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVirtualMachine.java new file mode 100644 index 0000000000000..299b3aa2a0f8a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LabVirtualMachine.java @@ -0,0 +1,716 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.LabVirtualMachineInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing LabVirtualMachine. + */ +public interface LabVirtualMachine extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the artifactDeploymentStatus value. + */ + ArtifactDeploymentStatusProperties artifactDeploymentStatus(); + + /** + * @return the artifacts value. + */ + List artifacts(); + + /** + * @return the computeId value. + */ + String computeId(); + + /** + * @return the createdByUser value. + */ + String createdByUser(); + + /** + * @return the createdByUserId value. + */ + String createdByUserId(); + + /** + * @return the customImageId value. + */ + String customImageId(); + + /** + * @return the disallowPublicIpAddress value. + */ + Boolean disallowPublicIpAddress(); + + /** + * @return the fqdn value. + */ + String fqdn(); + + /** + * @return the galleryImageReference value. + */ + GalleryImageReference galleryImageReference(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isAuthenticationWithSshKey value. + */ + Boolean isAuthenticationWithSshKey(); + + /** + * @return the labSubnetName value. + */ + String labSubnetName(); + + /** + * @return the labVirtualNetworkId value. + */ + String labVirtualNetworkId(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the notes value. + */ + String notes(); + + /** + * @return the osType value. + */ + String osType(); + + /** + * @return the ownerObjectId value. + */ + String ownerObjectId(); + + /** + * @return the password value. + */ + String password(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the size value. + */ + String size(); + + /** + * @return the sshKey value. + */ + String sshKey(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the userName value. + */ + String userName(); + + /** + * The entirety of the LabVirtualMachine definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of LabVirtualMachine definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LabVirtualMachine definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the labvirtualmachine definition allowing to specify Lab. + */ + interface WithLab { + /** + * Specifies resourceGroupName, labName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @return the next definition stage + */ + WithLocation withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify ArtifactDeploymentStatus. + */ + interface WithArtifactDeploymentStatus { + /** + * Specifies artifactDeploymentStatus. + * @param artifactDeploymentStatus The artifact deployment status for the virtual machine + * @return the next definition stage + */ + WithCreate withArtifactDeploymentStatus(ArtifactDeploymentStatusProperties artifactDeploymentStatus); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify Artifacts. + */ + interface WithArtifacts { + /** + * Specifies artifacts. + * @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 ComputeId. + */ + interface WithComputeId { + /** + * Specifies computeId. + * @param computeId The resource identifier (Microsoft.Compute) of the virtual machine + * @return the next definition stage + */ + WithCreate withComputeId(String computeId); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify CreatedByUser. + */ + interface WithCreatedByUser { + /** + * Specifies createdByUser. + * @param createdByUser The email address of creator of the virtual machine + * @return the next definition stage + */ + WithCreate withCreatedByUser(String createdByUser); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify CreatedByUserId. + */ + interface WithCreatedByUserId { + /** + * Specifies createdByUserId. + * @param createdByUserId The object identifier of the creator of the virtual machine + * @return the next definition stage + */ + WithCreate withCreatedByUserId(String createdByUserId); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify CustomImageId. + */ + interface WithCustomImageId { + /** + * Specifies customImageId. + * @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 DisallowPublicIpAddress. + */ + interface WithDisallowPublicIpAddress { + /** + * Specifies disallowPublicIpAddress. + * @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 Fqdn. + */ + interface WithFqdn { + /** + * Specifies fqdn. + * @param fqdn The fully-qualified domain name of the virtual machine + * @return the next definition stage + */ + WithCreate withFqdn(String fqdn); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify GalleryImageReference. + */ + interface WithGalleryImageReference { + /** + * Specifies galleryImageReference. + * @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 IsAuthenticationWithSshKey. + */ + interface WithIsAuthenticationWithSshKey { + /** + * Specifies isAuthenticationWithSshKey. + * @param isAuthenticationWithSshKey A value indicating 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 labSubnetName. + * @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 labVirtualNetworkId. + * @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 Notes. + */ + interface WithNotes { + /** + * Specifies notes. + * @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 OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @param osType The OS type of the virtual machine + * @return the next definition stage + */ + WithCreate withOsType(String osType); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify OwnerObjectId. + */ + interface WithOwnerObjectId { + /** + * Specifies ownerObjectId. + * @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 Password. + */ + interface WithPassword { + /** + * Specifies password. + * @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 ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify Size. + */ + interface WithSize { + /** + * Specifies size. + * @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 SshKey. + */ + interface WithSshKey { + /** + * Specifies sshKey. + * @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 Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify UserName. + */ + interface WithUserName { + /** + * Specifies userName. + * @param userName The user name of the virtual machine + * @return the next definition stage + */ + WithCreate withUserName(String userName); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithArtifactDeploymentStatus, DefinitionStages.WithArtifacts, DefinitionStages.WithComputeId, DefinitionStages.WithCreatedByUser, DefinitionStages.WithCreatedByUserId, DefinitionStages.WithCustomImageId, DefinitionStages.WithDisallowPublicIpAddress, DefinitionStages.WithFqdn, DefinitionStages.WithGalleryImageReference, DefinitionStages.WithIsAuthenticationWithSshKey, DefinitionStages.WithLabSubnetName, DefinitionStages.WithLabVirtualNetworkId, DefinitionStages.WithNotes, DefinitionStages.WithOsType, DefinitionStages.WithOwnerObjectId, DefinitionStages.WithPassword, DefinitionStages.WithProvisioningState, DefinitionStages.WithSize, DefinitionStages.WithSshKey, DefinitionStages.WithTags, DefinitionStages.WithUserName { + } + } + /** + * The template for a LabVirtualMachine update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithArtifactDeploymentStatus, UpdateStages.WithArtifacts, UpdateStages.WithComputeId, UpdateStages.WithCreatedByUser, UpdateStages.WithCreatedByUserId, UpdateStages.WithCustomImageId, UpdateStages.WithDisallowPublicIpAddress, UpdateStages.WithFqdn, UpdateStages.WithGalleryImageReference, UpdateStages.WithIsAuthenticationWithSshKey, UpdateStages.WithLabSubnetName, UpdateStages.WithLabVirtualNetworkId, UpdateStages.WithNotes, UpdateStages.WithOsType, UpdateStages.WithOwnerObjectId, UpdateStages.WithPassword, UpdateStages.WithProvisioningState, UpdateStages.WithSize, UpdateStages.WithSshKey, UpdateStages.WithTags, UpdateStages.WithUserName { + } + + /** + * Grouping of LabVirtualMachine update stages. + */ + interface UpdateStages { + /** + * The stage of the labvirtualmachine update allowing to specify ArtifactDeploymentStatus. + */ + interface WithArtifactDeploymentStatus { + /** + * Specifies artifactDeploymentStatus. + * @param artifactDeploymentStatus The artifact deployment status for the virtual machine + * @return the next update stage + */ + Update withArtifactDeploymentStatus(ArtifactDeploymentStatusProperties artifactDeploymentStatus); + } + + /** + * The stage of the labvirtualmachine update allowing to specify Artifacts. + */ + interface WithArtifacts { + /** + * Specifies artifacts. + * @param artifacts The artifacts to be installed on the virtual machine + * @return the next update stage + */ + Update withArtifacts(List artifacts); + } + + /** + * The stage of the labvirtualmachine update allowing to specify ComputeId. + */ + interface WithComputeId { + /** + * Specifies computeId. + * @param computeId The resource identifier (Microsoft.Compute) of the virtual machine + * @return the next update stage + */ + Update withComputeId(String computeId); + } + + /** + * The stage of the labvirtualmachine update allowing to specify CreatedByUser. + */ + interface WithCreatedByUser { + /** + * Specifies createdByUser. + * @param createdByUser The email address of creator of the virtual machine + * @return the next update stage + */ + Update withCreatedByUser(String createdByUser); + } + + /** + * The stage of the labvirtualmachine update allowing to specify CreatedByUserId. + */ + interface WithCreatedByUserId { + /** + * Specifies createdByUserId. + * @param createdByUserId The object identifier of the creator of the virtual machine + * @return the next update stage + */ + Update withCreatedByUserId(String createdByUserId); + } + + /** + * The stage of the labvirtualmachine update allowing to specify CustomImageId. + */ + interface WithCustomImageId { + /** + * Specifies customImageId. + * @param customImageId The custom image identifier of the virtual machine + * @return the next update stage + */ + Update withCustomImageId(String customImageId); + } + + /** + * The stage of the labvirtualmachine update allowing to specify DisallowPublicIpAddress. + */ + interface WithDisallowPublicIpAddress { + /** + * Specifies disallowPublicIpAddress. + * @param disallowPublicIpAddress Indicates whether the virtual machine is to be created without a public IP address + * @return the next update stage + */ + Update withDisallowPublicIpAddress(Boolean disallowPublicIpAddress); + } + + /** + * The stage of the labvirtualmachine update allowing to specify Fqdn. + */ + interface WithFqdn { + /** + * Specifies fqdn. + * @param fqdn The fully-qualified domain name of the virtual machine + * @return the next update stage + */ + Update withFqdn(String fqdn); + } + + /** + * The stage of the labvirtualmachine update allowing to specify GalleryImageReference. + */ + interface WithGalleryImageReference { + /** + * Specifies galleryImageReference. + * @param galleryImageReference The Microsoft Azure Marketplace image reference of the virtual machine + * @return the next update stage + */ + Update withGalleryImageReference(GalleryImageReference galleryImageReference); + } + + /** + * The stage of the labvirtualmachine update allowing to specify IsAuthenticationWithSshKey. + */ + interface WithIsAuthenticationWithSshKey { + /** + * Specifies isAuthenticationWithSshKey. + * @param isAuthenticationWithSshKey A value indicating whether this virtual machine uses an SSH key for authentication + * @return the next update stage + */ + Update withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey); + } + + /** + * The stage of the labvirtualmachine update allowing to specify LabSubnetName. + */ + interface WithLabSubnetName { + /** + * Specifies labSubnetName. + * @param labSubnetName The lab subnet name of the virtual machine + * @return the next update stage + */ + Update withLabSubnetName(String labSubnetName); + } + + /** + * The stage of the labvirtualmachine update allowing to specify LabVirtualNetworkId. + */ + interface WithLabVirtualNetworkId { + /** + * Specifies labVirtualNetworkId. + * @param labVirtualNetworkId The lab virtual network identifier of the virtual machine + * @return the next update stage + */ + Update withLabVirtualNetworkId(String labVirtualNetworkId); + } + + /** + * The stage of the labvirtualmachine update allowing to specify Notes. + */ + interface WithNotes { + /** + * Specifies notes. + * @param notes The notes of the virtual machine + * @return the next update stage + */ + Update withNotes(String notes); + } + + /** + * The stage of the labvirtualmachine update allowing to specify OsType. + */ + interface WithOsType { + /** + * Specifies osType. + * @param osType The OS type of the virtual machine + * @return the next update stage + */ + Update withOsType(String osType); + } + + /** + * The stage of the labvirtualmachine update allowing to specify OwnerObjectId. + */ + interface WithOwnerObjectId { + /** + * Specifies ownerObjectId. + * @param ownerObjectId The object identifier of the owner of the virtual machine + * @return the next update stage + */ + Update withOwnerObjectId(String ownerObjectId); + } + + /** + * The stage of the labvirtualmachine update allowing to specify Password. + */ + interface WithPassword { + /** + * Specifies password. + * @param password The password of the virtual machine administrator + * @return the next update stage + */ + Update withPassword(String password); + } + + /** + * The stage of the labvirtualmachine update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the labvirtualmachine update allowing to specify Size. + */ + interface WithSize { + /** + * Specifies size. + * @param size The size of the virtual machine + * @return the next update stage + */ + Update withSize(String size); + } + + /** + * The stage of the labvirtualmachine update allowing to specify SshKey. + */ + interface WithSshKey { + /** + * Specifies sshKey. + * @param sshKey The SSH key of the virtual machine administrator + * @return the next update stage + */ + Update withSshKey(String sshKey); + } + + /** + * The stage of the labvirtualmachine update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the labvirtualmachine update allowing to specify UserName. + */ + interface WithUserName { + /** + * Specifies userName. + * @param userName The user name of the virtual machine + * @return the next update stage + */ + Update withUserName(String userName); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Labs.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Labs.java new file mode 100644 index 0000000000000..75fe082a44807 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Labs.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Completable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.LabVirtualMachineInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.LabsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Labs. + */ +public interface Labs extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable generateUploadUriAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listVhdsAsync(final String resourceGroupName, final String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsInfo.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsInfo.java new file mode 100644 index 0000000000000..7e33de964d095 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsInfo.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a Linux OS. + */ +public class LinuxOsInfo { + /** + * The state of the Linux OS. Possible values include: 'NonDeprovisioned', + * 'DeprovisionRequested', 'DeprovisionApplied'. + */ + @JsonProperty(value = "linuxOsState") + private LinuxOsState linuxOsState; + + /** + * Get the state of the Linux OS. Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied'. + * + * @return the linuxOsState value + */ + public LinuxOsState linuxOsState() { + return this.linuxOsState; + } + + /** + * Set the state of the Linux OS. Possible values include: '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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsState.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsState.java new file mode 100644 index 0000000000000..193365c08800a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/LinuxOsState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ParameterInfo.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ParameterInfo.java new file mode 100644 index 0000000000000..4ef2b0432b271 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/ParameterInfo.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ParameterInfo model. + */ +public class ParameterInfo { + /** + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The value property. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @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 value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the ParameterInfo object itself. + */ + public ParameterInfo withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policy.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policy.java new file mode 100644 index 0000000000000..2c27587b89bb7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policy.java @@ -0,0 +1,339 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.PolicyInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.Map; + +/** + * Type representing Policy. + */ +public interface Policy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the evaluatorType value. + */ + PolicyEvaluatorType evaluatorType(); + + /** + * @return the factData value. + */ + String factData(); + + /** + * @return the factName value. + */ + PolicyFactName factName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the status value. + */ + PolicyStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the threshold value. + */ + String threshold(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the Policy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPolicyset, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Policy definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Policy definition. + */ + interface Blank extends WithPolicyset { + } + + /** + * The stage of the policy definition allowing to specify Policyset. + */ + interface WithPolicyset { + /** + * 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 + */ + WithLocation withExistingPolicyset(String resourceGroupName, String labName, String policySetName); + } + + /** + * The stage of the policy definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the policy definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @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 EvaluatorType. + */ + interface WithEvaluatorType { + /** + * Specifies evaluatorType. + * @param evaluatorType The evaluator type of the policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + * @return the next definition stage + */ + WithCreate withEvaluatorType(PolicyEvaluatorType evaluatorType); + } + + /** + * The stage of the policy definition allowing to specify FactData. + */ + interface WithFactData { + /** + * Specifies factData. + * @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 FactName. + */ + interface WithFactName { + /** + * Specifies factName. + * @param factName The fact name of the policy. Possible values include: 'UserOwnedLabVmCount', 'LabVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet' + * @return the next definition stage + */ + WithCreate withFactName(PolicyFactName factName); + } + + /** + * The stage of the policy definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the policy definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the policy. Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withStatus(PolicyStatus status); + } + + /** + * The stage of the policy definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the policy definition allowing to specify Threshold. + */ + interface WithThreshold { + /** + * Specifies threshold. + * @param threshold The threshold of the policy + * @return the next definition stage + */ + WithCreate withThreshold(String threshold); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDescription, DefinitionStages.WithEvaluatorType, DefinitionStages.WithFactData, DefinitionStages.WithFactName, DefinitionStages.WithProvisioningState, DefinitionStages.WithStatus, DefinitionStages.WithTags, DefinitionStages.WithThreshold { + } + } + /** + * The template for a Policy update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithEvaluatorType, UpdateStages.WithFactData, UpdateStages.WithFactName, UpdateStages.WithProvisioningState, UpdateStages.WithStatus, UpdateStages.WithTags, UpdateStages.WithThreshold { + } + + /** + * Grouping of Policy update stages. + */ + interface UpdateStages { + /** + * The stage of the policy update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The description of the policy + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the policy update allowing to specify EvaluatorType. + */ + interface WithEvaluatorType { + /** + * Specifies evaluatorType. + * @param evaluatorType The evaluator type of the policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy' + * @return the next update stage + */ + Update withEvaluatorType(PolicyEvaluatorType evaluatorType); + } + + /** + * The stage of the policy update allowing to specify FactData. + */ + interface WithFactData { + /** + * Specifies factData. + * @param factData The fact data of the policy + * @return the next update stage + */ + Update withFactData(String factData); + } + + /** + * The stage of the policy update allowing to specify FactName. + */ + interface WithFactName { + /** + * Specifies factName. + * @param factName The fact name of the policy. Possible values include: 'UserOwnedLabVmCount', 'LabVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet' + * @return the next update stage + */ + Update withFactName(PolicyFactName factName); + } + + /** + * The stage of the policy update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the policy update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the policy. Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withStatus(PolicyStatus status); + } + + /** + * The stage of the policy update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the policy update allowing to specify Threshold. + */ + interface WithThreshold { + /** + * Specifies threshold. + * @param threshold The threshold of the policy + * @return the next update stage + */ + Update withThreshold(String threshold); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyEvaluatorType.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyEvaluatorType.java new file mode 100644 index 0000000000000..26bcce4ec481b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyEvaluatorType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyFactName.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyFactName.java new file mode 100644 index 0000000000000..68a65ca8ab0b8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyFactName.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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 LabVmCount for PolicyFactName. */ + public static final PolicyFactName LAB_VM_COUNT = fromString("LabVmCount"); + + /** 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"); + + /** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySetResult.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySetResult.java new file mode 100644 index 0000000000000..1c287027762ea --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySetResult.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of a policy set evaluation. + */ +public class PolicySetResult { + /** + * 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 a value indicating whether this policy set evaluation has discovered violations. + * + * @return the hasError value + */ + public Boolean hasError() { + return this.hasError; + } + + /** + * Set 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 list of policy violations. + * + * @return the policyViolations value + */ + public List policyViolations() { + return this.policyViolations; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySets.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySets.java new file mode 100644 index 0000000000000..875ee8a7b0220 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicySets.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.PolicySetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PolicySets. + */ +public interface PolicySets extends HasInner { + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable evaluatePoliciesAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyStatus.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyStatus.java new file mode 100644 index 0000000000000..4d0558862c1a0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyStatus.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyViolation.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyViolation.java new file mode 100644 index 0000000000000..9cb66489f606f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/PolicyViolation.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Policy violation. + */ +public class PolicyViolation { + /** + * 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 of the policy violation. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set 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 of the policy violation. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policys.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policys.java new file mode 100644 index 0000000000000..8ef6911ebdb1f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Policys.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.PolicysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Policys. + */ +public interface Policys extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String policySetName, String name); + + /** + * List policies. + * + * @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 + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String policySetName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteResourceAsync(String resourceGroupName, String labName, String policySetName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedule.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedule.java new file mode 100644 index 0000000000000..11ec5c0002bb4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedule.java @@ -0,0 +1,338 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.ScheduleInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.Map; + +/** + * Type representing Schedule. + */ +public interface Schedule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the dailyRecurrence value. + */ + DayDetails dailyRecurrence(); + + /** + * @return the hourlyRecurrence value. + */ + HourDetails hourlyRecurrence(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the status value. + */ + EnableStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the taskType value. + */ + TaskType taskType(); + + /** + * @return the timeZoneId value. + */ + String timeZoneId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the weeklyRecurrence value. + */ + WeekDetails weeklyRecurrence(); + + /** + * The entirety of the Schedule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of Schedule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Schedule definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the schedule definition allowing to specify Lab. + */ + interface WithLab { + /** + * Specifies resourceGroupName, labName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @return the next definition stage + */ + WithLocation withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the schedule definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the schedule definition allowing to specify DailyRecurrence. + */ + interface WithDailyRecurrence { + /** + * Specifies dailyRecurrence. + * @param dailyRecurrence The daily recurrence of the schedule + * @return the next definition stage + */ + WithCreate withDailyRecurrence(DayDetails dailyRecurrence); + } + + /** + * The stage of the schedule definition allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence The hourly recurrence of the schedule + * @return the next definition stage + */ + WithCreate withHourlyRecurrence(HourDetails hourlyRecurrence); + } + + /** + * The stage of the schedule definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the schedule definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the schedule. Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withStatus(EnableStatus status); + } + + /** + * The stage of the schedule definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the schedule definition allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule. Possible values include: 'LabVmsShutdownTask', 'LabVmsStartupTask', 'LabBillingTask' + * @return the next definition stage + */ + WithCreate withTaskType(TaskType taskType); + } + + /** + * The stage of the schedule definition allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone id + * @return the next definition stage + */ + WithCreate withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the schedule definition allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence The weekly recurrence of the schedule + * @return the next definition stage + */ + WithCreate withWeeklyRecurrence(WeekDetails weeklyRecurrence); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithDailyRecurrence, DefinitionStages.WithHourlyRecurrence, DefinitionStages.WithProvisioningState, DefinitionStages.WithStatus, DefinitionStages.WithTags, DefinitionStages.WithTaskType, DefinitionStages.WithTimeZoneId, DefinitionStages.WithWeeklyRecurrence { + } + } + /** + * The template for a Schedule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDailyRecurrence, UpdateStages.WithHourlyRecurrence, UpdateStages.WithProvisioningState, UpdateStages.WithStatus, UpdateStages.WithTags, UpdateStages.WithTaskType, UpdateStages.WithTimeZoneId, UpdateStages.WithWeeklyRecurrence { + } + + /** + * Grouping of Schedule update stages. + */ + interface UpdateStages { + /** + * The stage of the schedule update allowing to specify DailyRecurrence. + */ + interface WithDailyRecurrence { + /** + * Specifies dailyRecurrence. + * @param dailyRecurrence The daily recurrence of the schedule + * @return the next update stage + */ + Update withDailyRecurrence(DayDetails dailyRecurrence); + } + + /** + * The stage of the schedule update allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence The hourly recurrence of the schedule + * @return the next update stage + */ + Update withHourlyRecurrence(HourDetails hourlyRecurrence); + } + + /** + * The stage of the schedule update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the schedule update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the schedule. Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withStatus(EnableStatus status); + } + + /** + * The stage of the schedule update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the schedule update allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule. Possible values include: 'LabVmsShutdownTask', 'LabVmsStartupTask', 'LabBillingTask' + * @return the next update stage + */ + Update withTaskType(TaskType taskType); + } + + /** + * The stage of the schedule update allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone id + * @return the next update stage + */ + Update withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the schedule update allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence The weekly recurrence of the schedule + * @return the next update stage + */ + Update withWeeklyRecurrence(WeekDetails weeklyRecurrence); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedules.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedules.java new file mode 100644 index 0000000000000..a0774b8f05c4a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Schedules.java @@ -0,0 +1,64 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.SchedulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Schedules. + */ +public interface Schedules extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Completable executeAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * Delete 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 + * @return the observable for the request + */ + Completable deleteResourceAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SourceControlType.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SourceControlType.java new file mode 100644 index 0000000000000..096b5c4748288 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SourceControlType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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"); + + /** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Subnet.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Subnet.java new file mode 100644 index 0000000000000..7200b6e12a34f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/Subnet.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Subnet model. + */ +public class Subnet { + /** + * The resourceId property. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The labSubnetName property. + */ + @JsonProperty(value = "labSubnetName") + private String labSubnetName; + + /** + * Possible values include: 'Default', 'Deny', 'Allow'. + */ + @JsonProperty(value = "allowPublicIp") + private UsagePermissionType allowPublicIp; + + /** + * Get the resourceId value. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId value. + * + * @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 value. + * + * @return the labSubnetName value + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set the labSubnetName value. + * + * @param labSubnetName the labSubnetName value to set + * @return the Subnet object itself. + */ + public Subnet withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get possible values include: 'Default', 'Deny', 'Allow'. + * + * @return the allowPublicIp value + */ + public UsagePermissionType allowPublicIp() { + return this.allowPublicIp; + } + + /** + * Set possible values include: 'Default', 'Deny', 'Allow'. + * + * @param allowPublicIp the allowPublicIp value to set + * @return the Subnet object itself. + */ + public Subnet withAllowPublicIp(UsagePermissionType allowPublicIp) { + this.allowPublicIp = allowPublicIp; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubnetOverride.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubnetOverride.java new file mode 100644 index 0000000000000..abfaed4d231e0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubnetOverride.java @@ -0,0 +1,124 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Property overrides on a subnet of a virtual network. + */ +public class SubnetOverride { + /** + * The resource identifier 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. Possible values include: 'Default', 'Deny', 'Allow'. + */ + @JsonProperty(value = "useInVmCreationPermission") + private UsagePermissionType useInVmCreationPermission; + + /** + * Indicates whether public IP addresses can be assigned to virtual + * machines on this subnet. Possible values include: 'Default', 'Deny', + * 'Allow'. + */ + @JsonProperty(value = "usePublicIpAddressPermission") + private UsagePermissionType usePublicIpAddressPermission; + + /** + * Get the resource identifier of the subnet. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource identifier 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 name given to the subnet within the lab. + * + * @return the labSubnetName value + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set 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 indicates whether this subnet can be used during virtual machine creation. Possible values include: 'Default', 'Deny', 'Allow'. + * + * @return the useInVmCreationPermission value + */ + public UsagePermissionType useInVmCreationPermission() { + return this.useInVmCreationPermission; + } + + /** + * Set indicates whether this subnet can be used during virtual machine creation. Possible values include: 'Default', 'Deny', 'Allow'. + * + * @param useInVmCreationPermission the useInVmCreationPermission value to set + * @return the SubnetOverride object itself. + */ + public SubnetOverride withUseInVmCreationPermission(UsagePermissionType useInVmCreationPermission) { + this.useInVmCreationPermission = useInVmCreationPermission; + return this; + } + + /** + * Get indicates whether public IP addresses can be assigned to virtual machines on this subnet. Possible values include: 'Default', 'Deny', 'Allow'. + * + * @return the usePublicIpAddressPermission value + */ + public UsagePermissionType usePublicIpAddressPermission() { + return this.usePublicIpAddressPermission; + } + + /** + * Set indicates whether public IP addresses can be assigned to virtual machines on this subnet. Possible values include: 'Default', 'Deny', 'Allow'. + * + * @param usePublicIpAddressPermission the usePublicIpAddressPermission value to set + * @return the SubnetOverride object itself. + */ + public SubnetOverride withUsePublicIpAddressPermission(UsagePermissionType usePublicIpAddressPermission) { + this.usePublicIpAddressPermission = usePublicIpAddressPermission; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotification.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotification.java new file mode 100644 index 0000000000000..72788688b47b9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotification.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SubscriptionNotification model. + */ +public class SubscriptionNotification { + /** + * The registrationDate property. + */ + @JsonProperty(value = "registrationDate") + private String registrationDate; + + /** + * Possible values include: 'NotDefined', 'Registered', 'Unregistered', + * 'Warned', 'Suspended', 'Deleted'. + */ + @JsonProperty(value = "state") + private SubscriptionNotificationState state; + + /** + * The properties property. + */ + @JsonProperty(value = "properties") + private SubscriptionNotificationProperties properties; + + /** + * Get the registrationDate value. + * + * @return the registrationDate value + */ + public String registrationDate() { + return this.registrationDate; + } + + /** + * Set the registrationDate value. + * + * @param registrationDate the registrationDate value to set + * @return the SubscriptionNotification object itself. + */ + public SubscriptionNotification withRegistrationDate(String registrationDate) { + this.registrationDate = registrationDate; + return this; + } + + /** + * Get possible values include: 'NotDefined', 'Registered', 'Unregistered', 'Warned', 'Suspended', 'Deleted'. + * + * @return the state value + */ + public SubscriptionNotificationState state() { + return this.state; + } + + /** + * Set possible values include: 'NotDefined', 'Registered', 'Unregistered', 'Warned', 'Suspended', 'Deleted'. + * + * @param state the state value to set + * @return the SubscriptionNotification object itself. + */ + public SubscriptionNotification withState(SubscriptionNotificationState state) { + this.state = state; + return this; + } + + /** + * Get the properties value. + * + * @return the properties value + */ + public SubscriptionNotificationProperties properties() { + return this.properties; + } + + /** + * Set the properties value. + * + * @param properties the properties value to set + * @return the SubscriptionNotification object itself. + */ + public SubscriptionNotification withProperties(SubscriptionNotificationProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationProperties.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationProperties.java new file mode 100644 index 0000000000000..2802e5ecfb4b7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationProperties.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SubscriptionNotificationProperties model. + */ +public class SubscriptionNotificationProperties { + /** + * The tenantId property. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Get the tenantId value. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId value. + * + * @param tenantId the tenantId value to set + * @return the SubscriptionNotificationProperties object itself. + */ + public SubscriptionNotificationProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationState.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationState.java new file mode 100644 index 0000000000000..3adcba9c585cf --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/SubscriptionNotificationState.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SubscriptionNotificationState. + */ +public final class SubscriptionNotificationState extends ExpandableStringEnum { + /** Static value NotDefined for SubscriptionNotificationState. */ + public static final SubscriptionNotificationState NOT_DEFINED = fromString("NotDefined"); + + /** Static value Registered for SubscriptionNotificationState. */ + public static final SubscriptionNotificationState REGISTERED = fromString("Registered"); + + /** Static value Unregistered for SubscriptionNotificationState. */ + public static final SubscriptionNotificationState UNREGISTERED = fromString("Unregistered"); + + /** Static value Warned for SubscriptionNotificationState. */ + public static final SubscriptionNotificationState WARNED = fromString("Warned"); + + /** Static value Suspended for SubscriptionNotificationState. */ + public static final SubscriptionNotificationState SUSPENDED = fromString("Suspended"); + + /** Static value Deleted for SubscriptionNotificationState. */ + public static final SubscriptionNotificationState DELETED = fromString("Deleted"); + + /** + * Creates or finds a SubscriptionNotificationState from its string representation. + * @param name a name to look for + * @return the corresponding SubscriptionNotificationState + */ + @JsonCreator + public static SubscriptionNotificationState fromString(String name) { + return fromString(name, SubscriptionNotificationState.class); + } + + /** + * @return known SubscriptionNotificationState values + */ + public static Collection values() { + return values(SubscriptionNotificationState.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/TaskType.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/TaskType.java new file mode 100644 index 0000000000000..52a24f1de1b8c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/TaskType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TaskType. + */ +public final class TaskType extends ExpandableStringEnum { + /** Static value LabVmsShutdownTask for TaskType. */ + public static final TaskType LAB_VMS_SHUTDOWN_TASK = fromString("LabVmsShutdownTask"); + + /** Static value LabVmsStartupTask for TaskType. */ + public static final TaskType LAB_VMS_STARTUP_TASK = fromString("LabVmsStartupTask"); + + /** Static value LabBillingTask for TaskType. */ + public static final TaskType LAB_BILLING_TASK = fromString("LabBillingTask"); + + /** + * Creates or finds a TaskType from its string representation. + * @param name a name to look for + * @return the corresponding TaskType + */ + @JsonCreator + public static TaskType fromString(String name) { + return fromString(name, TaskType.class); + } + + /** + * @return known TaskType values + */ + public static Collection values() { + return values(TaskType.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/UsagePermissionType.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/UsagePermissionType.java new file mode 100644 index 0000000000000..485bbae4c579f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/UsagePermissionType.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VMCostProperties.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VMCostProperties.java new file mode 100644 index 0000000000000..1d67ef6f9b593 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VMCostProperties.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The VMCostProperties model. + */ +public class VMCostProperties { + /** + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The resourceGroupName property. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * The cost property. + */ + @JsonProperty(value = "cost") + private Double cost; + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name value. + * + * @param name the name value to set + * @return the VMCostProperties object itself. + */ + public VMCostProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resourceGroupName value. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resourceGroupName value. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the VMCostProperties object itself. + */ + public VMCostProperties withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the cost value. + * + * @return the cost value + */ + public Double cost() { + return this.cost; + } + + /** + * Set the cost value. + * + * @param cost the cost value to set + * @return the VMCostProperties object itself. + */ + public VMCostProperties withCost(Double cost) { + this.cost = cost; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualMachines.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualMachines.java new file mode 100644 index 0000000000000..f1b38744ae8c4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualMachines.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.VirtualMachinesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualMachines. + */ +public interface VirtualMachines extends SupportsCreating, HasInner { + /** + * Apply artifacts to Lab VM. This operation can take a 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 + * @return the observable for the request + */ + Completable applyArtifactsAsync(String resourceGroupName, String labName, String name); + + /** + * Start a Lab VM. This operation can take a 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 + * @return the observable for the request + */ + Completable startAsync(String resourceGroupName, String labName, String name); + + /** + * Stop a Lab VM. This operation can take a 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 + * @return the observable for the request + */ + Completable stopAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteResourceAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetwork.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetwork.java new file mode 100644 index 0000000000000..77bf6f7304303 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetwork.java @@ -0,0 +1,281 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.VirtualNetworkInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.DevTestLabsManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing VirtualNetwork. + */ +public interface VirtualNetwork extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the allowedSubnets value. + */ + List allowedSubnets(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the externalProviderResourceId value. + */ + String externalProviderResourceId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the subnetOverrides value. + */ + List subnetOverrides(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the VirtualNetwork definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of VirtualNetwork definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a VirtualNetwork definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the virtualnetwork definition allowing to specify Lab. + */ + interface WithLab { + /** + * Specifies resourceGroupName, labName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @return the next definition stage + */ + WithLocation withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the virtualnetwork definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the virtualnetwork definition allowing to specify AllowedSubnets. + */ + interface WithAllowedSubnets { + /** + * Specifies allowedSubnets. + * @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 description. + * @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 externalProviderResourceId. + * @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 ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next definition stage + */ + WithCreate withProvisioningState(String provisioningState); + } + + /** + * The stage of the virtualnetwork definition allowing to specify SubnetOverrides. + */ + interface WithSubnetOverrides { + /** + * Specifies subnetOverrides. + * @param subnetOverrides The subnet overrides of the virtual network + * @return the next definition stage + */ + WithCreate withSubnetOverrides(List subnetOverrides); + } + + /** + * The stage of the virtualnetwork definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAllowedSubnets, DefinitionStages.WithDescription, DefinitionStages.WithExternalProviderResourceId, DefinitionStages.WithProvisioningState, DefinitionStages.WithSubnetOverrides, DefinitionStages.WithTags { + } + } + /** + * The template for a VirtualNetwork update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAllowedSubnets, UpdateStages.WithDescription, UpdateStages.WithExternalProviderResourceId, UpdateStages.WithProvisioningState, UpdateStages.WithSubnetOverrides, UpdateStages.WithTags { + } + + /** + * Grouping of VirtualNetwork update stages. + */ + interface UpdateStages { + /** + * The stage of the virtualnetwork update allowing to specify AllowedSubnets. + */ + interface WithAllowedSubnets { + /** + * Specifies allowedSubnets. + * @param allowedSubnets The allowed subnets of the virtual network + * @return the next update stage + */ + Update withAllowedSubnets(List allowedSubnets); + } + + /** + * The stage of the virtualnetwork update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description The description of the virtual network + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the virtualnetwork update allowing to specify ExternalProviderResourceId. + */ + interface WithExternalProviderResourceId { + /** + * Specifies externalProviderResourceId. + * @param externalProviderResourceId The Microsoft.Network resource identifier of the virtual network + * @return the next update stage + */ + Update withExternalProviderResourceId(String externalProviderResourceId); + } + + /** + * The stage of the virtualnetwork update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning status of the resource + * @return the next update stage + */ + Update withProvisioningState(String provisioningState); + } + + /** + * The stage of the virtualnetwork update allowing to specify SubnetOverrides. + */ + interface WithSubnetOverrides { + /** + * Specifies subnetOverrides. + * @param subnetOverrides The subnet overrides of the virtual network + * @return the next update stage + */ + Update withSubnetOverrides(List subnetOverrides); + } + + /** + * The stage of the virtualnetwork update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetworks.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetworks.java new file mode 100644 index 0000000000000..0788b26e5568e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/VirtualNetworks.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation.VirtualNetworksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualNetworks. + */ +public interface VirtualNetworks extends SupportsCreating, HasInner { + /** + * 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 + * @return the observable for the request + */ + Observable getResourceAsync(String resourceGroupName, String labName, String name); + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * 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 + * @return the observable for the request + */ + Completable deleteResourceAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WeekDetails.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WeekDetails.java new file mode 100644 index 0000000000000..b4f29b3aaa59e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WeekDetails.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a weekly schedule. + */ +public class WeekDetails { + /** + * The days of the week. + */ + @JsonProperty(value = "weekdays") + private List weekdays; + + /** + * The time of the day. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the days of the week. + * + * @return the weekdays value + */ + public List weekdays() { + return this.weekdays; + } + + /** + * Set the days of the week. + * + * @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 of the day. + * + * @return the time value + */ + public String time() { + return this.time; + } + + /** + * Set the time of the day. + * + * @param time the time value to set + * @return the WeekDetails object itself. + */ + public WeekDetails withTime(String time) { + this.time = time; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsInfo.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsInfo.java new file mode 100644 index 0000000000000..debff43dc7dd2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsInfo.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a Windows OS. + */ +public class WindowsOsInfo { + /** + * The state of the Windows OS. Possible values include: 'NonSysprepped', + * 'SysprepRequested', 'SysprepApplied'. + */ + @JsonProperty(value = "windowsOsState") + private WindowsOsState windowsOsState; + + /** + * Get the state of the Windows OS. Possible values include: 'NonSysprepped', 'SysprepRequested', 'SysprepApplied'. + * + * @return the windowsOsState value + */ + public WindowsOsState windowsOsState() { + return this.windowsOsState; + } + + /** + * Set the state of the Windows OS. Possible values include: '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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsState.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsState.java new file mode 100644 index 0000000000000..616ad681b3974 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/WindowsOsState.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoImpl.java new file mode 100644 index 0000000000000..d4165f4fbca74 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArmTemplateInfo; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class ArmTemplateInfoImpl extends WrapperImpl implements ArmTemplateInfo { + private final DevTestLabsManager manager; + ArmTemplateInfoImpl(ArmTemplateInfoInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public Object template() { + return this.inner().template(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoInner.java new file mode 100644 index 0000000000000..e581608ec573e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArmTemplateInfoInner.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a generated ARM template. + */ +public class ArmTemplateInfoInner { + /** + * 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's contents. + * + * @return the template value + */ + public Object template() { + return this.template; + } + + /** + * Set 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 of the ARM template. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactImpl.java new file mode 100644 index 0000000000000..4406ccad78ff5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactImpl.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifact; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.Map; + +class ArtifactImpl extends IndexableRefreshableWrapperImpl implements Artifact { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String artifactSourceName; + private String name; + + ArtifactImpl(ArtifactInner inner, DevTestLabsManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.artifactSourceName = IdParsingUtils.getValueFromIdByName(inner.id(), "artifactsources"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "artifacts"); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ArtifactsInner client = this.manager().inner().artifacts(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.artifactSourceName, this.name); + } + + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String filePath() { + return this.inner().filePath(); + } + + @Override + public String icon() { + return this.inner().icon(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object parameters() { + return this.inner().parameters(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String targetOsType() { + return this.inner().targetOsType(); + } + + @Override + public String title() { + return this.inner().title(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactInner.java new file mode 100644 index 0000000000000..49d44ad632386 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactInner.java @@ -0,0 +1,176 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An artifact. + */ +@JsonFlatten +public class ArtifactInner extends Resource { + /** + * The title of the artifact. + */ + @JsonProperty(value = "properties.title") + private String title; + + /** + * The description of the artifact. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The file path of the artifact. + */ + @JsonProperty(value = "properties.filePath") + private String filePath; + + /** + * The icon of the artifact. + */ + @JsonProperty(value = "properties.icon") + private String icon; + + /** + * Gets or sets the type of the target os. + */ + @JsonProperty(value = "properties.targetOsType") + private String targetOsType; + + /** + * The parameters of the artifact. + */ + @JsonProperty(value = "properties.parameters") + private Object parameters; + + /** + * Get the title of the artifact. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Set the title of the artifact. + * + * @param title the title value to set + * @return the ArtifactInner object itself. + */ + public ArtifactInner withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the description of the artifact. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the description of the artifact. + * + * @param description the description value to set + * @return the ArtifactInner object itself. + */ + public ArtifactInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the file path of the artifact. + * + * @return the filePath value + */ + public String filePath() { + return this.filePath; + } + + /** + * Set the file path of the artifact. + * + * @param filePath the filePath value to set + * @return the ArtifactInner object itself. + */ + public ArtifactInner withFilePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Get the icon of the artifact. + * + * @return the icon value + */ + public String icon() { + return this.icon; + } + + /** + * Set the icon of the artifact. + * + * @param icon the icon value to set + * @return the ArtifactInner object itself. + */ + public ArtifactInner withIcon(String icon) { + this.icon = icon; + return this; + } + + /** + * Get gets or sets the type of the target os. + * + * @return the targetOsType value + */ + public String targetOsType() { + return this.targetOsType; + } + + /** + * Set gets or sets the type of the target os. + * + * @param targetOsType the targetOsType value to set + * @return the ArtifactInner object itself. + */ + public ArtifactInner withTargetOsType(String targetOsType) { + this.targetOsType = targetOsType; + return this; + } + + /** + * Get the parameters of the artifact. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Set the parameters of the artifact. + * + * @param parameters the parameters value to set + * @return the ArtifactInner object itself. + */ + public ArtifactInner withParameters(Object parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceImpl.java new file mode 100644 index 0000000000000..41cd2393a9007 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceImpl.java @@ -0,0 +1,207 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.SourceControlType; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EnableStatus; +import java.util.Map; + +class ArtifactSourceImpl extends CreatableUpdatableImpl implements ArtifactSource, ArtifactSource.Definition, ArtifactSource.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + ArtifactSourceImpl(String name, DevTestLabsManager manager) { + super(name, new ArtifactSourceInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + ArtifactSourceImpl(ArtifactSourceInner inner, DevTestLabsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "artifactsources"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ArtifactSourcesInner client = this.manager().inner().artifactSources(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ArtifactSourcesInner client = this.manager().inner().artifactSources(); + return client.patchResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ArtifactSourcesInner client = this.manager().inner().artifactSources(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String branchRef() { + return this.inner().branchRef(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String folderPath() { + return this.inner().folderPath(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String securityToken() { + return this.inner().securityToken(); + } + + @Override + public SourceControlType sourceType() { + return this.inner().sourceType(); + } + + @Override + public EnableStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uri() { + return this.inner().uri(); + } + + @Override + public ArtifactSourceImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public ArtifactSourceImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ArtifactSourceImpl withBranchRef(String branchRef) { + this.inner().withBranchRef(branchRef); + return this; + } + + @Override + public ArtifactSourceImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public ArtifactSourceImpl withFolderPath(String folderPath) { + this.inner().withFolderPath(folderPath); + return this; + } + + @Override + public ArtifactSourceImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public ArtifactSourceImpl withSecurityToken(String securityToken) { + this.inner().withSecurityToken(securityToken); + return this; + } + + @Override + public ArtifactSourceImpl withSourceType(SourceControlType sourceType) { + this.inner().withSourceType(sourceType); + return this; + } + + @Override + public ArtifactSourceImpl withStatus(EnableStatus status) { + this.inner().withStatus(status); + return this; + } + + @Override + public ArtifactSourceImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public ArtifactSourceImpl withUri(String uri) { + this.inner().withUri(uri); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceInner.java new file mode 100644 index 0000000000000..a5a76c1120135 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourceInner.java @@ -0,0 +1,232 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.SourceControlType; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EnableStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Properties of an artifact source. + */ +@JsonFlatten +public class ArtifactSourceInner extends Resource { + /** + * The display name of the artifact source. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The URI of the artifact source. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /** + * The type of the artifact source. Possible values include: 'VsoGit', + * 'GitHub'. + */ + @JsonProperty(value = "properties.sourceType") + private SourceControlType sourceType; + + /** + * The folder path of the artifact source. + */ + @JsonProperty(value = "properties.folderPath") + private String folderPath; + + /** + * The branch reference of the artifact source. + */ + @JsonProperty(value = "properties.branchRef") + private String branchRef; + + /** + * The security token of the artifact source. + */ + @JsonProperty(value = "properties.securityToken") + private String securityToken; + + /** + * The status of the artifact source. Possible values include: 'Enabled', + * 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the display name of the artifact source. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the artifact source. + * + * @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 of the artifact source. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the URI of the artifact source. + * + * @param uri the uri value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the type of the artifact source. Possible values include: 'VsoGit', 'GitHub'. + * + * @return the sourceType value + */ + public SourceControlType sourceType() { + return this.sourceType; + } + + /** + * Set the type of the artifact source. Possible values include: 'VsoGit', 'GitHub'. + * + * @param sourceType the sourceType value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withSourceType(SourceControlType sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get the folder path of the artifact source. + * + * @return the folderPath value + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Set the folder path of the artifact source. + * + * @param folderPath the folderPath value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the branch reference of the artifact source. + * + * @return the branchRef value + */ + public String branchRef() { + return this.branchRef; + } + + /** + * Set the branch reference of the artifact source. + * + * @param branchRef the branchRef value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withBranchRef(String branchRef) { + this.branchRef = branchRef; + return this; + } + + /** + * Get the security token of the artifact source. + * + * @return the securityToken value + */ + public String securityToken() { + return this.securityToken; + } + + /** + * Set the security token of 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 of the artifact source. Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status of the artifact source. Possible values include: '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 provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesImpl.java new file mode 100644 index 0000000000000..b6676d0b1c66b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSource; + +class ArtifactSourcesImpl extends WrapperImpl implements ArtifactSources { + private final DevTestLabsManager manager; + + ArtifactSourcesImpl(DevTestLabsManager manager) { + super(manager.inner().artifactSources()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public ArtifactSourceImpl define(String name) { + return wrapModel(name); + } + + private ArtifactSourceImpl wrapModel(ArtifactSourceInner inner) { + return new ArtifactSourceImpl(inner, manager()); + } + + private ArtifactSourceImpl wrapModel(String name) { + return new ArtifactSourceImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + ArtifactSourcesInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ArtifactSource call(ArtifactSourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + ArtifactSourcesInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(ArtifactSourceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ArtifactSource)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteResourceAsync(String resourceGroupName, String labName, String name) { + ArtifactSourcesInner client = this.inner(); + return client.deleteResourceAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesInner.java new file mode 100644 index 0000000000000..63cef047ef37d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactSourcesInner.java @@ -0,0 +1,848 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ArtifactSources. + */ +public class ArtifactSourcesInner { + /** The Retrofit service to perform REST calls. */ + private ArtifactSourcesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of ArtifactSourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ArtifactSourcesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(ArtifactSourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ArtifactSources to be + * used by Retrofit to perform actually REST calls. + */ + interface ArtifactSourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ArtifactSourceInner artifactSource, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources deleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", method = "DELETE", hasBody = true) + Observable> deleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources patchResource" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}") + Observable> patchResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ArtifactSourceInner artifactSource, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArtifactSourceInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactSourceInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactSourceInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArtifactSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArtifactSourceInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactSourceInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifact sources. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactSourceInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List artifact sources. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArtifactSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArtifactSourceInner object if successful. + */ + public ArtifactSourceInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the ArtifactSourceInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, ArtifactSourceInner>() { + @Override + public ArtifactSourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the ArtifactSourceInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the ArtifactSourceInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArtifactSourceInner object if successful. + */ + public ArtifactSourceInner createOrUpdateResource(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, artifactSource).toBlocking().single().body(); + } + + /** + * 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 the ArtifactSourceInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, artifactSource), serviceCallback); + } + + /** + * 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 the ArtifactSourceInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, artifactSource).map(new Func1, ArtifactSourceInner>() { + @Override + public ArtifactSourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the ArtifactSourceInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (artifactSource == null) { + throw new IllegalArgumentException("Parameter artifactSource is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(artifactSource); + return service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, artifactSource, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteResource(String resourceGroupName, String labName, String name) { + deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteResourceAsync(String resourceGroupName, String labName, String name) { + return deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Modify properties of artifact sources. + * + * @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 the ArtifactSourceInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArtifactSourceInner object if successful. + */ + public ArtifactSourceInner patchResource(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, artifactSource).toBlocking().single().body(); + } + + /** + * Modify properties of artifact sources. + * + * @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 the ArtifactSourceInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture patchResourceAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, artifactSource), serviceCallback); + } + + /** + * Modify properties of artifact sources. + * + * @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 the ArtifactSourceInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable patchResourceAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, artifactSource).map(new Func1, ArtifactSourceInner>() { + @Override + public ArtifactSourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of artifact sources. + * + * @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 the ArtifactSourceInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable> patchResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (artifactSource == null) { + throw new IllegalArgumentException("Parameter artifactSource is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(artifactSource); + return service.patchResource(this.client.subscriptionId(), resourceGroupName, labName, name, artifactSource, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = patchResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse patchResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List artifact sources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArtifactSourceInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List artifact sources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifact sources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactSourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifact sources. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactSourceInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List artifact sources. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArtifactSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsImpl.java new file mode 100644 index 0000000000000..9cdab2177d65b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsImpl.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifacts; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArmTemplateInfo; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GenerateArmTemplateRequest; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifact; + +class ArtifactsImpl extends WrapperImpl implements Artifacts { + private final DevTestLabsManager manager; + + ArtifactsImpl(DevTestLabsManager manager) { + super(manager.inner().artifacts()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + private ArtifactImpl wrapModel(ArtifactInner inner) { + return new ArtifactImpl(inner, manager()); + } + + @Override + public Observable generateArmTemplateAsync(String resourceGroupName, String labName, String artifactSourceName, String name, GenerateArmTemplateRequest generateArmTemplateRequest) { + ArtifactsInner client = this.inner(); + return client.generateArmTemplateAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest) + .map(new Func1() { + @Override + public ArmTemplateInfo call(ArmTemplateInfoInner inner) { + return new ArmTemplateInfoImpl(inner, manager()); + } + }); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName, final String artifactSourceName) { + ArtifactsInner client = this.inner(); + return client.listAsync(resourceGroupName, labName, artifactSourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Artifact call(ArtifactInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String artifactSourceName, String name) { + ArtifactsInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, artifactSourceName, name) + .flatMap(new Func1>() { + @Override + public Observable call(ArtifactInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Artifact)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsInner.java new file mode 100644 index 0000000000000..b159afca346e9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ArtifactsInner.java @@ -0,0 +1,674 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GenerateArmTemplateRequest; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Artifacts. + */ +public class ArtifactsInner { + /** The Retrofit service to perform REST calls. */ + private ArtifactsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of ArtifactsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ArtifactsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(ArtifactsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Artifacts to be + * used by Retrofit to perform actually REST calls. + */ + interface ArtifactsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifacts list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("artifactSourceName") String artifactSourceName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifacts getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("artifactSourceName") String artifactSourceName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifacts generateArmTemplate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}/generateArmTemplate") + Observable> generateArmTemplate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("artifactSourceName") String artifactSourceName, @Path("name") String name, @Body GenerateArmTemplateRequest generateArmTemplateRequest, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifacts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List artifacts. + * + * @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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArtifactInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String artifactSourceName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, artifactSourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List artifacts. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, artifactSourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifacts. + * + * @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 + * @return the observable to the PagedList<ArtifactInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String artifactSourceName) { + return listWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifacts. + * + * @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 + * @return the observable to the PagedList<ArtifactInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String artifactSourceName) { + return listSinglePageAsync(resourceGroupName, labName, artifactSourceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List artifacts. + * + * @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 + * @return the PagedList<ArtifactInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String artifactSourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (artifactSourceName == null) { + throw new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List artifacts. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArtifactInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String artifactSourceName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, artifactSourceName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List artifacts. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, artifactSourceName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifacts. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifacts. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, artifactSourceName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List artifacts. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param artifactSourceName The name of the artifact source. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArtifactInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (artifactSourceName == null) { + throw new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArtifactInner object if successful. + */ + public ArtifactInner getResource(String resourceGroupName, String labName, String artifactSourceName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String artifactSourceName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the ArtifactInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String artifactSourceName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name).map(new Func1, ArtifactInner>() { + @Override + public ArtifactInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the ArtifactInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String artifactSourceName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (artifactSourceName == null) { + throw new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the GenerateArmTemplateRequest value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ArmTemplateInfoInner object if successful. + */ + public ArmTemplateInfoInner generateArmTemplate(String resourceGroupName, String labName, String artifactSourceName, String name, GenerateArmTemplateRequest generateArmTemplateRequest) { + return generateArmTemplateWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest).toBlocking().single().body(); + } + + /** + * 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 the GenerateArmTemplateRequest value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateArmTemplateAsync(String resourceGroupName, String labName, String artifactSourceName, String name, GenerateArmTemplateRequest generateArmTemplateRequest, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateArmTemplateWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest), serviceCallback); + } + + /** + * 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 the GenerateArmTemplateRequest value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmTemplateInfoInner object + */ + public Observable generateArmTemplateAsync(String resourceGroupName, String labName, String artifactSourceName, String name, GenerateArmTemplateRequest generateArmTemplateRequest) { + return generateArmTemplateWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest).map(new Func1, ArmTemplateInfoInner>() { + @Override + public ArmTemplateInfoInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the GenerateArmTemplateRequest value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmTemplateInfoInner object + */ + public Observable> generateArmTemplateWithServiceResponseAsync(String resourceGroupName, String labName, String artifactSourceName, String name, GenerateArmTemplateRequest generateArmTemplateRequest) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (artifactSourceName == null) { + throw new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (generateArmTemplateRequest == null) { + throw new IllegalArgumentException("Parameter generateArmTemplateRequest is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(generateArmTemplateRequest); + return service.generateArmTemplate(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, name, generateArmTemplateRequest, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateArmTemplateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateArmTemplateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List artifacts. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ArtifactInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List artifacts. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifacts. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifacts. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArtifactInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List artifacts. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArtifactInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostImpl.java new file mode 100644 index 0000000000000..b49c9d9dc7b1e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostImpl.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Cost; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostPerDayProperties; +import java.util.Map; + +class CostImpl extends IndexableRefreshableWrapperImpl implements Cost { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + CostImpl(CostInner inner, DevTestLabsManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "costs"); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + CostsInner client = this.manager().inner().costs(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + + + @Override + public List costs() { + return this.inner().costs(); + } + + @Override + public String currencyCode() { + return this.inner().currencyCode(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInner.java new file mode 100644 index 0000000000000..0b8451b9e92fd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInner.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostPerDayProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A cost item. + */ +@JsonFlatten +public class CostInner extends Resource { + /** + * The currency code of the cost. + */ + @JsonProperty(value = "properties.currencyCode") + private String currencyCode; + + /** + * The per-day costs items of the cost. + */ + @JsonProperty(value = "properties.costs") + private List costs; + + /** + * Get the currency code of the cost. + * + * @return the currencyCode value + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currency code of the cost. + * + * @param currencyCode the currencyCode value to set + * @return the CostInner object itself. + */ + public CostInner withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the per-day costs items of the cost. + * + * @return the costs value + */ + public List costs() { + return this.costs; + } + + /** + * Set the per-day costs items of the cost. + * + * @param costs the costs value to set + * @return the CostInner object itself. + */ + public CostInner withCosts(List costs) { + this.costs = costs; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightImpl.java new file mode 100644 index 0000000000000..fbb48bba82550 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightImpl.java @@ -0,0 +1,86 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsight; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VMCostProperties; + +class CostInsightImpl extends IndexableRefreshableWrapperImpl implements CostInsight { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + CostInsightImpl(CostInsightInner inner, DevTestLabsManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "costinsights"); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + CostInsightsInner client = this.manager().inner().costInsights(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + + + @Override + public String currencyCode() { + return this.inner().currencyCode(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public List vmCosts() { + return this.inner().vmCosts(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightInner.java new file mode 100644 index 0000000000000..f3c01151651ee --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VMCostProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The CostInsightInner model. + */ +@JsonFlatten +public class CostInsightInner extends Resource { + /** + * The currencyCode property. + */ + @JsonProperty(value = "properties.currencyCode") + private String currencyCode; + + /** + * The vmCosts property. + */ + @JsonProperty(value = "properties.vmCosts") + private List vmCosts; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the currencyCode value. + * + * @return the currencyCode value + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currencyCode value. + * + * @param currencyCode the currencyCode value to set + * @return the CostInsightInner object itself. + */ + public CostInsightInner withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the vmCosts value. + * + * @return the vmCosts value + */ + public List vmCosts() { + return this.vmCosts; + } + + /** + * Set the vmCosts value. + * + * @param vmCosts the vmCosts value to set + * @return the CostInsightInner object itself. + */ + public CostInsightInner withVmCosts(List vmCosts) { + this.vmCosts = vmCosts; + return this; + } + + /** + * Get the provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the CostInsightInner object itself. + */ + public CostInsightInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsImpl.java new file mode 100644 index 0000000000000..b121a19833a7f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsImpl.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsights; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsight; + +class CostInsightsImpl extends WrapperImpl implements CostInsights { + private final DevTestLabsManager manager; + + CostInsightsImpl(DevTestLabsManager manager) { + super(manager.inner().costInsights()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + private CostInsightImpl wrapModel(CostInsightInner inner) { + return new CostInsightImpl(inner, manager()); + } + + @Override + public Completable refreshDataAsync(String resourceGroupName, String labName, String name) { + CostInsightsInner client = this.inner(); + return client.refreshDataAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + CostInsightsInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public CostInsight call(CostInsightInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + CostInsightsInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(CostInsightInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((CostInsight)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsInner.java new file mode 100644 index 0000000000000..55bdef860f16d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostInsightsInner.java @@ -0,0 +1,712 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CostInsights. + */ +public class CostInsightsInner { + /** The Retrofit service to perform REST calls. */ + private CostInsightsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of CostInsightsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CostInsightsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(CostInsightsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CostInsights to be + * used by Retrofit to perform actually REST calls. + */ + interface CostInsightsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsights list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costinsights") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsights getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costinsights/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsights refreshData" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costinsights/{name}/refreshData") + Observable> refreshData(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsights beginRefreshData" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costinsights/{name}/refreshData") + Observable> beginRefreshData(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsights listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CostInsightInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInsightInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInsightInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CostInsightInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CostInsightInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInsightInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List cost insights. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInsightInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List cost insights. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CostInsightInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get cost insight. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CostInsightInner object if successful. + */ + public CostInsightInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Get cost insight. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Get cost insight. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CostInsightInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, CostInsightInner>() { + @Override + public CostInsightInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get cost insight. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CostInsightInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void refreshData(String resourceGroupName, String labName, String name) { + refreshDataWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture refreshDataAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshDataWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable refreshDataAsync(String resourceGroupName, String labName, String name) { + return refreshDataWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> refreshDataWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.refreshData(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginRefreshData(String resourceGroupName, String labName, String name) { + beginRefreshDataWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginRefreshDataAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRefreshDataWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRefreshDataAsync(String resourceGroupName, String labName, String name) { + return beginRefreshDataWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refresh Lab's Cost Insight Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRefreshDataWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginRefreshData(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRefreshDataDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRefreshDataDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List cost insights. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CostInsightInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List cost insights. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List cost insights. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInsightInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List cost insights. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInsightInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List cost insights. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CostInsightInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsImpl.java new file mode 100644 index 0000000000000..8214741c579d0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsImpl.java @@ -0,0 +1,76 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Costs; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import rx.Completable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Cost; + +class CostsImpl extends WrapperImpl implements Costs { + private final DevTestLabsManager manager; + + CostsImpl(DevTestLabsManager manager) { + super(manager.inner().costs()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + private CostImpl wrapModel(CostInner inner) { + return new CostImpl(inner, manager()); + } + + @Override + public Completable refreshDataAsync(String resourceGroupName, String labName, String name) { + CostsInner client = this.inner(); + return client.refreshDataAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + CostsInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Cost call(CostInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + CostsInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(CostInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Cost)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsInner.java new file mode 100644 index 0000000000000..67074389e030c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CostsInner.java @@ -0,0 +1,712 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Costs. + */ +public class CostsInner { + /** The Retrofit service to perform REST calls. */ + private CostsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of CostsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CostsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(CostsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Costs to be + * used by Retrofit to perform actually REST calls. + */ + interface CostsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Costs list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Costs getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Costs refreshData" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}/refreshData") + Observable> refreshData(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Costs beginRefreshData" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}/refreshData") + Observable> beginRefreshData(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Costs listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CostInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CostInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CostInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List costs. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List costs. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CostInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CostInner object if successful. + */ + public CostInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the CostInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, CostInner>() { + @Override + public CostInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the CostInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void refreshData(String resourceGroupName, String labName, String name) { + refreshDataWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture refreshDataAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(refreshDataWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @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 + * @return the observable for the request + */ + public Observable refreshDataAsync(String resourceGroupName, String labName, String name) { + return refreshDataWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @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 + * @return the observable for the request + */ + public Observable> refreshDataWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.refreshData(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginRefreshData(String resourceGroupName, String labName, String name) { + beginRefreshDataWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginRefreshDataAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRefreshDataWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRefreshDataAsync(String resourceGroupName, String labName, String name) { + return beginRefreshDataWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Refresh Lab's Cost Data. This operation can take a while to complete. + * + * @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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRefreshDataWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginRefreshData(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRefreshDataDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRefreshDataDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List costs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CostInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List costs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List costs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List costs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CostInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List costs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CostInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageImpl.java new file mode 100644 index 0000000000000..fada6afbe96aa --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageImpl.java @@ -0,0 +1,198 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImage; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImagePropertiesFromVm; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImagePropertiesCustom; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImageOsType; +import org.joda.time.DateTime; +import java.util.Map; + +class CustomImageImpl extends CreatableUpdatableImpl implements CustomImage, CustomImage.Definition, CustomImage.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + CustomImageImpl(String name, DevTestLabsManager manager) { + super(name, new CustomImageInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + CustomImageImpl(CustomImageInner inner, DevTestLabsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "customimages"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + CustomImagesInner client = this.manager().inner().customImages(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CustomImagesInner client = this.manager().inner().customImages(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CustomImagesInner client = this.manager().inner().customImages(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String author() { + return this.inner().author(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public CustomImageOsType osType() { + return this.inner().osType(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public CustomImagePropertiesCustom vhd() { + return this.inner().vhd(); + } + + @Override + public CustomImagePropertiesFromVm vm() { + return this.inner().vm(); + } + + @Override + public CustomImageImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public CustomImageImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public CustomImageImpl withAuthor(String author) { + this.inner().withAuthor(author); + return this; + } + + @Override + public CustomImageImpl withCreationDate(DateTime creationDate) { + this.inner().withCreationDate(creationDate); + return this; + } + + @Override + public CustomImageImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public CustomImageImpl withOsType(CustomImageOsType osType) { + this.inner().withOsType(osType); + return this; + } + + @Override + public CustomImageImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public CustomImageImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public CustomImageImpl withVhd(CustomImagePropertiesCustom vhd) { + this.inner().withVhd(vhd); + return this; + } + + @Override + public CustomImageImpl withVm(CustomImagePropertiesFromVm vm) { + this.inner().withVm(vm); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageInner.java new file mode 100644 index 0000000000000..f3abd2c0f9695 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImageInner.java @@ -0,0 +1,207 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImagePropertiesFromVm; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImagePropertiesCustom; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImageOsType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A custom image. + */ +@JsonFlatten +public class CustomImageInner extends Resource { + /** + * The vm property. + */ + @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 OS type of the custom image. Possible values include: 'Windows', + * 'Linux', 'None'. + */ + @JsonProperty(value = "properties.osType") + private CustomImageOsType osType; + + /** + * The author of the custom image. + */ + @JsonProperty(value = "properties.author") + private String author; + + /** + * The creation date of the custom image. + */ + @JsonProperty(value = "properties.creationDate") + private DateTime creationDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the vm value. + * + * @return the vm value + */ + public CustomImagePropertiesFromVm vm() { + return this.vm; + } + + /** + * Set the vm value. + * + * @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 from which the image is to be created. + * + * @return the vhd value + */ + public CustomImagePropertiesCustom vhd() { + return this.vhd; + } + + /** + * Set 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 of the custom image. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set 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 OS type of the custom image. Possible values include: 'Windows', 'Linux', 'None'. + * + * @return the osType value + */ + public CustomImageOsType osType() { + return this.osType; + } + + /** + * Set the OS type of the custom image. Possible values include: 'Windows', 'Linux', 'None'. + * + * @param osType the osType value to set + * @return the CustomImageInner object itself. + */ + public CustomImageInner withOsType(CustomImageOsType osType) { + this.osType = osType; + return this; + } + + /** + * Get the author of the custom image. + * + * @return the author value + */ + public String author() { + return this.author; + } + + /** + * Set 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 creation date of the custom image. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Set the creation date of the custom image. + * + * @param creationDate the creationDate value to set + * @return the CustomImageInner object itself. + */ + public CustomImageInner withCreationDate(DateTime creationDate) { + this.creationDate = creationDate; + return this; + } + + /** + * Get the provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the CustomImageInner object itself. + */ + public CustomImageInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesImpl.java new file mode 100644 index 0000000000000..fd574b8a830e4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImage; + +class CustomImagesImpl extends WrapperImpl implements CustomImages { + private final DevTestLabsManager manager; + + CustomImagesImpl(DevTestLabsManager manager) { + super(manager.inner().customImages()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public CustomImageImpl define(String name) { + return wrapModel(name); + } + + private CustomImageImpl wrapModel(CustomImageInner inner) { + return new CustomImageImpl(inner, manager()); + } + + private CustomImageImpl wrapModel(String name) { + return new CustomImageImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + CustomImagesInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public CustomImage call(CustomImageInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + CustomImagesInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(CustomImageInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((CustomImage)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteResourceAsync(String resourceGroupName, String labName, String name) { + CustomImagesInner client = this.inner(); + return client.deleteResourceAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesInner.java new file mode 100644 index 0000000000000..3bf51d317aa7f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/CustomImagesInner.java @@ -0,0 +1,909 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CustomImages. + */ +public class CustomImagesInner { + /** The Retrofit service to perform REST calls. */ + private CustomImagesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of CustomImagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CustomImagesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(CustomImagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for CustomImages to be + * used by Retrofit to perform actually REST calls. + */ + interface CustomImagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body CustomImageInner customImage, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages beginCreateOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}") + Observable> beginCreateOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body CustomImageInner customImage, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages deleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", method = "DELETE", hasBody = true) + Observable> deleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages beginDeleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", method = "DELETE", hasBody = true) + Observable> beginDeleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomImageInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomImageInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomImageInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomImageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomImageInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomImageInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List custom images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomImageInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List custom images. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomImageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomImageInner object if successful. + */ + public CustomImageInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the CustomImageInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, CustomImageInner>() { + @Override + public CustomImageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the CustomImageInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the CustomImageInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomImageInner object if successful. + */ + public CustomImageInner createOrUpdateResource(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, customImage).toBlocking().last().body(); + } + + /** + * 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 the CustomImageInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, customImage), serviceCallback); + } + + /** + * 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 the CustomImageInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, customImage).map(new Func1, CustomImageInner>() { + @Override + public CustomImageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the CustomImageInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (customImage == null) { + throw new IllegalArgumentException("Parameter customImage is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(customImage); + Observable> observable = service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, customImage, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 the CustomImageInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomImageInner object if successful. + */ + public CustomImageInner beginCreateOrUpdateResource(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, customImage).toBlocking().single().body(); + } + + /** + * 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 the CustomImageInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, customImage), serviceCallback); + } + + /** + * 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 the CustomImageInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomImageInner object + */ + public Observable beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, customImage).map(new Func1, CustomImageInner>() { + @Override + public CustomImageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the CustomImageInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomImageInner object + */ + public Observable> beginCreateOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (customImage == null) { + throw new IllegalArgumentException("Parameter customImage is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(customImage); + return service.beginCreateOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, customImage, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteResource(String resourceGroupName, String labName, String name) { + deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable deleteResourceAsync(String resourceGroupName, String labName, String name) { + return deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable> deleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.deleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteResource(String resourceGroupName, String labName, String name) { + beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteResourceAsync(String resourceGroupName, String labName, String name) { + return beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDeleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List custom images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomImageInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List custom images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List custom images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomImageInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List custom images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomImageInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List custom images. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomImageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsClientImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsClientImpl.java new file mode 100644 index 0000000000000..b00a9ea4f6f73 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsClientImpl.java @@ -0,0 +1,364 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the DevTestLabsClientImpl class. + */ +public class DevTestLabsClientImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Client API version. */ + private String apiVersion; + + /** + * Gets Client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The subscription ID. */ + private String subscriptionId; + + /** + * Gets The subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public DevTestLabsClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public DevTestLabsClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public DevTestLabsClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public DevTestLabsClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The LabsInner object to access its operations. + */ + private LabsInner labs; + + /** + * Gets the LabsInner object to access its operations. + * @return the LabsInner object. + */ + public LabsInner labs() { + return this.labs; + } + + /** + * The ArtifactSourcesInner object to access its operations. + */ + private ArtifactSourcesInner artifactSources; + + /** + * Gets the ArtifactSourcesInner object to access its operations. + * @return the ArtifactSourcesInner object. + */ + public ArtifactSourcesInner artifactSources() { + return this.artifactSources; + } + + /** + * The ArtifactsInner object to access its operations. + */ + private ArtifactsInner artifacts; + + /** + * Gets the ArtifactsInner object to access its operations. + * @return the ArtifactsInner object. + */ + public ArtifactsInner artifacts() { + return this.artifacts; + } + + /** + * The CostInsightsInner object to access its operations. + */ + private CostInsightsInner costInsights; + + /** + * Gets the CostInsightsInner object to access its operations. + * @return the CostInsightsInner object. + */ + public CostInsightsInner costInsights() { + return this.costInsights; + } + + /** + * The CostsInner object to access its operations. + */ + private CostsInner costs; + + /** + * Gets the CostsInner object to access its operations. + * @return the CostsInner object. + */ + public CostsInner costs() { + return this.costs; + } + + /** + * The CustomImagesInner object to access its operations. + */ + private CustomImagesInner customImages; + + /** + * Gets the CustomImagesInner object to access its operations. + * @return the CustomImagesInner object. + */ + public CustomImagesInner customImages() { + return this.customImages; + } + + /** + * The FormulasInner object to access its operations. + */ + private FormulasInner formulas; + + /** + * Gets the FormulasInner object to access its operations. + * @return the FormulasInner object. + */ + public FormulasInner formulas() { + return this.formulas; + } + + /** + * The GalleryImagesInner object to access its operations. + */ + private GalleryImagesInner galleryImages; + + /** + * Gets the GalleryImagesInner object to access its operations. + * @return the GalleryImagesInner object. + */ + public GalleryImagesInner galleryImages() { + return this.galleryImages; + } + + /** + * The PolicySetsInner object to access its operations. + */ + private PolicySetsInner policySets; + + /** + * Gets the PolicySetsInner object to access its operations. + * @return the PolicySetsInner object. + */ + public PolicySetsInner policySets() { + return this.policySets; + } + + /** + * The PolicysInner object to access its operations. + */ + private PolicysInner policys; + + /** + * Gets the PolicysInner object to access its operations. + * @return the PolicysInner object. + */ + public PolicysInner policys() { + return this.policys; + } + + /** + * The SchedulesInner object to access its operations. + */ + private SchedulesInner schedules; + + /** + * Gets the SchedulesInner object to access its operations. + * @return the SchedulesInner object. + */ + public SchedulesInner schedules() { + return this.schedules; + } + + /** + * The VirtualMachinesInner object to access its operations. + */ + private VirtualMachinesInner virtualMachines; + + /** + * Gets the VirtualMachinesInner object to access its operations. + * @return the VirtualMachinesInner object. + */ + public VirtualMachinesInner virtualMachines() { + return this.virtualMachines; + } + + /** + * The VirtualNetworksInner object to access its operations. + */ + private VirtualNetworksInner virtualNetworks; + + /** + * Gets the VirtualNetworksInner object to access its operations. + * @return the VirtualNetworksInner object. + */ + public VirtualNetworksInner virtualNetworks() { + return this.virtualNetworks; + } + + /** + * Initializes an instance of DevTestLabsClient client. + * + * @param credentials the management credentials for Azure + */ + public DevTestLabsClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of DevTestLabsClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public DevTestLabsClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of DevTestLabsClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public DevTestLabsClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-05-21-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.labs = new LabsInner(restClient().retrofit(), this); + this.artifactSources = new ArtifactSourcesInner(restClient().retrofit(), this); + this.artifacts = new ArtifactsInner(restClient().retrofit(), this); + this.costInsights = new CostInsightsInner(restClient().retrofit(), this); + this.costs = new CostsInner(restClient().retrofit(), this); + this.customImages = new CustomImagesInner(restClient().retrofit(), this); + this.formulas = new FormulasInner(restClient().retrofit(), this); + this.galleryImages = new GalleryImagesInner(restClient().retrofit(), this); + this.policySets = new PolicySetsInner(restClient().retrofit(), this); + this.policys = new PolicysInner(restClient().retrofit(), this); + this.schedules = new SchedulesInner(restClient().retrofit(), this); + this.virtualMachines = new VirtualMachinesInner(restClient().retrofit(), this); + this.virtualNetworks = new VirtualNetworksInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "DevTestLabsClient", "2015-05-21-preview"); + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsManager.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsManager.java new file mode 100644 index 0000000000000..816f7f788cd58 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/DevTestLabsManager.java @@ -0,0 +1,243 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactSources; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Artifacts; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CostInsights; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Costs; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.CustomImages; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImages; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicySets; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure DevTestLabs resource management. + */ +public final class DevTestLabsManager extends ManagerCore { + private Labs labs; + private ArtifactSources artifactSources; + private Artifacts artifacts; + private CostInsights costInsights; + private Costs costs; + private CustomImages customImages; + private Formulas formulas; + private GalleryImages galleryImages; + private PolicySets policySets; + private Policys policys; + private Schedules schedules; + private VirtualMachines virtualMachines; + private VirtualNetworks virtualNetworks; + /** + * Get a Configurable instance that can be used to create DevTestLabsManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new DevTestLabsManager.ConfigurableImpl(); + } + /** + * Creates an instance of DevTestLabsManager that exposes DevTestLabs resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the DevTestLabsManager + */ + public static DevTestLabsManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new DevTestLabsManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of DevTestLabsManager that exposes DevTestLabs resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the DevTestLabsManager + */ + public static DevTestLabsManager authenticate(RestClient restClient, String subscriptionId) { + return new DevTestLabsManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of DevTestLabsManager that exposes DevTestLabs management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing DevTestLabs management API entry points that work across subscriptions + */ + DevTestLabsManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Labs. + */ + public Labs labs() { + if (this.labs == null) { + this.labs = new LabsImpl(this); + } + return this.labs; + } + + /** + * @return Entry point to manage ArtifactSources. + */ + public ArtifactSources artifactSources() { + if (this.artifactSources == null) { + this.artifactSources = new ArtifactSourcesImpl(this); + } + return this.artifactSources; + } + + /** + * @return Entry point to manage Artifacts. + */ + public Artifacts artifacts() { + if (this.artifacts == null) { + this.artifacts = new ArtifactsImpl(this); + } + return this.artifacts; + } + + /** + * @return Entry point to manage CostInsights. + */ + public CostInsights costInsights() { + if (this.costInsights == null) { + this.costInsights = new CostInsightsImpl(this); + } + return this.costInsights; + } + + /** + * @return Entry point to manage Costs. + */ + public Costs costs() { + if (this.costs == null) { + this.costs = new CostsImpl(this); + } + return this.costs; + } + + /** + * @return Entry point to manage CustomImages. + */ + public CustomImages customImages() { + if (this.customImages == null) { + this.customImages = new CustomImagesImpl(this); + } + return this.customImages; + } + + /** + * @return Entry point to manage Formulas. + */ + public Formulas formulas() { + if (this.formulas == null) { + this.formulas = new FormulasImpl(this); + } + return this.formulas; + } + + /** + * @return Entry point to manage GalleryImages. + */ + public GalleryImages galleryImages() { + if (this.galleryImages == null) { + this.galleryImages = new GalleryImagesImpl(this); + } + return this.galleryImages; + } + + /** + * @return Entry point to manage PolicySets. + */ + public PolicySets policySets() { + if (this.policySets == null) { + this.policySets = new PolicySetsImpl(this); + } + return this.policySets; + } + + /** + * @return Entry point to manage Policys. + */ + public Policys policys() { + if (this.policys == null) { + this.policys = new PolicysImpl(this); + } + return this.policys; + } + + /** + * @return Entry point to manage Schedules. + */ + public Schedules schedules() { + if (this.schedules == null) { + this.schedules = new SchedulesImpl(this); + } + return this.schedules; + } + + /** + * @return Entry point to manage VirtualMachines. + */ + public VirtualMachines virtualMachines() { + if (this.virtualMachines == null) { + this.virtualMachines = new VirtualMachinesImpl(this); + } + return this.virtualMachines; + } + + /** + * @return Entry point to manage VirtualNetworks. + */ + public VirtualNetworks virtualNetworks() { + if (this.virtualNetworks == null) { + this.virtualNetworks = new VirtualNetworksImpl(this); + } + return this.virtualNetworks; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public DevTestLabsManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return DevTestLabsManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private DevTestLabsManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new DevTestLabsClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseImpl.java new file mode 100644 index 0000000000000..fda4a5f9b3374 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseImpl.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EvaluatePoliciesResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicySetResult; + +class EvaluatePoliciesResponseImpl extends WrapperImpl implements EvaluatePoliciesResponse { + private final DevTestLabsManager manager; + EvaluatePoliciesResponseImpl(EvaluatePoliciesResponseInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public List results() { + return this.inner().results(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseInner.java new file mode 100644 index 0000000000000..425481c8f2897 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/EvaluatePoliciesResponseInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicySetResult; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response body for evaluating a policy set. + */ +public class EvaluatePoliciesResponseInner { + /** + * Results of evaluating a policy set. + */ + @JsonProperty(value = "results") + private List results; + + /** + * Get results of evaluating a policy set. + * + * @return the results value + */ + public List results() { + return this.results; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaImpl.java new file mode 100644 index 0000000000000..a55ea4c58d19c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaImpl.java @@ -0,0 +1,202 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formula; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.FormulaPropertiesFromVm; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.LabVirtualMachine; +import java.util.Map; + +class FormulaImpl extends CreatableUpdatableImpl implements Formula, Formula.Definition, Formula.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + FormulaImpl(String name, DevTestLabsManager manager) { + super(name, new FormulaInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + FormulaImpl(FormulaInner inner, DevTestLabsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "formulas"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + FormulasInner client = this.manager().inner().formulas(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FormulasInner client = this.manager().inner().formulas(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FormulasInner client = this.manager().inner().formulas(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String author() { + return this.inner().author(); + } + + @Override + public DateTime creationDate() { + return this.inner().creationDate(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public LabVirtualMachine formulaContent() { + LabVirtualMachineInner inner = this.inner().formulaContent(); + if (inner != null) { + return new LabVirtualMachineImpl(inner, manager()); + } else { + return null; + } + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String osType() { + return this.inner().osType(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public FormulaPropertiesFromVm vm() { + return this.inner().vm(); + } + + @Override + public FormulaImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public FormulaImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public FormulaImpl withAuthor(String author) { + this.inner().withAuthor(author); + return this; + } + + @Override + public FormulaImpl withCreationDate(DateTime creationDate) { + this.inner().withCreationDate(creationDate); + return this; + } + + @Override + public FormulaImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public FormulaImpl withFormulaContent(LabVirtualMachineInner formulaContent) { + this.inner().withFormulaContent(formulaContent); + return this; + } + + @Override + public FormulaImpl withOsType(String osType) { + this.inner().withOsType(osType); + return this; + } + + @Override + public FormulaImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public FormulaImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public FormulaImpl withVm(FormulaPropertiesFromVm vm) { + this.inner().withVm(vm); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaInner.java new file mode 100644 index 0000000000000..da3361af3cded --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulaInner.java @@ -0,0 +1,204 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.FormulaPropertiesFromVm; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A formula. + */ +@JsonFlatten +public class FormulaInner extends Resource { + /** + * The description of the formula. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The author of the formula. + */ + @JsonProperty(value = "properties.author") + 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") + private DateTime creationDate; + + /** + * The content of the formula. + */ + @JsonProperty(value = "properties.formulaContent") + private LabVirtualMachineInner 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") + private String provisioningState; + + /** + * Get the description of the formula. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set 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 of the formula. + * + * @return the author value + */ + public String author() { + return this.author; + } + + /** + * Set the author of the formula. + * + * @param author the author value to set + * @return the FormulaInner object itself. + */ + public FormulaInner withAuthor(String author) { + this.author = author; + return this; + } + + /** + * Get the OS type of the formula. + * + * @return the osType value + */ + public String osType() { + return this.osType; + } + + /** + * Set 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 creation date of the formula. + * + * @return the creationDate value + */ + public DateTime creationDate() { + return this.creationDate; + } + + /** + * Set the creation date of the formula. + * + * @param creationDate the creationDate value to set + * @return the FormulaInner object itself. + */ + public FormulaInner withCreationDate(DateTime creationDate) { + this.creationDate = creationDate; + return this; + } + + /** + * Get the content of the formula. + * + * @return the formulaContent value + */ + public LabVirtualMachineInner formulaContent() { + return this.formulaContent; + } + + /** + * Set the content of the formula. + * + * @param formulaContent the formulaContent value to set + * @return the FormulaInner object itself. + */ + public FormulaInner withFormulaContent(LabVirtualMachineInner formulaContent) { + this.formulaContent = formulaContent; + return this; + } + + /** + * Get information about a VM from which a formula is to be created. + * + * @return the vm value + */ + public FormulaPropertiesFromVm vm() { + return this.vm; + } + + /** + * Set 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 provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the FormulaInner object itself. + */ + public FormulaInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasImpl.java new file mode 100644 index 0000000000000..1214be3502a09 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formula; + +class FormulasImpl extends WrapperImpl implements Formulas { + private final DevTestLabsManager manager; + + FormulasImpl(DevTestLabsManager manager) { + super(manager.inner().formulas()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public FormulaImpl define(String name) { + return wrapModel(name); + } + + private FormulaImpl wrapModel(FormulaInner inner) { + return new FormulaImpl(inner, manager()); + } + + private FormulaImpl wrapModel(String name) { + return new FormulaImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + FormulasInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Formula call(FormulaInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + FormulasInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(FormulaInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Formula)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteResourceAsync(String resourceGroupName, String labName, String name) { + FormulasInner client = this.inner(); + return client.deleteResourceAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasInner.java new file mode 100644 index 0000000000000..1bcf7e27c0088 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/FormulasInner.java @@ -0,0 +1,830 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Formulas. + */ +public class FormulasInner { + /** The Retrofit service to perform REST calls. */ + private FormulasService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of FormulasInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public FormulasInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(FormulasService.class); + this.client = client; + } + + /** + * The interface defining all the services for Formulas to be + * used by Retrofit to perform actually REST calls. + */ + interface FormulasService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body FormulaInner formula, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas beginCreateOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}") + Observable> beginCreateOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body FormulaInner formula, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas deleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", method = "DELETE", hasBody = true) + Observable> deleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Formulas listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FormulaInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FormulaInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FormulaInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FormulaInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FormulaInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FormulaInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List formulas. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FormulaInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List formulas. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FormulaInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FormulaInner object if successful. + */ + public FormulaInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the FormulaInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, FormulaInner>() { + @Override + public FormulaInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the FormulaInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the FormulaInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FormulaInner object if successful. + */ + public FormulaInner createOrUpdateResource(String resourceGroupName, String labName, String name, FormulaInner formula) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, formula).toBlocking().last().body(); + } + + /** + * 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 the FormulaInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, FormulaInner formula, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, formula), serviceCallback); + } + + /** + * 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 the FormulaInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, FormulaInner formula) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, formula).map(new Func1, FormulaInner>() { + @Override + public FormulaInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the FormulaInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, FormulaInner formula) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (formula == null) { + throw new IllegalArgumentException("Parameter formula is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(formula); + Observable> observable = service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, formula, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 the FormulaInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the FormulaInner object if successful. + */ + public FormulaInner beginCreateOrUpdateResource(String resourceGroupName, String labName, String name, FormulaInner formula) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, formula).toBlocking().single().body(); + } + + /** + * 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 the FormulaInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, FormulaInner formula, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, formula), serviceCallback); + } + + /** + * 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 the FormulaInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FormulaInner object + */ + public Observable beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, FormulaInner formula) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, formula).map(new Func1, FormulaInner>() { + @Override + public FormulaInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the FormulaInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FormulaInner object + */ + public Observable> beginCreateOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, FormulaInner formula) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (formula == null) { + throw new IllegalArgumentException("Parameter formula is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(formula); + return service.beginCreateOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, formula, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteResource(String resourceGroupName, String labName, String name) { + deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteResourceAsync(String resourceGroupName, String labName, String name) { + return deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List formulas. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<FormulaInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List formulas. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List formulas. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FormulaInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List formulas. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<FormulaInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List formulas. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<FormulaInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageImpl.java new file mode 100644 index 0000000000000..89640bd561b8e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageImpl.java @@ -0,0 +1,88 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImageReference; +import java.util.Map; + +class GalleryImageImpl extends WrapperImpl implements GalleryImage { + private final DevTestLabsManager manager; + + GalleryImageImpl(GalleryImageInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + + + @Override + public String author() { + return this.inner().author(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String icon() { + return this.inner().icon(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public GalleryImageReference imageReference() { + return this.inner().imageReference(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageInner.java new file mode 100644 index 0000000000000..d76564b528691 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImageInner.java @@ -0,0 +1,178 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImageReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A gallery image. + */ +@JsonFlatten +public class GalleryImageInner extends Resource { + /** + * The author of the gallery image. + */ + @JsonProperty(value = "properties.author") + private String author; + + /** + * The creation date of the gallery image. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime 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; + + /** + * Get the author of the gallery image. + * + * @return the author value + */ + public String author() { + return this.author; + } + + /** + * Set 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 creation date of the gallery image. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set the creation date of the gallery image. + * + * @param createdDate the createdDate value to set + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the description of the gallery image. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set 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 image reference of the gallery image. + * + * @return the imageReference value + */ + public GalleryImageReference imageReference() { + return this.imageReference; + } + + /** + * Set 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 of the gallery image. + * + * @return the icon value + */ + public String icon() { + return this.icon; + } + + /** + * Set 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 indicates whether this gallery image is enabled. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesImpl.java new file mode 100644 index 0000000000000..a12f8118fbea4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesImpl.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImages; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImage; + +class GalleryImagesImpl extends WrapperImpl implements GalleryImages { + private final DevTestLabsManager manager; + + GalleryImagesImpl(DevTestLabsManager manager) { + super(manager.inner().galleryImages()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + private GalleryImageImpl wrapModel(GalleryImageInner inner) { + return new GalleryImageImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + GalleryImagesInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public GalleryImage call(GalleryImageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesInner.java new file mode 100644 index 0000000000000..fa205bdb83ec0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GalleryImagesInner.java @@ -0,0 +1,437 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in GalleryImages. + */ +public class GalleryImagesInner { + /** The Retrofit service to perform REST calls. */ + private GalleryImagesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of GalleryImagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GalleryImagesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(GalleryImagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for GalleryImages to be + * used by Retrofit to perform actually REST calls. + */ + interface GalleryImagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImages list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/galleryimages") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImages listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GalleryImageInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GalleryImageInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GalleryImageInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GalleryImageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GalleryImageInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GalleryImageInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List gallery images. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GalleryImageInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List gallery images. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GalleryImageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List gallery images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<GalleryImageInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List gallery images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List gallery images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GalleryImageInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List gallery images. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<GalleryImageInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List gallery images. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<GalleryImageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseImpl.java new file mode 100644 index 0000000000000..bd7329d93f954 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GenerateUploadUriResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class GenerateUploadUriResponseImpl extends WrapperImpl implements GenerateUploadUriResponse { + private final DevTestLabsManager manager; + GenerateUploadUriResponseImpl(GenerateUploadUriResponseInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public String uploadUri() { + return this.inner().uploadUri(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseInner.java new file mode 100644 index 0000000000000..38252cd716d0d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/GenerateUploadUriResponseInner.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response body for generating an upload URI. + */ +public class GenerateUploadUriResponseInner { + /** + * The upload URI for the VHD. + */ + @JsonProperty(value = "uploadUri") + private String uploadUri; + + /** + * Get the upload URI for the VHD. + * + * @return the uploadUri value + */ + public String uploadUri() { + return this.uploadUri; + } + + /** + * Set 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; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/IdParsingUtils.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..12239a0e2594f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabImpl.java new file mode 100644 index 0000000000000..e507e4b6de279 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabImpl.java @@ -0,0 +1,137 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Lab; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.LabStorageType; +import org.joda.time.DateTime; + +class LabImpl extends GroupableResourceCoreImpl implements Lab, Lab.Definition, Lab.Update { + LabImpl(String name, LabInner inner, DevTestLabsManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + LabsInner client = this.manager().inner().labs(); + return client.createOrUpdateResourceAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LabsInner client = this.manager().inner().labs(); + return client.patchResourceAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + LabsInner client = this.manager().inner().labs(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String artifactsStorageAccount() { + return this.inner().artifactsStorageAccount(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String defaultStorageAccount() { + return this.inner().defaultStorageAccount(); + } + + @Override + public String defaultVirtualNetworkId() { + return this.inner().defaultVirtualNetworkId(); + } + + @Override + public LabStorageType labStorageType() { + return this.inner().labStorageType(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List storageAccounts() { + return this.inner().storageAccounts(); + } + + @Override + public String vaultName() { + return this.inner().vaultName(); + } + + @Override + public LabImpl withArtifactsStorageAccount(String artifactsStorageAccount) { + this.inner().withArtifactsStorageAccount(artifactsStorageAccount); + return this; + } + + @Override + public LabImpl withCreatedDate(DateTime createdDate) { + this.inner().withCreatedDate(createdDate); + return this; + } + + @Override + public LabImpl withDefaultStorageAccount(String defaultStorageAccount) { + this.inner().withDefaultStorageAccount(defaultStorageAccount); + return this; + } + + @Override + public LabImpl withDefaultVirtualNetworkId(String defaultVirtualNetworkId) { + this.inner().withDefaultVirtualNetworkId(defaultVirtualNetworkId); + return this; + } + + @Override + public LabImpl withLabStorageType(LabStorageType labStorageType) { + this.inner().withLabStorageType(labStorageType); + return this; + } + + @Override + public LabImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public LabImpl withStorageAccounts(List storageAccounts) { + this.inner().withStorageAccounts(storageAccounts); + return this; + } + + @Override + public LabImpl withVaultName(String vaultName) { + this.inner().withVaultName(vaultName); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabInner.java new file mode 100644 index 0000000000000..04907c0d3a105 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabInner.java @@ -0,0 +1,232 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.LabStorageType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A lab. + */ +@JsonFlatten +public class LabInner extends Resource { + /** + * The lab's default storage account. + */ + @JsonProperty(value = "properties.defaultStorageAccount") + private String defaultStorageAccount; + + /** + * The artifact storage account of the lab. + */ + @JsonProperty(value = "properties.artifactsStorageAccount") + private String artifactsStorageAccount; + + /** + * The storage accounts of the lab. + */ + @JsonProperty(value = "properties.storageAccounts") + private List storageAccounts; + + /** + * The name of the key vault of the lab. + */ + @JsonProperty(value = "properties.vaultName") + private String vaultName; + + /** + * The type of the lab storage. Possible values include: 'Standard', + * 'Premium'. + */ + @JsonProperty(value = "properties.labStorageType") + private LabStorageType labStorageType; + + /** + * The default virtual network identifier of the lab. + */ + @JsonProperty(value = "properties.defaultVirtualNetworkId") + private String defaultVirtualNetworkId; + + /** + * The creation date of the lab. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the lab's default storage account. + * + * @return the defaultStorageAccount value + */ + public String defaultStorageAccount() { + return this.defaultStorageAccount; + } + + /** + * Set the lab's default storage account. + * + * @param defaultStorageAccount the defaultStorageAccount value to set + * @return the LabInner object itself. + */ + public LabInner withDefaultStorageAccount(String defaultStorageAccount) { + this.defaultStorageAccount = defaultStorageAccount; + return this; + } + + /** + * Get the artifact storage account of the lab. + * + * @return the artifactsStorageAccount value + */ + public String artifactsStorageAccount() { + return this.artifactsStorageAccount; + } + + /** + * Set the artifact storage account of the lab. + * + * @param artifactsStorageAccount the artifactsStorageAccount value to set + * @return the LabInner object itself. + */ + public LabInner withArtifactsStorageAccount(String artifactsStorageAccount) { + this.artifactsStorageAccount = artifactsStorageAccount; + return this; + } + + /** + * Get the storage accounts of the lab. + * + * @return the storageAccounts value + */ + public List storageAccounts() { + return this.storageAccounts; + } + + /** + * Set the storage accounts of the lab. + * + * @param storageAccounts the storageAccounts value to set + * @return the LabInner object itself. + */ + public LabInner withStorageAccounts(List storageAccounts) { + this.storageAccounts = storageAccounts; + return this; + } + + /** + * Get the name of the key vault of the lab. + * + * @return the vaultName value + */ + public String vaultName() { + return this.vaultName; + } + + /** + * Set the name of the key vault of the lab. + * + * @param vaultName the vaultName value to set + * @return the LabInner object itself. + */ + public LabInner withVaultName(String vaultName) { + this.vaultName = vaultName; + return this; + } + + /** + * Get the type of the lab storage. Possible values include: 'Standard', 'Premium'. + * + * @return the labStorageType value + */ + public LabStorageType labStorageType() { + return this.labStorageType; + } + + /** + * Set the type of the lab storage. Possible values include: 'Standard', 'Premium'. + * + * @param labStorageType the labStorageType value to set + * @return the LabInner object itself. + */ + public LabInner withLabStorageType(LabStorageType labStorageType) { + this.labStorageType = labStorageType; + return this; + } + + /** + * Get the default virtual network identifier of the lab. + * + * @return the defaultVirtualNetworkId value + */ + public String defaultVirtualNetworkId() { + return this.defaultVirtualNetworkId; + } + + /** + * Set the default virtual network identifier of the lab. + * + * @param defaultVirtualNetworkId the defaultVirtualNetworkId value to set + * @return the LabInner object itself. + */ + public LabInner withDefaultVirtualNetworkId(String defaultVirtualNetworkId) { + this.defaultVirtualNetworkId = defaultVirtualNetworkId; + return this; + } + + /** + * Get the creation date of the lab. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set the creation date of the lab. + * + * @param createdDate the createdDate value to set + * @return the LabInner object itself. + */ + public LabInner withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the LabInner object itself. + */ + public LabInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdImpl.java new file mode 100644 index 0000000000000..666e6e823dec7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdImpl.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.LabVhd; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class LabVhdImpl extends WrapperImpl implements LabVhd { + private final DevTestLabsManager manager; + LabVhdImpl(LabVhdInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdInner.java new file mode 100644 index 0000000000000..8882de209aeb9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVhdInner.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a VHD in the lab. + */ +public class LabVhdInner { + /** + * The absolute URI of the VHD. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the absolute URI of the VHD. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the absolute URI of the VHD. + * + * @param id the id value to set + * @return the LabVhdInner object itself. + */ + public LabVhdInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineImpl.java new file mode 100644 index 0000000000000..b41185e87ca5b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineImpl.java @@ -0,0 +1,341 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.LabVirtualMachine; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactInstallProperties; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactDeploymentStatusProperties; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImageReference; +import java.util.Map; + +class LabVirtualMachineImpl extends CreatableUpdatableImpl implements LabVirtualMachine, LabVirtualMachine.Definition, LabVirtualMachine.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + LabVirtualMachineImpl(String name, DevTestLabsManager manager) { + super(name, new LabVirtualMachineInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + LabVirtualMachineImpl(LabVirtualMachineInner inner, DevTestLabsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualmachines"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualMachinesInner client = this.manager().inner().virtualMachines(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualMachinesInner client = this.manager().inner().virtualMachines(); + return client.patchResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualMachinesInner client = this.manager().inner().virtualMachines(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public ArtifactDeploymentStatusProperties artifactDeploymentStatus() { + return this.inner().artifactDeploymentStatus(); + } + + @Override + public List artifacts() { + return this.inner().artifacts(); + } + + @Override + public String computeId() { + return this.inner().computeId(); + } + + @Override + public String createdByUser() { + return this.inner().createdByUser(); + } + + @Override + public String createdByUserId() { + return this.inner().createdByUserId(); + } + + @Override + public String customImageId() { + return this.inner().customImageId(); + } + + @Override + public Boolean disallowPublicIpAddress() { + return this.inner().disallowPublicIpAddress(); + } + + @Override + public String fqdn() { + return this.inner().fqdn(); + } + + @Override + public GalleryImageReference galleryImageReference() { + return this.inner().galleryImageReference(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isAuthenticationWithSshKey() { + return this.inner().isAuthenticationWithSshKey(); + } + + @Override + public String labSubnetName() { + return this.inner().labSubnetName(); + } + + @Override + public String labVirtualNetworkId() { + return this.inner().labVirtualNetworkId(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String notes() { + return this.inner().notes(); + } + + @Override + public String osType() { + return this.inner().osType(); + } + + @Override + public String ownerObjectId() { + return this.inner().ownerObjectId(); + } + + @Override + public String password() { + return this.inner().password(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String size() { + return this.inner().size(); + } + + @Override + public String sshKey() { + return this.inner().sshKey(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String userName() { + return this.inner().userName(); + } + + @Override + public LabVirtualMachineImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public LabVirtualMachineImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public LabVirtualMachineImpl withArtifactDeploymentStatus(ArtifactDeploymentStatusProperties artifactDeploymentStatus) { + this.inner().withArtifactDeploymentStatus(artifactDeploymentStatus); + return this; + } + + @Override + public LabVirtualMachineImpl withArtifacts(List artifacts) { + this.inner().withArtifacts(artifacts); + return this; + } + + @Override + public LabVirtualMachineImpl withComputeId(String computeId) { + this.inner().withComputeId(computeId); + return this; + } + + @Override + public LabVirtualMachineImpl withCreatedByUser(String createdByUser) { + this.inner().withCreatedByUser(createdByUser); + return this; + } + + @Override + public LabVirtualMachineImpl withCreatedByUserId(String createdByUserId) { + this.inner().withCreatedByUserId(createdByUserId); + return this; + } + + @Override + public LabVirtualMachineImpl withCustomImageId(String customImageId) { + this.inner().withCustomImageId(customImageId); + return this; + } + + @Override + public LabVirtualMachineImpl withDisallowPublicIpAddress(Boolean disallowPublicIpAddress) { + this.inner().withDisallowPublicIpAddress(disallowPublicIpAddress); + return this; + } + + @Override + public LabVirtualMachineImpl withFqdn(String fqdn) { + this.inner().withFqdn(fqdn); + return this; + } + + @Override + public LabVirtualMachineImpl withGalleryImageReference(GalleryImageReference galleryImageReference) { + this.inner().withGalleryImageReference(galleryImageReference); + return this; + } + + @Override + public LabVirtualMachineImpl withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey) { + this.inner().withIsAuthenticationWithSshKey(isAuthenticationWithSshKey); + return this; + } + + @Override + public LabVirtualMachineImpl withLabSubnetName(String labSubnetName) { + this.inner().withLabSubnetName(labSubnetName); + return this; + } + + @Override + public LabVirtualMachineImpl withLabVirtualNetworkId(String labVirtualNetworkId) { + this.inner().withLabVirtualNetworkId(labVirtualNetworkId); + return this; + } + + @Override + public LabVirtualMachineImpl withNotes(String notes) { + this.inner().withNotes(notes); + return this; + } + + @Override + public LabVirtualMachineImpl withOsType(String osType) { + this.inner().withOsType(osType); + return this; + } + + @Override + public LabVirtualMachineImpl withOwnerObjectId(String ownerObjectId) { + this.inner().withOwnerObjectId(ownerObjectId); + return this; + } + + @Override + public LabVirtualMachineImpl withPassword(String password) { + this.inner().withPassword(password); + return this; + } + + @Override + public LabVirtualMachineImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public LabVirtualMachineImpl withSize(String size) { + this.inner().withSize(size); + return this; + } + + @Override + public LabVirtualMachineImpl withSshKey(String sshKey) { + this.inner().withSshKey(sshKey); + return this; + } + + @Override + public LabVirtualMachineImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public LabVirtualMachineImpl withUserName(String userName) { + this.inner().withUserName(userName); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineInner.java new file mode 100644 index 0000000000000..7179deca6a93c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabVirtualMachineInner.java @@ -0,0 +1,546 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactInstallProperties; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactDeploymentStatusProperties; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GalleryImageReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A virtual machine. + */ +@JsonFlatten +public class LabVirtualMachineInner extends Resource { + /** + * 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 object identifier of the creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUserId") + private String createdByUserId; + + /** + * The email address of creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUser") + private String createdByUser; + + /** + * The resource identifier (Microsoft.Compute) of the virtual machine. + */ + @JsonProperty(value = "properties.computeId") + 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") + 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; + + /** + * A value indicating 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") + 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") + private ArtifactDeploymentStatusProperties artifactDeploymentStatus; + + /** + * The Microsoft Azure Marketplace image reference of the virtual machine. + */ + @JsonProperty(value = "properties.galleryImageReference") + private GalleryImageReference galleryImageReference; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the notes of the virtual machine. + * + * @return the notes value + */ + public String notes() { + return this.notes; + } + + /** + * Set 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 object identifier of the owner of the virtual machine. + * + * @return the ownerObjectId value + */ + public String ownerObjectId() { + return this.ownerObjectId; + } + + /** + * Set 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 object identifier of the creator of the virtual machine. + * + * @return the createdByUserId value + */ + public String createdByUserId() { + return this.createdByUserId; + } + + /** + * Set the object identifier of the creator of the virtual machine. + * + * @param createdByUserId the createdByUserId value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withCreatedByUserId(String createdByUserId) { + this.createdByUserId = createdByUserId; + return this; + } + + /** + * Get the email address of creator of the virtual machine. + * + * @return the createdByUser value + */ + public String createdByUser() { + return this.createdByUser; + } + + /** + * Set the email address of creator of the virtual machine. + * + * @param createdByUser the createdByUser value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withCreatedByUser(String createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + /** + * Get the resource identifier (Microsoft.Compute) of the virtual machine. + * + * @return the computeId value + */ + public String computeId() { + return this.computeId; + } + + /** + * Set the resource identifier (Microsoft.Compute) of the virtual machine. + * + * @param computeId the computeId value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withComputeId(String computeId) { + this.computeId = computeId; + return this; + } + + /** + * Get the custom image identifier of the virtual machine. + * + * @return the customImageId value + */ + public String customImageId() { + return this.customImageId; + } + + /** + * Set 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 OS type of the virtual machine. + * + * @return the osType value + */ + public String osType() { + return this.osType; + } + + /** + * Set the OS type of the virtual machine. + * + * @param osType the osType value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withOsType(String osType) { + this.osType = osType; + return this; + } + + /** + * Get the size of the virtual machine. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set 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 user name of the virtual machine. + * + * @return the userName value + */ + public String userName() { + return this.userName; + } + + /** + * Set 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 of the virtual machine administrator. + * + * @return the password value + */ + public String password() { + return this.password; + } + + /** + * Set 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 SSH key of the virtual machine administrator. + * + * @return the sshKey value + */ + public String sshKey() { + return this.sshKey; + } + + /** + * Set 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 a value indicating whether this virtual machine uses an SSH key for authentication. + * + * @return the isAuthenticationWithSshKey value + */ + public Boolean isAuthenticationWithSshKey() { + return this.isAuthenticationWithSshKey; + } + + /** + * Set a value indicating 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 fully-qualified domain name of the virtual machine. + * + * @return the fqdn value + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Set the fully-qualified domain name of the virtual machine. + * + * @param fqdn the fqdn value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withFqdn(String fqdn) { + this.fqdn = fqdn; + return this; + } + + /** + * Get the lab subnet name of the virtual machine. + * + * @return the labSubnetName value + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set 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 lab virtual network identifier of the virtual machine. + * + * @return the labVirtualNetworkId value + */ + public String labVirtualNetworkId() { + return this.labVirtualNetworkId; + } + + /** + * Set 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 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 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 to be installed on the virtual machine. + * + * @return the artifacts value + */ + public List artifacts() { + return this.artifacts; + } + + /** + * Set 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 artifact deployment status for the virtual machine. + * + * @return the artifactDeploymentStatus value + */ + public ArtifactDeploymentStatusProperties artifactDeploymentStatus() { + return this.artifactDeploymentStatus; + } + + /** + * Set the artifact deployment status for the virtual machine. + * + * @param artifactDeploymentStatus the artifactDeploymentStatus value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withArtifactDeploymentStatus(ArtifactDeploymentStatusProperties artifactDeploymentStatus) { + this.artifactDeploymentStatus = artifactDeploymentStatus; + return this; + } + + /** + * Get the Microsoft Azure Marketplace image reference of the virtual machine. + * + * @return the galleryImageReference value + */ + public GalleryImageReference galleryImageReference() { + return this.galleryImageReference; + } + + /** + * Set 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 provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsImpl.java new file mode 100644 index 0000000000000..52623a1c8c747 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsImpl.java @@ -0,0 +1,176 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Lab; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GenerateUploadUriResponse; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.LabVhd; + +class LabsImpl extends GroupableResourcesCoreImpl implements Labs { + protected LabsImpl(DevTestLabsManager manager) { + super(manager.inner().labs(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + LabsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + LabsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + LabsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + LabsInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Lab call(LabInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + LabsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + LabsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Lab call(LabInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public LabImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine) { + LabsInner client = this.inner(); + return client.createEnvironmentAsync(resourceGroupName, name, labVirtualMachine).toCompletable(); + } + + @Override + public Observable generateUploadUriAsync(String resourceGroupName, String name) { + LabsInner client = this.inner(); + return client.generateUploadUriAsync(resourceGroupName, name) + .map(new Func1() { + @Override + public GenerateUploadUriResponse call(GenerateUploadUriResponseInner inner) { + return new GenerateUploadUriResponseImpl(inner, manager()); + } + }); + } + + @Override + public Observable listVhdsAsync(final String resourceGroupName, final String name) { + LabsInner client = this.inner(); + return client.listVhdsAsync(resourceGroupName, name) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LabVhd call(LabVhdInner inner) { + return new LabVhdImpl(inner, manager()); + } + }); + } + + @Override + protected LabImpl wrapModel(LabInner inner) { + return new LabImpl(inner.name(), inner, manager()); + } + + @Override + protected LabImpl wrapModel(String name) { + return new LabImpl(name, new LabInner(), this.manager()); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsInner.java new file mode 100644 index 0000000000000..9cd2f0f331598 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/LabsInner.java @@ -0,0 +1,1904 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.GenerateUploadUriParameter; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Labs. + */ +public class LabsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private LabsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of LabsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LabsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(LabsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Labs to be + * used by Retrofit to perform actually REST calls. + */ + interface LabsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body LabInner lab, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs beginCreateOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}") + Observable> beginCreateOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body LabInner lab, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs patchResource" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}") + Observable> patchResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body LabInner lab, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs createEnvironment" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment") + Observable> createEnvironment(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body LabVirtualMachineInner labVirtualMachine, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs beginCreateEnvironment" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/createEnvironment") + Observable> beginCreateEnvironment(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body LabVirtualMachineInner labVirtualMachine, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs generateUploadUri" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/generateUploadUri") + Observable> generateUploadUri(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body GenerateUploadUriParameter generateUploadUriParameter, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs listVhds" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/listVhds") + Observable> listVhds(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Labs listVhdsNext" }) + @GET + Observable> listVhdsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List labs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List labs. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List labs. + * + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabInner> object if successful. + */ + public PagedList list(final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs. + * + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs. + * + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listAsync(final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs. + * + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List labs. + * + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter, final Integer top, final String orderBy) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter, final Integer top, final String orderBy) { + return listByResourceGroupSinglePageAsync(resourceGroupName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List labs. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabInner object if successful. + */ + public LabInner getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the LabInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String name) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1, LabInner>() { + @Override + public LabInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the LabInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabInner object if successful. + */ + public LabInner createOrUpdateResource(String resourceGroupName, String name, LabInner lab) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, name, lab).toBlocking().last().body(); + } + + /** + * 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 the LabInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String name, LabInner lab, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, name, lab), serviceCallback); + } + + /** + * 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 the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String name, LabInner lab) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, name, lab).map(new Func1, LabInner>() { + @Override + public LabInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String name, LabInner lab) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (lab == null) { + throw new IllegalArgumentException("Parameter lab is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(lab); + Observable> observable = service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, name, lab, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabInner object if successful. + */ + public LabInner beginCreateOrUpdateResource(String resourceGroupName, String name, LabInner lab) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, name, lab).toBlocking().single().body(); + } + + /** + * 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 the LabInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateResourceAsync(String resourceGroupName, String name, LabInner lab, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, name, lab), serviceCallback); + } + + /** + * 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 the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable beginCreateOrUpdateResourceAsync(String resourceGroupName, String name, LabInner lab) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, name, lab).map(new Func1, LabInner>() { + @Override + public LabInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable> beginCreateOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String name, LabInner lab) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (lab == null) { + throw new IllegalArgumentException("Parameter lab is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(lab); + return service.beginCreateOrUpdateResource(this.client.subscriptionId(), resourceGroupName, name, lab, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().last().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String name) { + beginDeleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String name) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Modify properties of labs. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabInner object if successful. + */ + public LabInner patchResource(String resourceGroupName, String name, LabInner lab) { + return patchResourceWithServiceResponseAsync(resourceGroupName, name, lab).toBlocking().single().body(); + } + + /** + * Modify properties of labs. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab the LabInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture patchResourceAsync(String resourceGroupName, String name, LabInner lab, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchResourceWithServiceResponseAsync(resourceGroupName, name, lab), serviceCallback); + } + + /** + * Modify properties of labs. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable patchResourceAsync(String resourceGroupName, String name, LabInner lab) { + return patchResourceWithServiceResponseAsync(resourceGroupName, name, lab).map(new Func1, LabInner>() { + @Override + public LabInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of labs. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param lab the LabInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable> patchResourceWithServiceResponseAsync(String resourceGroupName, String name, LabInner lab) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (lab == null) { + throw new IllegalArgumentException("Parameter lab is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(lab); + return service.patchResource(this.client.subscriptionId(), resourceGroupName, name, lab, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = patchResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse patchResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void createEnvironment(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine) { + createEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachine).toBlocking().last().body(); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachine), serviceCallback); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine) { + return createEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachine).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createEnvironmentWithServiceResponseAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (labVirtualMachine == null) { + throw new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(labVirtualMachine); + Observable> observable = service.createEnvironment(this.client.subscriptionId(), resourceGroupName, name, labVirtualMachine, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginCreateEnvironment(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine) { + beginCreateEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachine).toBlocking().single().body(); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachine), serviceCallback); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine) { + return beginCreateEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachine).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 labVirtualMachine the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateEnvironmentWithServiceResponseAsync(String resourceGroupName, String name, LabVirtualMachineInner labVirtualMachine) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (labVirtualMachine == null) { + throw new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(labVirtualMachine); + return service.beginCreateEnvironment(this.client.subscriptionId(), resourceGroupName, name, labVirtualMachine, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateEnvironmentDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateEnvironmentDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenerateUploadUriResponseInner object if successful. + */ + public GenerateUploadUriResponseInner generateUploadUri(String resourceGroupName, String name) { + return generateUploadUriWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateUploadUriAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateUploadUriWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenerateUploadUriResponseInner object + */ + public Observable generateUploadUriAsync(String resourceGroupName, String name) { + return generateUploadUriWithServiceResponseAsync(resourceGroupName, name).map(new Func1, GenerateUploadUriResponseInner>() { + @Override + public GenerateUploadUriResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenerateUploadUriResponseInner object + */ + public Observable> generateUploadUriWithServiceResponseAsync(String resourceGroupName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String blobName = null; + GenerateUploadUriParameter generateUploadUriParameter = new GenerateUploadUriParameter(); + generateUploadUriParameter.withBlobName(null); + return service.generateUploadUri(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), generateUploadUriParameter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateUploadUriDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 blobName The blob name of the upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the GenerateUploadUriResponseInner object if successful. + */ + public GenerateUploadUriResponseInner generateUploadUri(String resourceGroupName, String name, String blobName) { + return generateUploadUriWithServiceResponseAsync(resourceGroupName, name, blobName).toBlocking().single().body(); + } + + /** + * 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 blobName The blob name of the upload URI. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture generateUploadUriAsync(String resourceGroupName, String name, String blobName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(generateUploadUriWithServiceResponseAsync(resourceGroupName, name, blobName), serviceCallback); + } + + /** + * 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 blobName The blob name of the upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenerateUploadUriResponseInner object + */ + public Observable generateUploadUriAsync(String resourceGroupName, String name, String blobName) { + return generateUploadUriWithServiceResponseAsync(resourceGroupName, name, blobName).map(new Func1, GenerateUploadUriResponseInner>() { + @Override + public GenerateUploadUriResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 blobName The blob name of the upload URI. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GenerateUploadUriResponseInner object + */ + public Observable> generateUploadUriWithServiceResponseAsync(String resourceGroupName, String name, String blobName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + GenerateUploadUriParameter generateUploadUriParameter = new GenerateUploadUriParameter(); + generateUploadUriParameter.withBlobName(blobName); + return service.generateUploadUri(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), generateUploadUriParameter, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = generateUploadUriDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse generateUploadUriDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabVhdInner> object if successful. + */ + public PagedList listVhds(final String resourceGroupName, final String name) { + ServiceResponse> response = listVhdsSinglePageAsync(resourceGroupName, name).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listVhdsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List disk images available for custom image creation. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listVhdsAsync(final String resourceGroupName, final String name, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listVhdsSinglePageAsync(resourceGroupName, name), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listVhdsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * 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 + * @return the observable to the PagedList<LabVhdInner> object + */ + public Observable> listVhdsAsync(final String resourceGroupName, final String name) { + return listVhdsWithServiceResponseAsync(resourceGroupName, name) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PagedList<LabVhdInner> object + */ + public Observable>> listVhdsWithServiceResponseAsync(final String resourceGroupName, final String name) { + return listVhdsSinglePageAsync(resourceGroupName, name) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listVhdsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List disk images available for custom image creation. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabVhdInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listVhdsSinglePageAsync(final String resourceGroupName, final String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listVhds(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listVhdsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listVhdsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List labs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List labs. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List disk images available for custom image creation. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabVhdInner> object if successful. + */ + public PagedList listVhdsNext(final String nextPageLink) { + ServiceResponse> response = listVhdsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listVhdsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List disk images available for custom image creation. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listVhdsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listVhdsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listVhdsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List disk images available for custom image creation. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVhdInner> object + */ + public Observable> listVhdsNextAsync(final String nextPageLink) { + return listVhdsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List disk images available for custom image creation. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVhdInner> object + */ + public Observable>> listVhdsNextWithServiceResponseAsync(final String nextPageLink) { + return listVhdsNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listVhdsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List disk images available for custom image creation. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabVhdInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listVhdsNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listVhdsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listVhdsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listVhdsNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PageImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..b9973ec6fd302 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyImpl.java new file mode 100644 index 0000000000000..326c96b068b7e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyImpl.java @@ -0,0 +1,200 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicyStatus; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicyFactName; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicyEvaluatorType; +import java.util.Map; + +class PolicyImpl extends CreatableUpdatableImpl implements Policy, Policy.Definition, Policy.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String policySetName; + private String name; + + PolicyImpl(String name, DevTestLabsManager manager) { + super(name, new PolicyInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + PolicyImpl(PolicyInner inner, DevTestLabsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.policySetName = IdParsingUtils.getValueFromIdByName(inner.id(), "policysets"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "policies"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PolicysInner client = this.manager().inner().policys(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.policySetName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PolicysInner client = this.manager().inner().policys(); + return client.patchResourceAsync(this.resourceGroupName, this.labName, this.policySetName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PolicysInner client = this.manager().inner().policys(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.policySetName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public PolicyEvaluatorType evaluatorType() { + return this.inner().evaluatorType(); + } + + @Override + public String factData() { + return this.inner().factData(); + } + + @Override + public PolicyFactName factName() { + return this.inner().factName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public PolicyStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String threshold() { + return this.inner().threshold(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PolicyImpl withExistingPolicyset(String resourceGroupName, String labName, String policySetName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.policySetName = policySetName; + return this; + } + + @Override + public PolicyImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public PolicyImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public PolicyImpl withEvaluatorType(PolicyEvaluatorType evaluatorType) { + this.inner().withEvaluatorType(evaluatorType); + return this; + } + + @Override + public PolicyImpl withFactData(String factData) { + this.inner().withFactData(factData); + return this; + } + + @Override + public PolicyImpl withFactName(PolicyFactName factName) { + this.inner().withFactName(factName); + return this; + } + + @Override + public PolicyImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public PolicyImpl withStatus(PolicyStatus status) { + this.inner().withStatus(status); + return this; + } + + @Override + public PolicyImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public PolicyImpl withThreshold(String threshold) { + this.inner().withThreshold(threshold); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyInner.java new file mode 100644 index 0000000000000..b0eb7faa782b4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicyInner.java @@ -0,0 +1,209 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicyStatus; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicyFactName; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicyEvaluatorType; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A Policy. + */ +@JsonFlatten +public class PolicyInner extends Resource { + /** + * The description of the policy. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The status of the policy. Possible values include: 'Enabled', + * 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private PolicyStatus status; + + /** + * The fact name of the policy. Possible values include: + * 'UserOwnedLabVmCount', 'LabVmCount', 'LabVmSize', 'GalleryImage', + * 'UserOwnedLabVmCountInSubnet'. + */ + @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. + */ + @JsonProperty(value = "properties.threshold") + private String threshold; + + /** + * The evaluator type of the policy. Possible values include: + * 'AllowedValuesPolicy', 'MaxValuePolicy'. + */ + @JsonProperty(value = "properties.evaluatorType") + private PolicyEvaluatorType evaluatorType; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the description of the policy. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set 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 of the policy. Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public PolicyStatus status() { + return this.status; + } + + /** + * Set the status of the policy. Possible values include: 'Enabled', 'Disabled'. + * + * @param status the status value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withStatus(PolicyStatus status) { + this.status = status; + return this; + } + + /** + * Get the fact name of the policy. Possible values include: 'UserOwnedLabVmCount', 'LabVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet'. + * + * @return the factName value + */ + public PolicyFactName factName() { + return this.factName; + } + + /** + * Set the fact name of the policy. Possible values include: 'UserOwnedLabVmCount', 'LabVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet'. + * + * @param factName the factName value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withFactName(PolicyFactName factName) { + this.factName = factName; + return this; + } + + /** + * Get the fact data of the policy. + * + * @return the factData value + */ + public String factData() { + return this.factData; + } + + /** + * Set 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 of the policy. + * + * @return the threshold value + */ + public String threshold() { + return this.threshold; + } + + /** + * Set the threshold of the policy. + * + * @param threshold the threshold value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withThreshold(String threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the evaluator type of the policy. Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. + * + * @return the evaluatorType value + */ + public PolicyEvaluatorType evaluatorType() { + return this.evaluatorType; + } + + /** + * Set the evaluator type of the policy. Possible values include: '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 provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsImpl.java new file mode 100644 index 0000000000000..da6026fc75524 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicySets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EvaluatePoliciesResponse; + +class PolicySetsImpl extends WrapperImpl implements PolicySets { + private final DevTestLabsManager manager; + + PolicySetsImpl(DevTestLabsManager manager) { + super(manager.inner().policySets()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable evaluatePoliciesAsync(String resourceGroupName, String labName, String name) { + PolicySetsInner client = this.inner(); + return client.evaluatePoliciesAsync(resourceGroupName, labName, name) + .map(new Func1() { + @Override + public EvaluatePoliciesResponse call(EvaluatePoliciesResponseInner inner) { + return new EvaluatePoliciesResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsInner.java new file mode 100644 index 0000000000000..18719b31c40d7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicySetsInner.java @@ -0,0 +1,254 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EvaluatePoliciesProperties; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EvaluatePoliciesRequest; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PolicySets. + */ +public class PolicySetsInner { + /** The Retrofit service to perform REST calls. */ + private PolicySetsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of PolicySetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicySetsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(PolicySetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PolicySets to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicySetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.PolicySets evaluatePolicies" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{name}/evaluatePolicies") + Observable> evaluatePolicies(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body EvaluatePoliciesRequest evaluatePoliciesRequest, @Header("User-Agent") String userAgent); + + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EvaluatePoliciesResponseInner object if successful. + */ + public EvaluatePoliciesResponseInner evaluatePolicies(String resourceGroupName, String labName, String name) { + return evaluatePoliciesWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture evaluatePoliciesAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(evaluatePoliciesWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EvaluatePoliciesResponseInner object + */ + public Observable evaluatePoliciesAsync(String resourceGroupName, String labName, String name) { + return evaluatePoliciesWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, EvaluatePoliciesResponseInner>() { + @Override + public EvaluatePoliciesResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EvaluatePoliciesResponseInner object + */ + public Observable> evaluatePoliciesWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final List policies = null; + EvaluatePoliciesRequest evaluatePoliciesRequest = new EvaluatePoliciesRequest(); + evaluatePoliciesRequest.withPolicies(null); + return service.evaluatePolicies(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), evaluatePoliciesRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = evaluatePoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * 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 policies Policies to evaluate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the EvaluatePoliciesResponseInner object if successful. + */ + public EvaluatePoliciesResponseInner evaluatePolicies(String resourceGroupName, String labName, String name, List policies) { + return evaluatePoliciesWithServiceResponseAsync(resourceGroupName, labName, name, policies).toBlocking().single().body(); + } + + /** + * 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 policies Policies to evaluate. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture evaluatePoliciesAsync(String resourceGroupName, String labName, String name, List policies, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(evaluatePoliciesWithServiceResponseAsync(resourceGroupName, labName, name, policies), serviceCallback); + } + + /** + * 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 policies Policies to evaluate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EvaluatePoliciesResponseInner object + */ + public Observable evaluatePoliciesAsync(String resourceGroupName, String labName, String name, List policies) { + return evaluatePoliciesWithServiceResponseAsync(resourceGroupName, labName, name, policies).map(new Func1, EvaluatePoliciesResponseInner>() { + @Override + public EvaluatePoliciesResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 policies Policies to evaluate. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EvaluatePoliciesResponseInner object + */ + public Observable> evaluatePoliciesWithServiceResponseAsync(String resourceGroupName, String labName, String name, List policies) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(policies); + EvaluatePoliciesRequest evaluatePoliciesRequest = new EvaluatePoliciesRequest(); + evaluatePoliciesRequest.withPolicies(policies); + return service.evaluatePolicies(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), evaluatePoliciesRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = evaluatePoliciesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse evaluatePoliciesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysImpl.java new file mode 100644 index 0000000000000..4dd4819f27bae --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policy; + +class PolicysImpl extends WrapperImpl implements Policys { + private final DevTestLabsManager manager; + + PolicysImpl(DevTestLabsManager manager) { + super(manager.inner().policys()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public PolicyImpl define(String name) { + return wrapModel(name); + } + + private PolicyImpl wrapModel(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + + private PolicyImpl wrapModel(String name) { + return new PolicyImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName, final String policySetName) { + PolicysInner client = this.inner(); + return client.listAsync(resourceGroupName, labName, policySetName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String policySetName, String name) { + PolicysInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, policySetName, name) + .flatMap(new Func1>() { + @Override + public Observable call(PolicyInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Policy)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteResourceAsync(String resourceGroupName, String labName, String policySetName, String name) { + PolicysInner client = this.inner(); + return client.deleteResourceAsync(resourceGroupName, labName, policySetName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysInner.java new file mode 100644 index 0000000000000..d54a6bd113f84 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/PolicysInner.java @@ -0,0 +1,892 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Policys. + */ +public class PolicysInner { + /** The Retrofit service to perform REST calls. */ + private PolicysService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of PolicysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PolicysInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(PolicysService.class); + this.client = client; + } + + /** + * The interface defining all the services for Policys to be + * used by Retrofit to perform actually REST calls. + */ + interface PolicysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("policySetName") String policySetName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("policySetName") String policySetName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("policySetName") String policySetName, @Path("name") String name, @Body PolicyInner policy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys deleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", method = "DELETE", hasBody = true) + Observable> deleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("policySetName") String policySetName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys patchResource" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}") + Observable> patchResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("policySetName") String policySetName, @Path("name") String name, @Body PolicyInner policy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Policys listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List policies. + * + * @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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String policySetName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, policySetName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List policies. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String policySetName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, policySetName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List policies. + * + * @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 + * @return the observable to the PagedList<PolicyInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String policySetName) { + return listWithServiceResponseAsync(resourceGroupName, labName, policySetName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List policies. + * + * @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 + * @return the observable to the PagedList<PolicyInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String policySetName) { + return listSinglePageAsync(resourceGroupName, labName, policySetName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List policies. + * + * @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 + * @return the PagedList<PolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String policySetName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (policySetName == null) { + throw new IllegalArgumentException("Parameter policySetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, policySetName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List policies. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String policySetName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, policySetName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List policies. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String policySetName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, policySetName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List policies. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String policySetName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, policySetName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List policies. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String policySetName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, policySetName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List policies. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param policySetName The name of the policy set. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String policySetName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (policySetName == null) { + throw new IllegalArgumentException("Parameter policySetName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, policySetName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyInner object if successful. + */ + public PolicyInner getResource(String resourceGroupName, String labName, String policySetName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String policySetName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the PolicyInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String policySetName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the PolicyInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String policySetName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (policySetName == null) { + throw new IllegalArgumentException("Parameter policySetName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, policySetName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the PolicyInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyInner object if successful. + */ + public PolicyInner createOrUpdateResource(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, policy).toBlocking().single().body(); + } + + /** + * 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 the PolicyInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, policy), serviceCallback); + } + + /** + * 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 the PolicyInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, policy).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the PolicyInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (policySetName == null) { + throw new IllegalArgumentException("Parameter policySetName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (policy == null) { + throw new IllegalArgumentException("Parameter policy is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(policy); + return service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, policySetName, name, policy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteResource(String resourceGroupName, String labName, String policySetName, String name) { + deleteResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteResourceAsync(String resourceGroupName, String labName, String policySetName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteResourceAsync(String resourceGroupName, String labName, String policySetName, String name) { + return deleteResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String policySetName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (policySetName == null) { + throw new IllegalArgumentException("Parameter policySetName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteResource(this.client.subscriptionId(), resourceGroupName, labName, policySetName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Modify properties of policies. + * + * @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 the PolicyInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyInner object if successful. + */ + public PolicyInner patchResource(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, policy).toBlocking().single().body(); + } + + /** + * Modify properties of policies. + * + * @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 the PolicyInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture patchResourceAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, policy), serviceCallback); + } + + /** + * Modify properties of policies. + * + * @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 the PolicyInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable patchResourceAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, policy).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of policies. + * + * @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 the PolicyInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> patchResourceWithServiceResponseAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (policySetName == null) { + throw new IllegalArgumentException("Parameter policySetName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (policy == null) { + throw new IllegalArgumentException("Parameter policy is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(policy); + return service.patchResource(this.client.subscriptionId(), resourceGroupName, labName, policySetName, name, policy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = patchResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse patchResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PolicyInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List policies. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PolicyInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List policies. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PolicyInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleImpl.java new file mode 100644 index 0000000000000..7d33be30cff87 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleImpl.java @@ -0,0 +1,199 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EnableStatus; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.TaskType; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.WeekDetails; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.DayDetails; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.HourDetails; +import java.util.Map; + +class ScheduleImpl extends CreatableUpdatableImpl implements Schedule, Schedule.Definition, Schedule.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + ScheduleImpl(String name, DevTestLabsManager manager) { + super(name, new ScheduleInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + ScheduleImpl(ScheduleInner inner, DevTestLabsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "schedules"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SchedulesInner client = this.manager().inner().schedules(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SchedulesInner client = this.manager().inner().schedules(); + return client.patchResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SchedulesInner client = this.manager().inner().schedules(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DayDetails dailyRecurrence() { + return this.inner().dailyRecurrence(); + } + + @Override + public HourDetails hourlyRecurrence() { + return this.inner().hourlyRecurrence(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public EnableStatus status() { + return this.inner().status(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public TaskType taskType() { + return this.inner().taskType(); + } + + @Override + public String timeZoneId() { + return this.inner().timeZoneId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public WeekDetails weeklyRecurrence() { + return this.inner().weeklyRecurrence(); + } + + @Override + public ScheduleImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public ScheduleImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ScheduleImpl withDailyRecurrence(DayDetails dailyRecurrence) { + this.inner().withDailyRecurrence(dailyRecurrence); + return this; + } + + @Override + public ScheduleImpl withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.inner().withHourlyRecurrence(hourlyRecurrence); + return this; + } + + @Override + public ScheduleImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public ScheduleImpl withStatus(EnableStatus status) { + this.inner().withStatus(status); + return this; + } + + @Override + public ScheduleImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public ScheduleImpl withTaskType(TaskType taskType) { + this.inner().withTaskType(taskType); + return this; + } + + @Override + public ScheduleImpl withTimeZoneId(String timeZoneId) { + this.inner().withTimeZoneId(timeZoneId); + return this; + } + + @Override + public ScheduleImpl withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.inner().withWeeklyRecurrence(weeklyRecurrence); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleInner.java new file mode 100644 index 0000000000000..c45c80849d368 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/ScheduleInner.java @@ -0,0 +1,209 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.EnableStatus; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.TaskType; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.WeekDetails; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.DayDetails; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.HourDetails; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A schedule. + */ +@JsonFlatten +public class ScheduleInner extends Resource { + /** + * The status of the schedule. Possible values include: 'Enabled', + * 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /** + * The task type of the schedule. Possible values include: + * 'LabVmsShutdownTask', 'LabVmsStartupTask', 'LabBillingTask'. + */ + @JsonProperty(value = "properties.taskType") + private TaskType taskType; + + /** + * The weekly recurrence of the schedule. + */ + @JsonProperty(value = "properties.weeklyRecurrence") + private WeekDetails weeklyRecurrence; + + /** + * The daily recurrence of the schedule. + */ + @JsonProperty(value = "properties.dailyRecurrence") + private DayDetails dailyRecurrence; + + /** + * The hourly recurrence of the schedule. + */ + @JsonProperty(value = "properties.hourlyRecurrence") + private HourDetails hourlyRecurrence; + + /** + * The time zone id. + */ + @JsonProperty(value = "properties.timeZoneId") + private String timeZoneId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the status of the schedule. Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status of the schedule. Possible values include: '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 task type of the schedule. Possible values include: 'LabVmsShutdownTask', 'LabVmsStartupTask', 'LabBillingTask'. + * + * @return the taskType value + */ + public TaskType taskType() { + return this.taskType; + } + + /** + * Set the task type of the schedule. Possible values include: 'LabVmsShutdownTask', 'LabVmsStartupTask', 'LabBillingTask'. + * + * @param taskType the taskType value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTaskType(TaskType taskType) { + this.taskType = taskType; + return this; + } + + /** + * Get the weekly recurrence of the schedule. + * + * @return the weeklyRecurrence value + */ + public WeekDetails weeklyRecurrence() { + return this.weeklyRecurrence; + } + + /** + * Set the weekly recurrence of the schedule. + * + * @param weeklyRecurrence the weeklyRecurrence value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.weeklyRecurrence = weeklyRecurrence; + return this; + } + + /** + * Get the daily recurrence of the schedule. + * + * @return the dailyRecurrence value + */ + public DayDetails dailyRecurrence() { + return this.dailyRecurrence; + } + + /** + * Set the daily recurrence of the schedule. + * + * @param dailyRecurrence the dailyRecurrence value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withDailyRecurrence(DayDetails dailyRecurrence) { + this.dailyRecurrence = dailyRecurrence; + return this; + } + + /** + * Get the hourly recurrence of the schedule. + * + * @return the hourlyRecurrence value + */ + public HourDetails hourlyRecurrence() { + return this.hourlyRecurrence; + } + + /** + * Set the hourly recurrence of the schedule. + * + * @param hourlyRecurrence the hourlyRecurrence value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.hourlyRecurrence = hourlyRecurrence; + return this; + } + + /** + * Get the time zone id. + * + * @return the timeZoneId value + */ + public String timeZoneId() { + return this.timeZoneId; + } + + /** + * Set the time zone id. + * + * @param timeZoneId the timeZoneId value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTimeZoneId(String timeZoneId) { + this.timeZoneId = timeZoneId; + return this; + } + + /** + * Get the provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesImpl.java new file mode 100644 index 0000000000000..e1b9056f16f7c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesImpl.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedule; + +class SchedulesImpl extends WrapperImpl implements Schedules { + private final DevTestLabsManager manager; + + SchedulesImpl(DevTestLabsManager manager) { + super(manager.inner().schedules()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public ScheduleImpl define(String name) { + return wrapModel(name); + } + + private ScheduleImpl wrapModel(ScheduleInner inner) { + return new ScheduleImpl(inner, manager()); + } + + private ScheduleImpl wrapModel(String name) { + return new ScheduleImpl(name, this.manager()); + } + + @Override + public Completable executeAsync(String resourceGroupName, String labName, String name) { + SchedulesInner client = this.inner(); + return client.executeAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + SchedulesInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Schedule call(ScheduleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + SchedulesInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(ScheduleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Schedule)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteResourceAsync(String resourceGroupName, String labName, String name) { + SchedulesInner client = this.inner(); + return client.deleteResourceAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesInner.java new file mode 100644 index 0000000000000..9ed5a480c399d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/SchedulesInner.java @@ -0,0 +1,1192 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Schedules. + */ +public class SchedulesInner { + /** The Retrofit service to perform REST calls. */ + private SchedulesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of SchedulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SchedulesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(SchedulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Schedules to be + * used by Retrofit to perform actually REST calls. + */ + interface SchedulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ScheduleInner schedule, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules beginCreateOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}") + Observable> beginCreateOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ScheduleInner schedule, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules deleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", method = "DELETE", hasBody = true) + Observable> deleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules beginDeleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", method = "DELETE", hasBody = true) + Observable> beginDeleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules patchResource" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}") + Observable> patchResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ScheduleInner schedule, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules execute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute") + Observable> execute(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules beginExecute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/execute") + Observable> beginExecute(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Schedules listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ScheduleInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ScheduleInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List schedules. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ScheduleInner object if successful. + */ + public ScheduleInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the ScheduleInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the ScheduleInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ScheduleInner object if successful. + */ + public ScheduleInner createOrUpdateResource(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule).toBlocking().last().body(); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule), serviceCallback); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (schedule == null) { + throw new IllegalArgumentException("Parameter schedule is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(schedule); + Observable> observable = service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, schedule, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ScheduleInner object if successful. + */ + public ScheduleInner beginCreateOrUpdateResource(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule).toBlocking().single().body(); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule), serviceCallback); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing 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 schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> beginCreateOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (schedule == null) { + throw new IllegalArgumentException("Parameter schedule is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(schedule); + return service.beginCreateOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, schedule, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Delete 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteResource(String resourceGroupName, String labName, String name) { + deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Delete 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Delete 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 + * @return the observable for the request + */ + public Observable deleteResourceAsync(String resourceGroupName, String labName, String name) { + return deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete 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 + * @return the observable for the request + */ + public Observable> deleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.deleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteResource(String resourceGroupName, String labName, String name) { + beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Delete 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Delete 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteResourceAsync(String resourceGroupName, String labName, String name) { + return beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDeleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Modify properties of schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ScheduleInner object if successful. + */ + public ScheduleInner patchResource(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule).toBlocking().single().body(); + } + + /** + * Modify properties of schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule the ScheduleInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture patchResourceAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule), serviceCallback); + } + + /** + * Modify properties of schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable patchResourceAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, schedule).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule the ScheduleInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> patchResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (schedule == null) { + throw new IllegalArgumentException("Parameter schedule is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(schedule); + return service.patchResource(this.client.subscriptionId(), resourceGroupName, labName, name, schedule, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = patchResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse patchResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void execute(String resourceGroupName, String labName, String name) { + executeWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture executeAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(executeWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable executeAsync(String resourceGroupName, String labName, String name) { + return executeWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable> executeWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.execute(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginExecute(String resourceGroupName, String labName, String name) { + beginExecuteWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginExecuteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExecuteWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginExecuteAsync(String resourceGroupName, String labName, String name) { + return beginExecuteWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginExecuteWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginExecute(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginExecuteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExecuteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List schedules. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ScheduleInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List schedules. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesImpl.java new file mode 100644 index 0000000000000..974b1f16e927d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.LabVirtualMachine; + +class VirtualMachinesImpl extends WrapperImpl implements VirtualMachines { + private final DevTestLabsManager manager; + + VirtualMachinesImpl(DevTestLabsManager manager) { + super(manager.inner().virtualMachines()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public LabVirtualMachineImpl define(String name) { + return wrapModel(name); + } + + private LabVirtualMachineImpl wrapModel(LabVirtualMachineInner inner) { + return new LabVirtualMachineImpl(inner, manager()); + } + + private LabVirtualMachineImpl wrapModel(String name) { + return new LabVirtualMachineImpl(name, this.manager()); + } + + @Override + public Completable applyArtifactsAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.applyArtifactsAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Completable startAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.startAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Completable stopAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.stopAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + VirtualMachinesInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public LabVirtualMachine call(LabVirtualMachineInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(LabVirtualMachineInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((LabVirtualMachine)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteResourceAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.deleteResourceAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesInner.java new file mode 100644 index 0000000000000..ea0f12aea1209 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualMachinesInner.java @@ -0,0 +1,1725 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ApplyArtifactsRequest; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.ArtifactInstallProperties; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in VirtualMachines. + */ +public class VirtualMachinesInner { + /** The Retrofit service to perform REST calls. */ + private VirtualMachinesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of VirtualMachinesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualMachinesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(VirtualMachinesService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualMachines to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualMachinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body LabVirtualMachineInner labVirtualMachine, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines beginCreateOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> beginCreateOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body LabVirtualMachineInner labVirtualMachine, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines deleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", method = "DELETE", hasBody = true) + Observable> deleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines beginDeleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", method = "DELETE", hasBody = true) + Observable> beginDeleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines patchResource" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> patchResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body LabVirtualMachineInner labVirtualMachine, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines applyArtifacts" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts") + Observable> applyArtifacts(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ApplyArtifactsRequest applyArtifactsRequest, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines beginApplyArtifacts" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts") + Observable> beginApplyArtifacts(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ApplyArtifactsRequest applyArtifactsRequest, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines start" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start") + Observable> start(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines beginStart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start") + Observable> beginStart(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines stop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop") + Observable> stop(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines beginStop" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop") + Observable> beginStop(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualMachines listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabVirtualMachineInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVirtualMachineInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVirtualMachineInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabVirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabVirtualMachineInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVirtualMachineInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVirtualMachineInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List virtual machines. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabVirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabVirtualMachineInner object if successful. + */ + public LabVirtualMachineInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the LabVirtualMachineInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, LabVirtualMachineInner>() { + @Override + public LabVirtualMachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the LabVirtualMachineInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabVirtualMachineInner object if successful. + */ + public LabVirtualMachineInner createOrUpdateResource(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine).toBlocking().last().body(); + } + + /** + * 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 the LabVirtualMachineInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine), serviceCallback); + } + + /** + * 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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine).map(new Func1, LabVirtualMachineInner>() { + @Override + public LabVirtualMachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (labVirtualMachine == null) { + throw new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(labVirtualMachine); + Observable> observable = service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, labVirtualMachine, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabVirtualMachineInner object if successful. + */ + public LabVirtualMachineInner beginCreateOrUpdateResource(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine).toBlocking().single().body(); + } + + /** + * 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 the LabVirtualMachineInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine), serviceCallback); + } + + /** + * 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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine).map(new Func1, LabVirtualMachineInner>() { + @Override + public LabVirtualMachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable> beginCreateOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (labVirtualMachine == null) { + throw new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(labVirtualMachine); + return service.beginCreateOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, labVirtualMachine, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteResource(String resourceGroupName, String labName, String name) { + deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable deleteResourceAsync(String resourceGroupName, String labName, String name) { + return deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable> deleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.deleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteResource(String resourceGroupName, String labName, String name) { + beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteResourceAsync(String resourceGroupName, String labName, String name) { + return beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDeleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Modify properties of virtual machines. + * + * @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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LabVirtualMachineInner object if successful. + */ + public LabVirtualMachineInner patchResource(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine).toBlocking().single().body(); + } + + /** + * Modify properties of virtual machines. + * + * @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 the LabVirtualMachineInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture patchResourceAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine), serviceCallback); + } + + /** + * Modify properties of virtual machines. + * + * @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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable patchResourceAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, labVirtualMachine).map(new Func1, LabVirtualMachineInner>() { + @Override + public LabVirtualMachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of virtual machines. + * + * @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 the LabVirtualMachineInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable> patchResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (labVirtualMachine == null) { + throw new IllegalArgumentException("Parameter labVirtualMachine is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(labVirtualMachine); + return service.patchResource(this.client.subscriptionId(), resourceGroupName, labName, name, labVirtualMachine, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = patchResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse patchResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void applyArtifacts(String resourceGroupName, String labName, String name) { + applyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture applyArtifactsAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(applyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 + * @return the observable for the request + */ + public Observable applyArtifactsAsync(String resourceGroupName, String labName, String name) { + return applyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 + * @return the observable for the request + */ + public Observable> applyArtifactsWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String artifactsConverted = null; + ApplyArtifactsRequest applyArtifactsRequest = new ApplyArtifactsRequest(); + applyArtifactsRequest.withArtifacts(null); + Observable> observable = service.applyArtifacts(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), applyArtifactsRequest, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void applyArtifacts(String resourceGroupName, String labName, String name, List artifacts) { + applyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name, artifacts).toBlocking().last().body(); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture applyArtifactsAsync(String resourceGroupName, String labName, String name, List artifacts, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(applyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name, artifacts), serviceCallback); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable applyArtifactsAsync(String resourceGroupName, String labName, String name, List artifacts) { + return applyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name, artifacts).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> applyArtifactsWithServiceResponseAsync(String resourceGroupName, String labName, String name, List artifacts) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(artifacts); + ApplyArtifactsRequest applyArtifactsRequest = new ApplyArtifactsRequest(); + applyArtifactsRequest.withArtifacts(artifacts); + Observable> observable = service.applyArtifacts(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), applyArtifactsRequest, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginApplyArtifacts(String resourceGroupName, String labName, String name) { + beginApplyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginApplyArtifactsAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginApplyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginApplyArtifactsAsync(String resourceGroupName, String labName, String name) { + return beginApplyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginApplyArtifactsWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final List artifacts = null; + ApplyArtifactsRequest applyArtifactsRequest = new ApplyArtifactsRequest(); + applyArtifactsRequest.withArtifacts(null); + return service.beginApplyArtifacts(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), applyArtifactsRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginApplyArtifactsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginApplyArtifacts(String resourceGroupName, String labName, String name, List artifacts) { + beginApplyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name, artifacts).toBlocking().single().body(); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginApplyArtifactsAsync(String resourceGroupName, String labName, String name, List artifacts, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginApplyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name, artifacts), serviceCallback); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginApplyArtifactsAsync(String resourceGroupName, String labName, String name, List artifacts) { + return beginApplyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name, artifacts).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Apply artifacts to Lab VM. This operation can take a 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 artifacts The list of artifacts to apply. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginApplyArtifactsWithServiceResponseAsync(String resourceGroupName, String labName, String name, List artifacts) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(artifacts); + ApplyArtifactsRequest applyArtifactsRequest = new ApplyArtifactsRequest(); + applyArtifactsRequest.withArtifacts(artifacts); + return service.beginApplyArtifacts(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), applyArtifactsRequest, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginApplyArtifactsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginApplyArtifactsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Start a Lab VM. This operation can take a 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void start(String resourceGroupName, String labName, String name) { + startWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Start a Lab VM. This operation can take a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture startAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Start a Lab VM. This operation can take a 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 + * @return the observable for the request + */ + public Observable startAsync(String resourceGroupName, String labName, String name) { + return startWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Start a Lab VM. This operation can take a 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 + * @return the observable for the request + */ + public Observable> startWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.start(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Start a Lab VM. This operation can take a 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginStart(String resourceGroupName, String labName, String name) { + beginStartWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Start a Lab VM. This operation can take a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStartAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStartWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Start a Lab VM. This operation can take a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStartAsync(String resourceGroupName, String labName, String name) { + return beginStartWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Start a Lab VM. This operation can take a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStartWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStart(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStartDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Stop a Lab VM. This operation can take a 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void stop(String resourceGroupName, String labName, String name) { + stopWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Stop a Lab VM. This operation can take a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture stopAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(stopWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Stop a Lab VM. This operation can take a 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 + * @return the observable for the request + */ + public Observable stopAsync(String resourceGroupName, String labName, String name) { + return stopWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stop a Lab VM. This operation can take a 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 + * @return the observable for the request + */ + public Observable> stopWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.stop(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Stop a Lab VM. This operation can take a 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginStop(String resourceGroupName, String labName, String name) { + beginStopWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Stop a Lab VM. This operation can take a 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginStopAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginStopWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Stop a Lab VM. This operation can take a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginStopAsync(String resourceGroupName, String labName, String name) { + return beginStopWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Stop a Lab VM. This operation can take a 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginStopWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginStop(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginStopDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginStopDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List virtual machines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<LabVirtualMachineInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List virtual machines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual machines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVirtualMachineInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual machines. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabVirtualMachineInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List virtual machines. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabVirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkImpl.java new file mode 100644 index 0000000000000..ad8f262cc7842 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkImpl.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetwork; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Subnet; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.SubnetOverride; +import java.util.Map; + +class VirtualNetworkImpl extends CreatableUpdatableImpl implements VirtualNetwork, VirtualNetwork.Definition, VirtualNetwork.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + VirtualNetworkImpl(String name, DevTestLabsManager manager) { + super(name, new VirtualNetworkInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + VirtualNetworkImpl(VirtualNetworkInner inner, DevTestLabsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.name = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.labName = IdParsingUtils.getValueFromIdByName(inner.id(), "labs"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualnetworks"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualNetworksInner client = this.manager().inner().virtualNetworks(); + return client.createOrUpdateResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualNetworksInner client = this.manager().inner().virtualNetworks(); + return client.patchResourceAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualNetworksInner client = this.manager().inner().virtualNetworks(); + return client.getResourceAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List allowedSubnets() { + return this.inner().allowedSubnets(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String externalProviderResourceId() { + return this.inner().externalProviderResourceId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List subnetOverrides() { + return this.inner().subnetOverrides(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public VirtualNetworkImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public VirtualNetworkImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public VirtualNetworkImpl withAllowedSubnets(List allowedSubnets) { + this.inner().withAllowedSubnets(allowedSubnets); + return this; + } + + @Override + public VirtualNetworkImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public VirtualNetworkImpl withExternalProviderResourceId(String externalProviderResourceId) { + this.inner().withExternalProviderResourceId(externalProviderResourceId); + return this; + } + + @Override + public VirtualNetworkImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public VirtualNetworkImpl withSubnetOverrides(List subnetOverrides) { + this.inner().withSubnetOverrides(subnetOverrides); + return this; + } + + @Override + public VirtualNetworkImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkInner.java new file mode 100644 index 0000000000000..3193e44f35f10 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworkInner.java @@ -0,0 +1,153 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.Subnet; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.SubnetOverride; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * A virtual network. + */ +@JsonFlatten +public class VirtualNetworkInner extends Resource { + /** + * 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 subnet overrides of the virtual network. + */ + @JsonProperty(value = "properties.subnetOverrides") + private List subnetOverrides; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * Get the allowed subnets of the virtual network. + * + * @return the allowedSubnets value + */ + public List allowedSubnets() { + return this.allowedSubnets; + } + + /** + * Set 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 of the virtual network. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set 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 Microsoft.Network resource identifier of the virtual network. + * + * @return the externalProviderResourceId value + */ + public String externalProviderResourceId() { + return this.externalProviderResourceId; + } + + /** + * Set 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 subnet overrides of the virtual network. + * + * @return the subnetOverrides value + */ + public List subnetOverrides() { + return this.subnetOverrides; + } + + /** + * Set 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 provisioning status of the resource. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning status of the resource. + * + * @param provisioningState the provisioningState value to set + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksImpl.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksImpl.java new file mode 100644 index 0000000000000..3a5ef168943a6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetwork; + +class VirtualNetworksImpl extends WrapperImpl implements VirtualNetworks { + private final DevTestLabsManager manager; + + VirtualNetworksImpl(DevTestLabsManager manager) { + super(manager.inner().virtualNetworks()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public VirtualNetworkImpl define(String name) { + return wrapModel(name); + } + + private VirtualNetworkImpl wrapModel(VirtualNetworkInner inner) { + return new VirtualNetworkImpl(inner, manager()); + } + + private VirtualNetworkImpl wrapModel(String name) { + return new VirtualNetworkImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + VirtualNetworksInner client = this.inner(); + return client.listAsync(resourceGroupName, labName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualNetwork call(VirtualNetworkInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + VirtualNetworksInner client = this.inner(); + return client.getResourceAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(VirtualNetworkInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((VirtualNetwork)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteResourceAsync(String resourceGroupName, String labName, String name) { + VirtualNetworksInner client = this.inner(); + return client.deleteResourceAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksInner.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksInner.java new file mode 100644 index 0000000000000..f1992098fdbf0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/VirtualNetworksInner.java @@ -0,0 +1,1015 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in VirtualNetworks. + */ +public class VirtualNetworksInner { + /** The Retrofit service to perform REST calls. */ + private VirtualNetworksService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of VirtualNetworksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualNetworksInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(VirtualNetworksService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualNetworks to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualNetworksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$filter") String filter, @Query("$top") Integer top, @Query("$orderBy") String orderBy, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks getResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> getResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks createOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> createOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body VirtualNetworkInner virtualNetwork, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks beginCreateOrUpdateResource" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> beginCreateOrUpdateResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body VirtualNetworkInner virtualNetwork, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks deleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", method = "DELETE", hasBody = true) + Observable> deleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks beginDeleteResource" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", method = "DELETE", hasBody = true) + Observable> beginDeleteResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks patchResource" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> patchResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body VirtualNetworkInner virtualNetwork, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.VirtualNetworks listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualNetworkInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualNetworkInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName) { + return listWithServiceResponseAsync(resourceGroupName, labName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualNetworkInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName) { + return listSinglePageAsync(resourceGroupName, labName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualNetworkInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final Integer top = null; + final String orderBy = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualNetworkInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualNetworkInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listWithServiceResponseAsync(resourceGroupName, labName, filter, top, orderBy) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual networks. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply on the operation. + * @param top the Integer value + * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualNetworkInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + return listSinglePageAsync(resourceGroupName, labName, filter, top, orderBy) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List virtual networks. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param top the Integer value + ServiceResponse> * @param orderBy the String value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualNetworkInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String filter, final Integer top, final String orderBy) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), resourceGroupName, labName, filter, top, orderBy, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualNetworkInner object if successful. + */ + public VirtualNetworkInner getResource(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable to the VirtualNetworkInner object + */ + public Observable getResourceAsync(String resourceGroupName, String labName, String name) { + return getResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, VirtualNetworkInner>() { + @Override + public VirtualNetworkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable to the VirtualNetworkInner object + */ + public Observable> getResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualNetworkInner object if successful. + */ + public VirtualNetworkInner createOrUpdateResource(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork).toBlocking().last().body(); + } + + /** + * 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 the VirtualNetworkInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork), serviceCallback); + } + + /** + * 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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateResourceAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return createOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork).map(new Func1, VirtualNetworkInner>() { + @Override + public VirtualNetworkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (virtualNetwork == null) { + throw new IllegalArgumentException("Parameter virtualNetwork is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(virtualNetwork); + Observable> observable = service.createOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, virtualNetwork, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualNetworkInner object if successful. + */ + public VirtualNetworkInner beginCreateOrUpdateResource(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork).toBlocking().single().body(); + } + + /** + * 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 the VirtualNetworkInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork), serviceCallback); + } + + /** + * 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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable beginCreateOrUpdateResourceAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return beginCreateOrUpdateResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork).map(new Func1, VirtualNetworkInner>() { + @Override + public VirtualNetworkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable> beginCreateOrUpdateResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (virtualNetwork == null) { + throw new IllegalArgumentException("Parameter virtualNetwork is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(virtualNetwork); + return service.beginCreateOrUpdateResource(this.client.subscriptionId(), resourceGroupName, labName, name, virtualNetwork, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void deleteResource(String resourceGroupName, String labName, String name) { + deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable deleteResourceAsync(String resourceGroupName, String labName, String name) { + return deleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the observable for the request + */ + public Observable> deleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.deleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDeleteResource(String resourceGroupName, String labName, String name) { + beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * 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 serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteResourceAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteResourceAsync(String resourceGroupName, String labName, String name) { + return beginDeleteResourceWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * 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 + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDeleteResource(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Modify properties of virtual networks. + * + * @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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualNetworkInner object if successful. + */ + public VirtualNetworkInner patchResource(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork).toBlocking().single().body(); + } + + /** + * Modify properties of virtual networks. + * + * @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 the VirtualNetworkInner value + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture patchResourceAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork), serviceCallback); + } + + /** + * Modify properties of virtual networks. + * + * @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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable patchResourceAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return patchResourceWithServiceResponseAsync(resourceGroupName, labName, name, virtualNetwork).map(new Func1, VirtualNetworkInner>() { + @Override + public VirtualNetworkInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of virtual networks. + * + * @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 the VirtualNetworkInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable> patchResourceWithServiceResponseAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (labName == null) { + throw new IllegalArgumentException("Parameter labName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (virtualNetwork == null) { + throw new IllegalArgumentException("Parameter virtualNetwork is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(virtualNetwork); + return service.patchResource(this.client.subscriptionId(), resourceGroupName, labName, name, virtualNetwork, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = patchResourceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse patchResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List virtual networks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<VirtualNetworkInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List virtual networks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual networks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualNetworkInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual networks. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualNetworkInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List virtual networks. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualNetworkInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/package-info.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/package-info.java new file mode 100644 index 0000000000000..2d7e0059c27a6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for DevTestLabsClient. + * Azure DevTest Labs REST API version 2015-05-21-preview. + */ +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview.implementation; diff --git a/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/package-info.java b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/package-info.java new file mode 100644 index 0000000000000..4e6c7f531a2c2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2015_05_21_preview/src/main/java/com/microsoft/azure/management/devtestlabs/v2015_05_21_preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for DevTestLabsClient. + * Azure DevTest Labs REST API version 2015-05-21-preview. + */ +package com.microsoft.azure.management.devtestlabs.v2015_05_21_preview;