diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/pom.xml b/sdk/devtestlabs/mgmt-v2016_05_15/pom.xml new file mode 100644 index 000000000000..0ef21177527c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.devtestlabs.v2016_05_15 + + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplicableSchedule.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplicableSchedule.java new file mode 100644 index 000000000000..1c47bfaff007 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplicableSchedule.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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ApplicableScheduleInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ScheduleInner; +import java.util.Map; + +/** + * Type representing ApplicableSchedule. + */ +public interface ApplicableSchedule extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the labVmsShutdown value. + */ + ScheduleInner labVmsShutdown(); + + /** + * @return the labVmsStartup value. + */ + ScheduleInner labVmsStartup(); + + /** + * @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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplicableScheduleFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplicableScheduleFragment.java new file mode 100644 index 000000000000..375f6d2a2cae --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplicableScheduleFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Schedules applicable to a virtual machine. The schedules may have been + * defined on a VM or on lab level. + */ +@JsonFlatten +@SkipParentValidation +public class ApplicableScheduleFragment extends Resource { + /** + * The auto-shutdown schedule, if one has been set at the lab or lab + * resource level. + */ + @JsonProperty(value = "properties.labVmsShutdown") + private ScheduleFragment labVmsShutdown; + + /** + * The auto-startup schedule, if one has been set at the lab or lab + * resource level. + */ + @JsonProperty(value = "properties.labVmsStartup") + private ScheduleFragment labVmsStartup; + + /** + * Get the auto-shutdown schedule, if one has been set at the lab or lab resource level. + * + * @return the labVmsShutdown value + */ + public ScheduleFragment labVmsShutdown() { + return this.labVmsShutdown; + } + + /** + * Set the auto-shutdown schedule, if one has been set at the lab or lab resource level. + * + * @param labVmsShutdown the labVmsShutdown value to set + * @return the ApplicableScheduleFragment object itself. + */ + public ApplicableScheduleFragment withLabVmsShutdown(ScheduleFragment labVmsShutdown) { + this.labVmsShutdown = labVmsShutdown; + return this; + } + + /** + * Get the auto-startup schedule, if one has been set at the lab or lab resource level. + * + * @return the labVmsStartup value + */ + public ScheduleFragment labVmsStartup() { + return this.labVmsStartup; + } + + /** + * Set the auto-startup schedule, if one has been set at the lab or lab resource level. + * + * @param labVmsStartup the labVmsStartup value to set + * @return the ApplicableScheduleFragment object itself. + */ + public ApplicableScheduleFragment withLabVmsStartup(ScheduleFragment labVmsStartup) { + this.labVmsStartup = labVmsStartup; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplyArtifactsRequest.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ApplyArtifactsRequest.java new file mode 100644 index 000000000000..04defa4538f2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplate.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplate.java new file mode 100644 index 000000000000..b8f4a077806f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplate.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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ArmTemplateInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import org.joda.time.DateTime; +import java.util.List; +import java.util.Map; + +/** + * Type representing ArmTemplate. + */ +public interface ArmTemplate extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the contents value. + */ + Object contents(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @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 parametersValueFilesInfo value. + */ + List parametersValueFilesInfo(); + + /** + * @return the publisher value. + */ + String publisher(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplateInfo.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplateInfo.java new file mode 100644 index 000000000000..f942fbe845c8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplateParameterProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplateParameterProperties.java new file mode 100644 index 000000000000..f963e6346171 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplateParameterProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an Azure Resource Manager template parameter. + */ +public class ArmTemplateParameterProperties { + /** + * The name of the template parameter. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The value of the template parameter. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name of the template parameter. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the template parameter. + * + * @param name the name value to set + * @return the ArmTemplateParameterProperties object itself. + */ + public ArmTemplateParameterProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value of the template parameter. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value of the template parameter. + * + * @param value the value value to set + * @return the ArmTemplateParameterProperties object itself. + */ + public ArmTemplateParameterProperties withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplates.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplates.java new file mode 100644 index 000000000000..2196ec4ad5ef --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArmTemplates.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. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ArmTemplatesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ArmTemplates. + */ +public interface ArmTemplates extends HasInner { + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String artifactSourceName, String name); + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String artifactSourceName); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Artifact.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Artifact.java new file mode 100644 index 000000000000..f6a129ed75cd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Artifact.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import org.joda.time.DateTime; +import java.util.Map; + +/** + * Type representing Artifact. + */ +public interface Artifact extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @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 publisher value. + */ + String publisher(); + + /** + * @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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactDeploymentStatusProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactDeploymentStatusProperties.java new file mode 100644 index 000000000000..6c3ba6a0c6d0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactDeploymentStatusPropertiesFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactDeploymentStatusPropertiesFragment.java new file mode 100644 index 000000000000..4df624feb052 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactDeploymentStatusPropertiesFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an artifact deployment. + */ +public class ArtifactDeploymentStatusPropertiesFragment { + /** + * 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 ArtifactDeploymentStatusPropertiesFragment object itself. + */ + public ArtifactDeploymentStatusPropertiesFragment 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 ArtifactDeploymentStatusPropertiesFragment object itself. + */ + public ArtifactDeploymentStatusPropertiesFragment 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 ArtifactDeploymentStatusPropertiesFragment object itself. + */ + public ArtifactDeploymentStatusPropertiesFragment withTotalArtifacts(Integer totalArtifacts) { + this.totalArtifacts = totalArtifacts; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactInstallProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactInstallProperties.java new file mode 100644 index 000000000000..c92c5aba8bcd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactInstallProperties.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.v2016_05_15; + +import java.util.List; +import org.joda.time.DateTime; +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; + + /** + * The status of the artifact. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The status message from the deployment. + */ + @JsonProperty(value = "deploymentStatusMessage") + private String deploymentStatusMessage; + + /** + * The status message from the virtual machine extension. + */ + @JsonProperty(value = "vmExtensionStatusMessage") + private String vmExtensionStatusMessage; + + /** + * The time that the artifact starts to install on the virtual machine. + */ + @JsonProperty(value = "installTime") + private DateTime installTime; + + /** + * 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; + } + + /** + * Get the status of the artifact. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the artifact. + * + * @param status the status value to set + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the status message from the deployment. + * + * @return the deploymentStatusMessage value + */ + public String deploymentStatusMessage() { + return this.deploymentStatusMessage; + } + + /** + * Set the status message from the deployment. + * + * @param deploymentStatusMessage the deploymentStatusMessage value to set + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withDeploymentStatusMessage(String deploymentStatusMessage) { + this.deploymentStatusMessage = deploymentStatusMessage; + return this; + } + + /** + * Get the status message from the virtual machine extension. + * + * @return the vmExtensionStatusMessage value + */ + public String vmExtensionStatusMessage() { + return this.vmExtensionStatusMessage; + } + + /** + * Set the status message from the virtual machine extension. + * + * @param vmExtensionStatusMessage the vmExtensionStatusMessage value to set + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withVmExtensionStatusMessage(String vmExtensionStatusMessage) { + this.vmExtensionStatusMessage = vmExtensionStatusMessage; + return this; + } + + /** + * Get the time that the artifact starts to install on the virtual machine. + * + * @return the installTime value + */ + public DateTime installTime() { + return this.installTime; + } + + /** + * Set the time that the artifact starts to install on the virtual machine. + * + * @param installTime the installTime value to set + * @return the ArtifactInstallProperties object itself. + */ + public ArtifactInstallProperties withInstallTime(DateTime installTime) { + this.installTime = installTime; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactInstallPropertiesFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactInstallPropertiesFragment.java new file mode 100644 index 000000000000..3a94f18a401f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactInstallPropertiesFragment.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.v2016_05_15; + +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an artifact. + */ +public class ArtifactInstallPropertiesFragment { + /** + * The artifact's identifier. + */ + @JsonProperty(value = "artifactId") + private String artifactId; + + /** + * The parameters of the artifact. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /** + * The status of the artifact. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The status message from the deployment. + */ + @JsonProperty(value = "deploymentStatusMessage") + private String deploymentStatusMessage; + + /** + * The status message from the virtual machine extension. + */ + @JsonProperty(value = "vmExtensionStatusMessage") + private String vmExtensionStatusMessage; + + /** + * The time that the artifact starts to install on the virtual machine. + */ + @JsonProperty(value = "installTime") + private DateTime installTime; + + /** + * 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 ArtifactInstallPropertiesFragment object itself. + */ + public ArtifactInstallPropertiesFragment 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 ArtifactInstallPropertiesFragment object itself. + */ + public ArtifactInstallPropertiesFragment withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the status of the artifact. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the artifact. + * + * @param status the status value to set + * @return the ArtifactInstallPropertiesFragment object itself. + */ + public ArtifactInstallPropertiesFragment withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the status message from the deployment. + * + * @return the deploymentStatusMessage value + */ + public String deploymentStatusMessage() { + return this.deploymentStatusMessage; + } + + /** + * Set the status message from the deployment. + * + * @param deploymentStatusMessage the deploymentStatusMessage value to set + * @return the ArtifactInstallPropertiesFragment object itself. + */ + public ArtifactInstallPropertiesFragment withDeploymentStatusMessage(String deploymentStatusMessage) { + this.deploymentStatusMessage = deploymentStatusMessage; + return this; + } + + /** + * Get the status message from the virtual machine extension. + * + * @return the vmExtensionStatusMessage value + */ + public String vmExtensionStatusMessage() { + return this.vmExtensionStatusMessage; + } + + /** + * Set the status message from the virtual machine extension. + * + * @param vmExtensionStatusMessage the vmExtensionStatusMessage value to set + * @return the ArtifactInstallPropertiesFragment object itself. + */ + public ArtifactInstallPropertiesFragment withVmExtensionStatusMessage(String vmExtensionStatusMessage) { + this.vmExtensionStatusMessage = vmExtensionStatusMessage; + return this; + } + + /** + * Get the time that the artifact starts to install on the virtual machine. + * + * @return the installTime value + */ + public DateTime installTime() { + return this.installTime; + } + + /** + * Set the time that the artifact starts to install on the virtual machine. + * + * @param installTime the installTime value to set + * @return the ArtifactInstallPropertiesFragment object itself. + */ + public ArtifactInstallPropertiesFragment withInstallTime(DateTime installTime) { + this.installTime = installTime; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactParameterProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactParameterProperties.java new file mode 100644 index 000000000000..04dfb1b15eaa --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactParameterPropertiesFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactParameterPropertiesFragment.java new file mode 100644 index 000000000000..85f7f963b1b9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactParameterPropertiesFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an artifact parameter. + */ +public class ArtifactParameterPropertiesFragment { + /** + * 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 ArtifactParameterPropertiesFragment object itself. + */ + public ArtifactParameterPropertiesFragment 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 ArtifactParameterPropertiesFragment object itself. + */ + public ArtifactParameterPropertiesFragment withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSource.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSource.java new file mode 100644 index 000000000000..be3641a6987b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSource.java @@ -0,0 +1,443 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing ArtifactSource. + */ +public interface ArtifactSource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the armTemplateFolderPath value. + */ + String armTemplateFolderPath(); + + /** + * @return the branchRef value. + */ + String branchRef(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @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 uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the uri value. + */ + String uri(); + + /** + * The entirety of the ArtifactSource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the artifactsource definition allowing to specify ArmTemplateFolderPath. + */ + interface WithArmTemplateFolderPath { + /** + * Specifies armTemplateFolderPath. + * @param armTemplateFolderPath The folder containing Azure Resource Manager templates + * @return the next definition stage + */ + WithCreate withArmTemplateFolderPath(String armTemplateFolderPath); + } + + /** + * The stage of the artifactsource definition allowing to specify BranchRef. + */ + interface WithBranchRef { + /** + * Specifies branchRef. + * @param branchRef The artifact source's branch reference + * @return the next definition stage + */ + WithCreate withBranchRef(String branchRef); + } + + /** + * The stage of the artifactsource definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The artifact source's display name + * @return the next definition stage + */ + WithCreate withDisplayName(String displayName); + } + + /** + * The stage of the artifactsource definition allowing to specify FolderPath. + */ + interface WithFolderPath { + /** + * Specifies folderPath. + * @param folderPath The folder containing artifacts + * @return the next definition stage + */ + WithCreate withFolderPath(String folderPath); + } + + /** + * The stage of the artifactsource definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * 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 to authenticate to 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 artifact source's type. 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 Indicates if the artifact source is enabled (values: Enabled, Disabled). 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 of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the artifactsource definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the artifactsource definition allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + * @param uri The artifact source's URI + * @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.WithArmTemplateFolderPath, DefinitionStages.WithBranchRef, DefinitionStages.WithDisplayName, DefinitionStages.WithFolderPath, DefinitionStages.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithSecurityToken, DefinitionStages.WithSourceType, DefinitionStages.WithStatus, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithUri { + } + } + /** + * The template for a ArtifactSource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithArmTemplateFolderPath, UpdateStages.WithBranchRef, UpdateStages.WithDisplayName, UpdateStages.WithFolderPath, UpdateStages.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithSecurityToken, UpdateStages.WithSourceType, UpdateStages.WithStatus, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier, UpdateStages.WithUri { + } + + /** + * Grouping of ArtifactSource update stages. + */ + interface UpdateStages { + /** + * The stage of the artifactsource update allowing to specify ArmTemplateFolderPath. + */ + interface WithArmTemplateFolderPath { + /** + * Specifies armTemplateFolderPath. + * @param armTemplateFolderPath The folder containing Azure Resource Manager templates + * @return the next update stage + */ + Update withArmTemplateFolderPath(String armTemplateFolderPath); + } + + /** + * The stage of the artifactsource update allowing to specify BranchRef. + */ + interface WithBranchRef { + /** + * Specifies branchRef. + * @param branchRef The artifact source's branch reference + * @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 artifact source's display name + * @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 containing artifacts + * @return the next update stage + */ + Update withFolderPath(String folderPath); + } + + /** + * The stage of the artifactsource update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * 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 to authenticate to 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 artifact source's type. 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 Indicates if the artifact source is enabled (values: Enabled, Disabled). 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 of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the artifactsource update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the artifactsource update allowing to specify Uri. + */ + interface WithUri { + /** + * Specifies uri. + * @param uri The artifact source's URI + * @return the next update stage + */ + Update withUri(String uri); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSourceFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSourceFragment.java new file mode 100644 index 000000000000..e8bfe1ad5061 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSourceFragment.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Properties of an artifact source. + */ +@JsonFlatten +@SkipParentValidation +public class ArtifactSourceFragment extends Resource { + /** + * The artifact source's display name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The artifact source's URI. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /** + * The artifact source's type. Possible values include: 'VsoGit', 'GitHub'. + */ + @JsonProperty(value = "properties.sourceType") + private SourceControlType sourceType; + + /** + * The folder containing artifacts. + */ + @JsonProperty(value = "properties.folderPath") + private String folderPath; + + /** + * The folder containing Azure Resource Manager templates. + */ + @JsonProperty(value = "properties.armTemplateFolderPath") + private String armTemplateFolderPath; + + /** + * The artifact source's branch reference. + */ + @JsonProperty(value = "properties.branchRef") + private String branchRef; + + /** + * The security token to authenticate to the artifact source. + */ + @JsonProperty(value = "properties.securityToken") + private String securityToken; + + /** + * Indicates if the artifact source is enabled (values: Enabled, Disabled). + * 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; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the artifact source's display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the artifact source's display name. + * + * @param displayName the displayName value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the artifact source's URI. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the artifact source's URI. + * + * @param uri the uri value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the artifact source's type. Possible values include: 'VsoGit', 'GitHub'. + * + * @return the sourceType value + */ + public SourceControlType sourceType() { + return this.sourceType; + } + + /** + * Set the artifact source's type. Possible values include: 'VsoGit', 'GitHub'. + * + * @param sourceType the sourceType value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withSourceType(SourceControlType sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get the folder containing artifacts. + * + * @return the folderPath value + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Set the folder containing artifacts. + * + * @param folderPath the folderPath value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the folder containing Azure Resource Manager templates. + * + * @return the armTemplateFolderPath value + */ + public String armTemplateFolderPath() { + return this.armTemplateFolderPath; + } + + /** + * Set the folder containing Azure Resource Manager templates. + * + * @param armTemplateFolderPath the armTemplateFolderPath value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withArmTemplateFolderPath(String armTemplateFolderPath) { + this.armTemplateFolderPath = armTemplateFolderPath; + return this; + } + + /** + * Get the artifact source's branch reference. + * + * @return the branchRef value + */ + public String branchRef() { + return this.branchRef; + } + + /** + * Set the artifact source's branch reference. + * + * @param branchRef the branchRef value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withBranchRef(String branchRef) { + this.branchRef = branchRef; + return this; + } + + /** + * Get the security token to authenticate to the artifact source. + * + * @return the securityToken value + */ + public String securityToken() { + return this.securityToken; + } + + /** + * Set the security token to authenticate to the artifact source. + * + * @param securityToken the securityToken value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withSecurityToken(String securityToken) { + this.securityToken = securityToken; + return this; + } + + /** + * Get indicates if the artifact source is enabled (values: Enabled, Disabled). Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set indicates if the artifact source is enabled (values: Enabled, Disabled). Possible values include: 'Enabled', 'Disabled'. + * + * @param status the status value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment 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 ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the ArtifactSourceFragment object itself. + */ + public ArtifactSourceFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSources.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ArtifactSources.java new file mode 100644 index 000000000000..e6bf3a418bef --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name); + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Artifacts.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Artifacts.java new file mode 100644 index 000000000000..e0fdca65fedd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 Parameters for generating an ARM template for deploying artifacts. + * @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 getAsync(String resourceGroupName, String labName, String artifactSourceName, String name); + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String artifactSourceName); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/AttachDiskProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/AttachDiskProperties.java new file mode 100644 index 000000000000..95355d2c42ba --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/AttachDiskProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the disk to attach. + */ +public class AttachDiskProperties { + /** + * The resource ID of the Lab virtual machine to which the disk is + * attached. + */ + @JsonProperty(value = "leasedByLabVmId") + private String leasedByLabVmId; + + /** + * Get the resource ID of the Lab virtual machine to which the disk is attached. + * + * @return the leasedByLabVmId value + */ + public String leasedByLabVmId() { + return this.leasedByLabVmId; + } + + /** + * Set the resource ID of the Lab virtual machine to which the disk is attached. + * + * @param leasedByLabVmId the leasedByLabVmId value to set + * @return the AttachDiskProperties object itself. + */ + public AttachDiskProperties withLeasedByLabVmId(String leasedByLabVmId) { + this.leasedByLabVmId = leasedByLabVmId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/AttachNewDataDiskOptions.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/AttachNewDataDiskOptions.java new file mode 100644 index 000000000000..5768d0eae4e5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/AttachNewDataDiskOptions.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties to attach new disk to the Virtual Machine. + */ +public class AttachNewDataDiskOptions { + /** + * Size of the disk to be attached in Gibibytes. + */ + @JsonProperty(value = "diskSizeGiB") + private Integer diskSizeGiB; + + /** + * The name of the disk to be attached. + */ + @JsonProperty(value = "diskName") + private String diskName; + + /** + * The storage type for the disk (i.e. Standard, Premium). Possible values + * include: 'Standard', 'Premium'. + */ + @JsonProperty(value = "diskType") + private StorageType diskType; + + /** + * Get size of the disk to be attached in Gibibytes. + * + * @return the diskSizeGiB value + */ + public Integer diskSizeGiB() { + return this.diskSizeGiB; + } + + /** + * Set size of the disk to be attached in Gibibytes. + * + * @param diskSizeGiB the diskSizeGiB value to set + * @return the AttachNewDataDiskOptions object itself. + */ + public AttachNewDataDiskOptions withDiskSizeGiB(Integer diskSizeGiB) { + this.diskSizeGiB = diskSizeGiB; + return this; + } + + /** + * Get the name of the disk to be attached. + * + * @return the diskName value + */ + public String diskName() { + return this.diskName; + } + + /** + * Set the name of the disk to be attached. + * + * @param diskName the diskName value to set + * @return the AttachNewDataDiskOptions object itself. + */ + public AttachNewDataDiskOptions withDiskName(String diskName) { + this.diskName = diskName; + return this; + } + + /** + * Get the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium'. + * + * @return the diskType value + */ + public StorageType diskType() { + return this.diskType; + } + + /** + * Set the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium'. + * + * @param diskType the diskType value to set + * @return the AttachNewDataDiskOptions object itself. + */ + public AttachNewDataDiskOptions withDiskType(StorageType diskType) { + this.diskType = diskType; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/BulkCreationParameters.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/BulkCreationParameters.java new file mode 100644 index 000000000000..cec0e565186a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/BulkCreationParameters.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for creating multiple virtual machines as a single action. + */ +public class BulkCreationParameters { + /** + * The number of virtual machine instances to create. + */ + @JsonProperty(value = "instanceCount") + private Integer instanceCount; + + /** + * Get the number of virtual machine instances to create. + * + * @return the instanceCount value + */ + public Integer instanceCount() { + return this.instanceCount; + } + + /** + * Set the number of virtual machine instances to create. + * + * @param instanceCount the instanceCount value to set + * @return the BulkCreationParameters object itself. + */ + public BulkCreationParameters withInstanceCount(Integer instanceCount) { + this.instanceCount = instanceCount; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeDataDisk.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeDataDisk.java new file mode 100644 index 000000000000..cde8329a5adf --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeDataDisk.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A data disks attached to a virtual machine. + */ +public class ComputeDataDisk { + /** + * Gets data disk name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * When backed by a blob, the URI of underlying blob. + */ + @JsonProperty(value = "diskUri") + private String diskUri; + + /** + * When backed by managed disk, this is the ID of the compute disk + * resource. + */ + @JsonProperty(value = "managedDiskId") + private String managedDiskId; + + /** + * Gets data disk size in GiB. + */ + @JsonProperty(value = "diskSizeGiB") + private Integer diskSizeGiB; + + /** + * Get gets data disk name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set gets data disk name. + * + * @param name the name value to set + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withName(String name) { + this.name = name; + return this; + } + + /** + * Get when backed by a blob, the URI of underlying blob. + * + * @return the diskUri value + */ + public String diskUri() { + return this.diskUri; + } + + /** + * Set when backed by a blob, the URI of underlying blob. + * + * @param diskUri the diskUri value to set + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withDiskUri(String diskUri) { + this.diskUri = diskUri; + return this; + } + + /** + * Get when backed by managed disk, this is the ID of the compute disk resource. + * + * @return the managedDiskId value + */ + public String managedDiskId() { + return this.managedDiskId; + } + + /** + * Set when backed by managed disk, this is the ID of the compute disk resource. + * + * @param managedDiskId the managedDiskId value to set + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withManagedDiskId(String managedDiskId) { + this.managedDiskId = managedDiskId; + return this; + } + + /** + * Get gets data disk size in GiB. + * + * @return the diskSizeGiB value + */ + public Integer diskSizeGiB() { + return this.diskSizeGiB; + } + + /** + * Set gets data disk size in GiB. + * + * @param diskSizeGiB the diskSizeGiB value to set + * @return the ComputeDataDisk object itself. + */ + public ComputeDataDisk withDiskSizeGiB(Integer diskSizeGiB) { + this.diskSizeGiB = diskSizeGiB; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeDataDiskFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeDataDiskFragment.java new file mode 100644 index 000000000000..8a879b4b2bba --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeDataDiskFragment.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A data disks attached to a virtual machine. + */ +public class ComputeDataDiskFragment { + /** + * Gets data disk name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * When backed by a blob, the URI of underlying blob. + */ + @JsonProperty(value = "diskUri") + private String diskUri; + + /** + * When backed by managed disk, this is the ID of the compute disk + * resource. + */ + @JsonProperty(value = "managedDiskId") + private String managedDiskId; + + /** + * Gets data disk size in GiB. + */ + @JsonProperty(value = "diskSizeGiB") + private Integer diskSizeGiB; + + /** + * Get gets data disk name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set gets data disk name. + * + * @param name the name value to set + * @return the ComputeDataDiskFragment object itself. + */ + public ComputeDataDiskFragment withName(String name) { + this.name = name; + return this; + } + + /** + * Get when backed by a blob, the URI of underlying blob. + * + * @return the diskUri value + */ + public String diskUri() { + return this.diskUri; + } + + /** + * Set when backed by a blob, the URI of underlying blob. + * + * @param diskUri the diskUri value to set + * @return the ComputeDataDiskFragment object itself. + */ + public ComputeDataDiskFragment withDiskUri(String diskUri) { + this.diskUri = diskUri; + return this; + } + + /** + * Get when backed by managed disk, this is the ID of the compute disk resource. + * + * @return the managedDiskId value + */ + public String managedDiskId() { + return this.managedDiskId; + } + + /** + * Set when backed by managed disk, this is the ID of the compute disk resource. + * + * @param managedDiskId the managedDiskId value to set + * @return the ComputeDataDiskFragment object itself. + */ + public ComputeDataDiskFragment withManagedDiskId(String managedDiskId) { + this.managedDiskId = managedDiskId; + return this; + } + + /** + * Get gets data disk size in GiB. + * + * @return the diskSizeGiB value + */ + public Integer diskSizeGiB() { + return this.diskSizeGiB; + } + + /** + * Set gets data disk size in GiB. + * + * @param diskSizeGiB the diskSizeGiB value to set + * @return the ComputeDataDiskFragment object itself. + */ + public ComputeDataDiskFragment withDiskSizeGiB(Integer diskSizeGiB) { + this.diskSizeGiB = diskSizeGiB; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmInstanceViewStatus.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmInstanceViewStatus.java new file mode 100644 index 000000000000..d3719422bdef --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmInstanceViewStatus.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Status information about a virtual machine. + */ +public class ComputeVmInstanceViewStatus { + /** + * Gets the status Code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Gets the short localizable label for the status. + */ + @JsonProperty(value = "displayStatus") + private String displayStatus; + + /** + * Gets the message associated with the status. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get gets the status Code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set gets the status Code. + * + * @param code the code value to set + * @return the ComputeVmInstanceViewStatus object itself. + */ + public ComputeVmInstanceViewStatus withCode(String code) { + this.code = code; + return this; + } + + /** + * Get gets the short localizable label for the status. + * + * @return the displayStatus value + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Set gets the short localizable label for the status. + * + * @param displayStatus the displayStatus value to set + * @return the ComputeVmInstanceViewStatus object itself. + */ + public ComputeVmInstanceViewStatus withDisplayStatus(String displayStatus) { + this.displayStatus = displayStatus; + return this; + } + + /** + * Get gets the message associated with the status. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set gets the message associated with the status. + * + * @param message the message value to set + * @return the ComputeVmInstanceViewStatus object itself. + */ + public ComputeVmInstanceViewStatus withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmInstanceViewStatusFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmInstanceViewStatusFragment.java new file mode 100644 index 000000000000..5d7c2431e861 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmInstanceViewStatusFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Status information about a virtual machine. + */ +public class ComputeVmInstanceViewStatusFragment { + /** + * Gets the status Code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Gets the short localizable label for the status. + */ + @JsonProperty(value = "displayStatus") + private String displayStatus; + + /** + * Gets the message associated with the status. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get gets the status Code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set gets the status Code. + * + * @param code the code value to set + * @return the ComputeVmInstanceViewStatusFragment object itself. + */ + public ComputeVmInstanceViewStatusFragment withCode(String code) { + this.code = code; + return this; + } + + /** + * Get gets the short localizable label for the status. + * + * @return the displayStatus value + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Set gets the short localizable label for the status. + * + * @param displayStatus the displayStatus value to set + * @return the ComputeVmInstanceViewStatusFragment object itself. + */ + public ComputeVmInstanceViewStatusFragment withDisplayStatus(String displayStatus) { + this.displayStatus = displayStatus; + return this; + } + + /** + * Get gets the message associated with the status. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set gets the message associated with the status. + * + * @param message the message value to set + * @return the ComputeVmInstanceViewStatusFragment object itself. + */ + public ComputeVmInstanceViewStatusFragment withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmProperties.java new file mode 100644 index 000000000000..863cdcad6186 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmProperties.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a virtual machine returned by the Microsoft.Compute API. + */ +public class ComputeVmProperties { + /** + * Gets the statuses of the virtual machine. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Gets the OS type of the virtual machine. + */ + @JsonProperty(value = "osType") + private String osType; + + /** + * Gets the size of the virtual machine. + */ + @JsonProperty(value = "vmSize") + private String vmSize; + + /** + * Gets the network interface ID of the virtual machine. + */ + @JsonProperty(value = "networkInterfaceId") + private String networkInterfaceId; + + /** + * Gets OS disk blob uri for the virtual machine. + */ + @JsonProperty(value = "osDiskId") + private String osDiskId; + + /** + * Gets data disks blob uri for the virtual machine. + */ + @JsonProperty(value = "dataDiskIds") + private List dataDiskIds; + + /** + * Gets all data disks attached to the virtual machine. + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * Get gets the statuses of the virtual machine. + * + * @return the statuses value + */ + public List statuses() { + return this.statuses; + } + + /** + * Set gets the statuses of the virtual machine. + * + * @param statuses the statuses value to set + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Get gets the OS type of the virtual machine. + * + * @return the osType value + */ + public String osType() { + return this.osType; + } + + /** + * Set gets the OS type of the virtual machine. + * + * @param osType the osType value to set + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withOsType(String osType) { + this.osType = osType; + return this; + } + + /** + * Get gets the size of the virtual machine. + * + * @return the vmSize value + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set gets the size of the virtual machine. + * + * @param vmSize the vmSize value to set + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get gets the network interface ID of the virtual machine. + * + * @return the networkInterfaceId value + */ + public String networkInterfaceId() { + return this.networkInterfaceId; + } + + /** + * Set gets the network interface ID of the virtual machine. + * + * @param networkInterfaceId the networkInterfaceId value to set + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withNetworkInterfaceId(String networkInterfaceId) { + this.networkInterfaceId = networkInterfaceId; + return this; + } + + /** + * Get gets OS disk blob uri for the virtual machine. + * + * @return the osDiskId value + */ + public String osDiskId() { + return this.osDiskId; + } + + /** + * Set gets OS disk blob uri for the virtual machine. + * + * @param osDiskId the osDiskId value to set + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withOsDiskId(String osDiskId) { + this.osDiskId = osDiskId; + return this; + } + + /** + * Get gets data disks blob uri for the virtual machine. + * + * @return the dataDiskIds value + */ + public List dataDiskIds() { + return this.dataDiskIds; + } + + /** + * Set gets data disks blob uri for the virtual machine. + * + * @param dataDiskIds the dataDiskIds value to set + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withDataDiskIds(List dataDiskIds) { + this.dataDiskIds = dataDiskIds; + return this; + } + + /** + * Get gets all data disks attached to the virtual machine. + * + * @return the dataDisks value + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set gets all data disks attached to the virtual machine. + * + * @param dataDisks the dataDisks value to set + * @return the ComputeVmProperties object itself. + */ + public ComputeVmProperties withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmPropertiesFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmPropertiesFragment.java new file mode 100644 index 000000000000..243e8f2c6adf --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ComputeVmPropertiesFragment.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a virtual machine returned by the Microsoft.Compute API. + */ +public class ComputeVmPropertiesFragment { + /** + * Gets the statuses of the virtual machine. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Gets the OS type of the virtual machine. + */ + @JsonProperty(value = "osType") + private String osType; + + /** + * Gets the size of the virtual machine. + */ + @JsonProperty(value = "vmSize") + private String vmSize; + + /** + * Gets the network interface ID of the virtual machine. + */ + @JsonProperty(value = "networkInterfaceId") + private String networkInterfaceId; + + /** + * Gets OS disk blob uri for the virtual machine. + */ + @JsonProperty(value = "osDiskId") + private String osDiskId; + + /** + * Gets data disks blob uri for the virtual machine. + */ + @JsonProperty(value = "dataDiskIds") + private List dataDiskIds; + + /** + * Gets all data disks attached to the virtual machine. + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /** + * Get gets the statuses of the virtual machine. + * + * @return the statuses value + */ + public List statuses() { + return this.statuses; + } + + /** + * Set gets the statuses of the virtual machine. + * + * @param statuses the statuses value to set + * @return the ComputeVmPropertiesFragment object itself. + */ + public ComputeVmPropertiesFragment withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Get gets the OS type of the virtual machine. + * + * @return the osType value + */ + public String osType() { + return this.osType; + } + + /** + * Set gets the OS type of the virtual machine. + * + * @param osType the osType value to set + * @return the ComputeVmPropertiesFragment object itself. + */ + public ComputeVmPropertiesFragment withOsType(String osType) { + this.osType = osType; + return this; + } + + /** + * Get gets the size of the virtual machine. + * + * @return the vmSize value + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set gets the size of the virtual machine. + * + * @param vmSize the vmSize value to set + * @return the ComputeVmPropertiesFragment object itself. + */ + public ComputeVmPropertiesFragment withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get gets the network interface ID of the virtual machine. + * + * @return the networkInterfaceId value + */ + public String networkInterfaceId() { + return this.networkInterfaceId; + } + + /** + * Set gets the network interface ID of the virtual machine. + * + * @param networkInterfaceId the networkInterfaceId value to set + * @return the ComputeVmPropertiesFragment object itself. + */ + public ComputeVmPropertiesFragment withNetworkInterfaceId(String networkInterfaceId) { + this.networkInterfaceId = networkInterfaceId; + return this; + } + + /** + * Get gets OS disk blob uri for the virtual machine. + * + * @return the osDiskId value + */ + public String osDiskId() { + return this.osDiskId; + } + + /** + * Set gets OS disk blob uri for the virtual machine. + * + * @param osDiskId the osDiskId value to set + * @return the ComputeVmPropertiesFragment object itself. + */ + public ComputeVmPropertiesFragment withOsDiskId(String osDiskId) { + this.osDiskId = osDiskId; + return this; + } + + /** + * Get gets data disks blob uri for the virtual machine. + * + * @return the dataDiskIds value + */ + public List dataDiskIds() { + return this.dataDiskIds; + } + + /** + * Set gets data disks blob uri for the virtual machine. + * + * @param dataDiskIds the dataDiskIds value to set + * @return the ComputeVmPropertiesFragment object itself. + */ + public ComputeVmPropertiesFragment withDataDiskIds(List dataDiskIds) { + this.dataDiskIds = dataDiskIds; + return this; + } + + /** + * Get gets all data disks attached to the virtual machine. + * + * @return the dataDisks value + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set gets all data disks attached to the virtual machine. + * + * @param dataDisks the dataDisks value to set + * @return the ComputeVmPropertiesFragment object itself. + */ + public ComputeVmPropertiesFragment withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostThresholdProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostThresholdProperties.java new file mode 100644 index 000000000000..832c128cacb3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostThresholdProperties.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a cost threshold item. + */ +public class CostThresholdProperties { + /** + * The ID of the cost threshold item. + */ + @JsonProperty(value = "thresholdId") + private String thresholdId; + + /** + * The value of the percentage cost threshold. + */ + @JsonProperty(value = "percentageThreshold") + private PercentageCostThresholdProperties percentageThreshold; + + /** + * Indicates whether this threshold will be displayed on cost charts. + * Possible values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "displayOnChart") + private CostThresholdStatus displayOnChart; + + /** + * Indicates whether notifications will be sent when this threshold is + * exceeded. Possible values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "sendNotificationWhenExceeded") + private CostThresholdStatus sendNotificationWhenExceeded; + + /** + * Indicates the datetime when notifications were last sent for this + * threshold. + */ + @JsonProperty(value = "notificationSent") + private String notificationSent; + + /** + * Get the ID of the cost threshold item. + * + * @return the thresholdId value + */ + public String thresholdId() { + return this.thresholdId; + } + + /** + * Set the ID of the cost threshold item. + * + * @param thresholdId the thresholdId value to set + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withThresholdId(String thresholdId) { + this.thresholdId = thresholdId; + return this; + } + + /** + * Get the value of the percentage cost threshold. + * + * @return the percentageThreshold value + */ + public PercentageCostThresholdProperties percentageThreshold() { + return this.percentageThreshold; + } + + /** + * Set the value of the percentage cost threshold. + * + * @param percentageThreshold the percentageThreshold value to set + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withPercentageThreshold(PercentageCostThresholdProperties percentageThreshold) { + this.percentageThreshold = percentageThreshold; + return this; + } + + /** + * Get indicates whether this threshold will be displayed on cost charts. Possible values include: 'Enabled', 'Disabled'. + * + * @return the displayOnChart value + */ + public CostThresholdStatus displayOnChart() { + return this.displayOnChart; + } + + /** + * Set indicates whether this threshold will be displayed on cost charts. Possible values include: 'Enabled', 'Disabled'. + * + * @param displayOnChart the displayOnChart value to set + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withDisplayOnChart(CostThresholdStatus displayOnChart) { + this.displayOnChart = displayOnChart; + return this; + } + + /** + * Get indicates whether notifications will be sent when this threshold is exceeded. Possible values include: 'Enabled', 'Disabled'. + * + * @return the sendNotificationWhenExceeded value + */ + public CostThresholdStatus sendNotificationWhenExceeded() { + return this.sendNotificationWhenExceeded; + } + + /** + * Set indicates whether notifications will be sent when this threshold is exceeded. Possible values include: 'Enabled', 'Disabled'. + * + * @param sendNotificationWhenExceeded the sendNotificationWhenExceeded value to set + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withSendNotificationWhenExceeded(CostThresholdStatus sendNotificationWhenExceeded) { + this.sendNotificationWhenExceeded = sendNotificationWhenExceeded; + return this; + } + + /** + * Get indicates the datetime when notifications were last sent for this threshold. + * + * @return the notificationSent value + */ + public String notificationSent() { + return this.notificationSent; + } + + /** + * Set indicates the datetime when notifications were last sent for this threshold. + * + * @param notificationSent the notificationSent value to set + * @return the CostThresholdProperties object itself. + */ + public CostThresholdProperties withNotificationSent(String notificationSent) { + this.notificationSent = notificationSent; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostThresholdStatus.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostThresholdStatus.java new file mode 100644 index 000000000000..ea3113123fb6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostThresholdStatus.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CostThresholdStatus. + */ +public final class CostThresholdStatus extends ExpandableStringEnum { + /** Static value Enabled for CostThresholdStatus. */ + public static final CostThresholdStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for CostThresholdStatus. */ + public static final CostThresholdStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a CostThresholdStatus from its string representation. + * @param name a name to look for + * @return the corresponding CostThresholdStatus + */ + @JsonCreator + public static CostThresholdStatus fromString(String name) { + return fromString(name, CostThresholdStatus.class); + } + + /** + * @return known CostThresholdStatus values + */ + public static Collection values() { + return values(CostThresholdStatus.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostType.java new file mode 100644 index 000000000000..1aa0474e825f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CostType.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CostType. + */ +public final class CostType extends ExpandableStringEnum { + /** Static value Unavailable for CostType. */ + public static final CostType UNAVAILABLE = fromString("Unavailable"); + + /** Static value Reported for CostType. */ + public static final CostType REPORTED = fromString("Reported"); + + /** Static value Projected for CostType. */ + public static final CostType PROJECTED = fromString("Projected"); + + /** + * Creates or finds a CostType from its string representation. + * @param name a name to look for + * @return the corresponding CostType + */ + @JsonCreator + public static CostType fromString(String name) { + return fromString(name, CostType.class); + } + + /** + * @return known CostType values + */ + public static Collection values() { + return values(CostType.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Costs.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Costs.java new file mode 100644 index 000000000000..39febe9dface --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Costs.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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.CostsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Costs. + */ +public interface Costs extends SupportsCreating, HasInner { + /** + * 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 getAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImage.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImage.java new file mode 100644 index 000000000000..259a4f960da9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImage.java @@ -0,0 +1,356 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * 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 managedImageId value. + */ + String managedImageId(); + + /** + * @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 uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @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.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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * 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 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 Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the customimage definition allowing to specify ManagedImageId. + */ + interface WithManagedImageId { + /** + * Specifies managedImageId. + * @param managedImageId The Managed Image Id backing the custom image + * @return the next definition stage + */ + WithCreate withManagedImageId(String managedImageId); + } + + /** + * The stage of the customimage definition allowing to specify 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 of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the customimage definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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 virtual machine from which the image is to be created + * @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.WithDescription, DefinitionStages.WithLocation, DefinitionStages.WithManagedImageId, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier, 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.WithDescription, UpdateStages.WithLocation, UpdateStages.WithManagedImageId, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier, 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 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 Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the customimage update allowing to specify ManagedImageId. + */ + interface WithManagedImageId { + /** + * Specifies managedImageId. + * @param managedImageId The Managed Image Id backing the custom image + * @return the next update stage + */ + Update withManagedImageId(String managedImageId); + } + + /** + * 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 of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the customimage update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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 virtual machine from which the image is to be created + * @return the next update stage + */ + Update withVm(CustomImagePropertiesFromVm vm); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImageOsType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImageOsType.java new file mode 100644 index 000000000000..700fe6b66345 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImagePropertiesCustom.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImagePropertiesCustom.java new file mode 100644 index 000000000000..581ec7f8df27 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImagePropertiesCustom.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.v2016_05_15; + +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; + + /** + * The OS type of the custom image (i.e. Windows, Linux). Possible values + * include: 'Windows', 'Linux', 'None'. + */ + @JsonProperty(value = "osType", required = true) + private CustomImageOsType osType; + + /** + * 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; + } + + /** + * Get the OS type of the custom image (i.e. Windows, Linux). Possible values include: 'Windows', 'Linux', 'None'. + * + * @return the osType value + */ + public CustomImageOsType osType() { + return this.osType; + } + + /** + * Set the OS type of the custom image (i.e. Windows, Linux). Possible values include: 'Windows', 'Linux', 'None'. + * + * @param osType the osType value to set + * @return the CustomImagePropertiesCustom object itself. + */ + public CustomImagePropertiesCustom withOsType(CustomImageOsType osType) { + this.osType = osType; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImagePropertiesFromVm.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImagePropertiesFromVm.java new file mode 100644 index 000000000000..8b2f05c669a6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImagePropertiesFromVm.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.v2016_05_15; + +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; + + /** + * 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 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImages.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/CustomImages.java new file mode 100644 index 000000000000..b4d4adbb58e0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name); + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DataDiskProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DataDiskProperties.java new file mode 100644 index 000000000000..e69c4da11b89 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DataDiskProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request body for adding a new or existing data disk to a virtual machine. + */ +public class DataDiskProperties { + /** + * Specifies options to attach a new disk to the virtual machine. + */ + @JsonProperty(value = "attachNewDataDiskOptions") + private AttachNewDataDiskOptions attachNewDataDiskOptions; + + /** + * Specifies the existing lab disk id to attach to virtual machine. + */ + @JsonProperty(value = "existingLabDiskId") + private String existingLabDiskId; + + /** + * Caching option for a data disk (i.e. None, ReadOnly, ReadWrite). + * Possible values include: 'None', 'ReadOnly', 'ReadWrite'. + */ + @JsonProperty(value = "hostCaching") + private HostCachingOptions hostCaching; + + /** + * Get specifies options to attach a new disk to the virtual machine. + * + * @return the attachNewDataDiskOptions value + */ + public AttachNewDataDiskOptions attachNewDataDiskOptions() { + return this.attachNewDataDiskOptions; + } + + /** + * Set specifies options to attach a new disk to the virtual machine. + * + * @param attachNewDataDiskOptions the attachNewDataDiskOptions value to set + * @return the DataDiskProperties object itself. + */ + public DataDiskProperties withAttachNewDataDiskOptions(AttachNewDataDiskOptions attachNewDataDiskOptions) { + this.attachNewDataDiskOptions = attachNewDataDiskOptions; + return this; + } + + /** + * Get specifies the existing lab disk id to attach to virtual machine. + * + * @return the existingLabDiskId value + */ + public String existingLabDiskId() { + return this.existingLabDiskId; + } + + /** + * Set specifies the existing lab disk id to attach to virtual machine. + * + * @param existingLabDiskId the existingLabDiskId value to set + * @return the DataDiskProperties object itself. + */ + public DataDiskProperties withExistingLabDiskId(String existingLabDiskId) { + this.existingLabDiskId = existingLabDiskId; + return this; + } + + /** + * Get caching option for a data disk (i.e. None, ReadOnly, ReadWrite). Possible values include: 'None', 'ReadOnly', 'ReadWrite'. + * + * @return the hostCaching value + */ + public HostCachingOptions hostCaching() { + return this.hostCaching; + } + + /** + * Set caching option for a data disk (i.e. None, ReadOnly, ReadWrite). Possible values include: 'None', 'ReadOnly', 'ReadWrite'. + * + * @param hostCaching the hostCaching value to set + * @return the DataDiskProperties object itself. + */ + public DataDiskProperties withHostCaching(HostCachingOptions hostCaching) { + this.hostCaching = hostCaching; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DayDetails.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DayDetails.java new file mode 100644 index 000000000000..8969ccb57a3b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a daily schedule. + */ +public class DayDetails { + /** + * The time of day the schedule will occur. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the time of day the schedule will occur. + * + * @return the time value + */ + public String time() { + return this.time; + } + + /** + * Set the time of day the schedule will occur. + * + * @param time the time value to set + * @return the DayDetails object itself. + */ + public DayDetails withTime(String time) { + this.time = time; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DayDetailsFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DayDetailsFragment.java new file mode 100644 index 000000000000..3c3c4d4cb351 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DayDetailsFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a daily schedule. + */ +public class DayDetailsFragment { + /** + * The time of day the schedule will occur. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the time of day the schedule will occur. + * + * @return the time value + */ + public String time() { + return this.time; + } + + /** + * Set the time of day the schedule will occur. + * + * @param time the time value to set + * @return the DayDetailsFragment object itself. + */ + public DayDetailsFragment withTime(String time) { + this.time = time; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DetachDataDiskProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DetachDataDiskProperties.java new file mode 100644 index 000000000000..e672577faa83 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DetachDataDiskProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request body for detaching data disk from a virtual machine. + */ +public class DetachDataDiskProperties { + /** + * Specifies the disk resource ID to detach from virtual machine. + */ + @JsonProperty(value = "existingLabDiskId") + private String existingLabDiskId; + + /** + * Get specifies the disk resource ID to detach from virtual machine. + * + * @return the existingLabDiskId value + */ + public String existingLabDiskId() { + return this.existingLabDiskId; + } + + /** + * Set specifies the disk resource ID to detach from virtual machine. + * + * @param existingLabDiskId the existingLabDiskId value to set + * @return the DetachDataDiskProperties object itself. + */ + public DetachDataDiskProperties withExistingLabDiskId(String existingLabDiskId) { + this.existingLabDiskId = existingLabDiskId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DetachDiskProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DetachDiskProperties.java new file mode 100644 index 000000000000..f9d019ff2fc7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DetachDiskProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of the disk to detach. + */ +public class DetachDiskProperties { + /** + * The resource ID of the Lab VM to which the disk is attached. + */ + @JsonProperty(value = "leasedByLabVmId") + private String leasedByLabVmId; + + /** + * Get the resource ID of the Lab VM to which the disk is attached. + * + * @return the leasedByLabVmId value + */ + public String leasedByLabVmId() { + return this.leasedByLabVmId; + } + + /** + * Set the resource ID of the Lab VM to which the disk is attached. + * + * @param leasedByLabVmId the leasedByLabVmId value to set + * @return the DetachDiskProperties object itself. + */ + public DetachDiskProperties withLeasedByLabVmId(String leasedByLabVmId) { + this.leasedByLabVmId = leasedByLabVmId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Disk.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Disk.java new file mode 100644 index 000000000000..938fd39f83d0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Disk.java @@ -0,0 +1,415 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DiskInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing Disk. + */ +public interface Disk extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the diskBlobName value. + */ + String diskBlobName(); + + /** + * @return the diskSizeGiB value. + */ + Integer diskSizeGiB(); + + /** + * @return the diskType value. + */ + StorageType diskType(); + + /** + * @return the diskUri value. + */ + String diskUri(); + + /** + * @return the hostCaching value. + */ + String hostCaching(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the leasedByLabVmId value. + */ + String leasedByLabVmId(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the managedDiskId value. + */ + String managedDiskId(); + + /** + * @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 uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * The entirety of the Disk definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithUser, DefinitionStages.WithCreate { + } + + /** + * Grouping of Disk definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Disk definition. + */ + interface Blank extends WithUser { + } + + /** + * The stage of the disk definition allowing to specify User. + */ + interface WithUser { + /** + * Specifies resourceGroupName, labName, userName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @param userName The name of the user profile + * @return the next definition stage + */ + WithCreate withExistingUser(String resourceGroupName, String labName, String userName); + } + + /** + * The stage of the disk definition allowing to specify DiskBlobName. + */ + interface WithDiskBlobName { + /** + * Specifies diskBlobName. + * @param diskBlobName When backed by a blob, the name of the VHD blob without extension + * @return the next definition stage + */ + WithCreate withDiskBlobName(String diskBlobName); + } + + /** + * The stage of the disk definition allowing to specify DiskSizeGiB. + */ + interface WithDiskSizeGiB { + /** + * Specifies diskSizeGiB. + * @param diskSizeGiB The size of the disk in Gibibytes + * @return the next definition stage + */ + WithCreate withDiskSizeGiB(Integer diskSizeGiB); + } + + /** + * The stage of the disk definition allowing to specify DiskType. + */ + interface WithDiskType { + /** + * Specifies diskType. + * @param diskType The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + * @return the next definition stage + */ + WithCreate withDiskType(StorageType diskType); + } + + /** + * The stage of the disk definition allowing to specify DiskUri. + */ + interface WithDiskUri { + /** + * Specifies diskUri. + * @param diskUri When backed by a blob, the URI of underlying blob + * @return the next definition stage + */ + WithCreate withDiskUri(String diskUri); + } + + /** + * The stage of the disk definition allowing to specify HostCaching. + */ + interface WithHostCaching { + /** + * Specifies hostCaching. + * @param hostCaching The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite) + * @return the next definition stage + */ + WithCreate withHostCaching(String hostCaching); + } + + /** + * The stage of the disk definition allowing to specify LeasedByLabVmId. + */ + interface WithLeasedByLabVmId { + /** + * Specifies leasedByLabVmId. + * @param leasedByLabVmId The resource ID of the VM to which this disk is leased + * @return the next definition stage + */ + WithCreate withLeasedByLabVmId(String leasedByLabVmId); + } + + /** + * The stage of the disk definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the disk definition allowing to specify ManagedDiskId. + */ + interface WithManagedDiskId { + /** + * Specifies managedDiskId. + * @param managedDiskId When backed by managed disk, this is the ID of the compute disk resource + * @return the next definition stage + */ + WithCreate withManagedDiskId(String managedDiskId); + } + + /** + * The stage of the disk 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 disk definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the disk definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithDiskBlobName, DefinitionStages.WithDiskSizeGiB, DefinitionStages.WithDiskType, DefinitionStages.WithDiskUri, DefinitionStages.WithHostCaching, DefinitionStages.WithLeasedByLabVmId, DefinitionStages.WithLocation, DefinitionStages.WithManagedDiskId, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier { + } + } + /** + * The template for a Disk update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDiskBlobName, UpdateStages.WithDiskSizeGiB, UpdateStages.WithDiskType, UpdateStages.WithDiskUri, UpdateStages.WithHostCaching, UpdateStages.WithLeasedByLabVmId, UpdateStages.WithLocation, UpdateStages.WithManagedDiskId, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier { + } + + /** + * Grouping of Disk update stages. + */ + interface UpdateStages { + /** + * The stage of the disk update allowing to specify DiskBlobName. + */ + interface WithDiskBlobName { + /** + * Specifies diskBlobName. + * @param diskBlobName When backed by a blob, the name of the VHD blob without extension + * @return the next update stage + */ + Update withDiskBlobName(String diskBlobName); + } + + /** + * The stage of the disk update allowing to specify DiskSizeGiB. + */ + interface WithDiskSizeGiB { + /** + * Specifies diskSizeGiB. + * @param diskSizeGiB The size of the disk in Gibibytes + * @return the next update stage + */ + Update withDiskSizeGiB(Integer diskSizeGiB); + } + + /** + * The stage of the disk update allowing to specify DiskType. + */ + interface WithDiskType { + /** + * Specifies diskType. + * @param diskType The storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium' + * @return the next update stage + */ + Update withDiskType(StorageType diskType); + } + + /** + * The stage of the disk update allowing to specify DiskUri. + */ + interface WithDiskUri { + /** + * Specifies diskUri. + * @param diskUri When backed by a blob, the URI of underlying blob + * @return the next update stage + */ + Update withDiskUri(String diskUri); + } + + /** + * The stage of the disk update allowing to specify HostCaching. + */ + interface WithHostCaching { + /** + * Specifies hostCaching. + * @param hostCaching The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite) + * @return the next update stage + */ + Update withHostCaching(String hostCaching); + } + + /** + * The stage of the disk update allowing to specify LeasedByLabVmId. + */ + interface WithLeasedByLabVmId { + /** + * Specifies leasedByLabVmId. + * @param leasedByLabVmId The resource ID of the VM to which this disk is leased + * @return the next update stage + */ + Update withLeasedByLabVmId(String leasedByLabVmId); + } + + /** + * The stage of the disk update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the disk update allowing to specify ManagedDiskId. + */ + interface WithManagedDiskId { + /** + * Specifies managedDiskId. + * @param managedDiskId When backed by managed disk, this is the ID of the compute disk resource + * @return the next update stage + */ + Update withManagedDiskId(String managedDiskId); + } + + /** + * The stage of the disk 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 disk update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the disk update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Disks.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Disks.java new file mode 100644 index 000000000000..85966b7af9c3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Disks.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DisksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Disks. + */ +public interface Disks extends SupportsCreating, HasInner { + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable attachAsync(String resourceGroupName, String labName, String userName, String name); + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable detachAsync(String resourceGroupName, String labName, String userName, String name); + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String userName, String name); + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String userName); + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String userName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DtlEnvironment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DtlEnvironment.java new file mode 100644 index 000000000000..b0824011a52a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/DtlEnvironment.java @@ -0,0 +1,274 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DtlEnvironmentInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; + +/** + * Type representing DtlEnvironment. + */ +public interface DtlEnvironment extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the armTemplateDisplayName value. + */ + String armTemplateDisplayName(); + + /** + * @return the createdByUser value. + */ + String createdByUser(); + + /** + * @return the deploymentProperties value. + */ + EnvironmentDeploymentProperties deploymentProperties(); + + /** + * @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 resourceGroupId value. + */ + String resourceGroupId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * The entirety of the DtlEnvironment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithUser, DefinitionStages.WithCreate { + } + + /** + * Grouping of DtlEnvironment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DtlEnvironment definition. + */ + interface Blank extends WithUser { + } + + /** + * The stage of the dtlenvironment definition allowing to specify User. + */ + interface WithUser { + /** + * Specifies resourceGroupName, labName, userName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @param userName The name of the user profile + * @return the next definition stage + */ + WithCreate withExistingUser(String resourceGroupName, String labName, String userName); + } + + /** + * The stage of the dtlenvironment definition allowing to specify ArmTemplateDisplayName. + */ + interface WithArmTemplateDisplayName { + /** + * Specifies armTemplateDisplayName. + * @param armTemplateDisplayName The display name of the Azure Resource Manager template that produced the environment + * @return the next definition stage + */ + WithCreate withArmTemplateDisplayName(String armTemplateDisplayName); + } + + /** + * The stage of the dtlenvironment definition allowing to specify DeploymentProperties. + */ + interface WithDeploymentProperties { + /** + * Specifies deploymentProperties. + * @param deploymentProperties The deployment properties of the environment + * @return the next definition stage + */ + WithCreate withDeploymentProperties(EnvironmentDeploymentProperties deploymentProperties); + } + + /** + * The stage of the dtlenvironment definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the dtlenvironment 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 dtlenvironment definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the dtlenvironment definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithArmTemplateDisplayName, DefinitionStages.WithDeploymentProperties, DefinitionStages.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier { + } + } + /** + * The template for a DtlEnvironment update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithArmTemplateDisplayName, UpdateStages.WithDeploymentProperties, UpdateStages.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier { + } + + /** + * Grouping of DtlEnvironment update stages. + */ + interface UpdateStages { + /** + * The stage of the dtlenvironment update allowing to specify ArmTemplateDisplayName. + */ + interface WithArmTemplateDisplayName { + /** + * Specifies armTemplateDisplayName. + * @param armTemplateDisplayName The display name of the Azure Resource Manager template that produced the environment + * @return the next update stage + */ + Update withArmTemplateDisplayName(String armTemplateDisplayName); + } + + /** + * The stage of the dtlenvironment update allowing to specify DeploymentProperties. + */ + interface WithDeploymentProperties { + /** + * Specifies deploymentProperties. + * @param deploymentProperties The deployment properties of the environment + * @return the next update stage + */ + Update withDeploymentProperties(EnvironmentDeploymentProperties deploymentProperties); + } + + /** + * The stage of the dtlenvironment update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the dtlenvironment 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 dtlenvironment update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the dtlenvironment update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EnableStatus.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EnableStatus.java new file mode 100644 index 000000000000..0751167ec797 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EnvironmentDeploymentProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EnvironmentDeploymentProperties.java new file mode 100644 index 000000000000..dd96098659a6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EnvironmentDeploymentProperties.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an environment deployment. + */ +public class EnvironmentDeploymentProperties { + /** + * The Azure Resource Manager template's identifier. + */ + @JsonProperty(value = "armTemplateId") + private String armTemplateId; + + /** + * The parameters of the Azure Resource Manager template. + */ + @JsonProperty(value = "parameters") + private List parameters; + + /** + * Get the Azure Resource Manager template's identifier. + * + * @return the armTemplateId value + */ + public String armTemplateId() { + return this.armTemplateId; + } + + /** + * Set the Azure Resource Manager template's identifier. + * + * @param armTemplateId the armTemplateId value to set + * @return the EnvironmentDeploymentProperties object itself. + */ + public EnvironmentDeploymentProperties withArmTemplateId(String armTemplateId) { + this.armTemplateId = armTemplateId; + return this; + } + + /** + * Get the parameters of the Azure Resource Manager template. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters of the Azure Resource Manager template. + * + * @param parameters the parameters value to set + * @return the EnvironmentDeploymentProperties object itself. + */ + public EnvironmentDeploymentProperties withParameters(List parameters) { + this.parameters = parameters; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Environments.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Environments.java new file mode 100644 index 000000000000..520da110d9e1 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Environments.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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.EnvironmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Environments. + */ +public interface Environments extends SupportsCreating, HasInner { + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String userName, String name); + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String userName); + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String userName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EvaluatePoliciesProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EvaluatePoliciesProperties.java new file mode 100644 index 000000000000..7efe1e63743b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EvaluatePoliciesRequest.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EvaluatePoliciesRequest.java new file mode 100644 index 000000000000..919c0bb9eb19 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EvaluatePoliciesResponse.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EvaluatePoliciesResponse.java new file mode 100644 index 000000000000..426d8bbd842c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Event.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Event.java new file mode 100644 index 000000000000..36c9e83d1aa7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Event.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An event to be notified for. + */ +public class Event { + /** + * The event type for which this notification is enabled (i.e. + * AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + */ + @JsonProperty(value = "eventName") + private NotificationChannelEventType eventName; + + /** + * Get the event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + * + * @return the eventName value + */ + public NotificationChannelEventType eventName() { + return this.eventName; + } + + /** + * Set the event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + * + * @param eventName the eventName value to set + * @return the Event object itself. + */ + public Event withEventName(NotificationChannelEventType eventName) { + this.eventName = eventName; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EventFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EventFragment.java new file mode 100644 index 000000000000..39397104ab57 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/EventFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An event to be notified for. + */ +public class EventFragment { + /** + * The event type for which this notification is enabled (i.e. + * AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + */ + @JsonProperty(value = "eventName") + private NotificationChannelEventType eventName; + + /** + * Get the event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + * + * @return the eventName value + */ + public NotificationChannelEventType eventName() { + return this.eventName; + } + + /** + * Set the event type for which this notification is enabled (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + * + * @param eventName the eventName value to set + * @return the EventFragment object itself. + */ + public EventFragment withEventName(NotificationChannelEventType eventName) { + this.eventName = eventName; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExportResourceUsageParameters.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExportResourceUsageParameters.java new file mode 100644 index 000000000000..cb3cce01c4a3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExportResourceUsageParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters of the export operation. + */ +public class ExportResourceUsageParameters { + /** + * The blob storage absolute sas uri with write permission to the container + * which the usage data needs to be uploaded to. + */ + @JsonProperty(value = "blobStorageAbsoluteSasUri") + private String blobStorageAbsoluteSasUri; + + /** + * The start time of the usage. If not provided, usage will be reported + * since the beginning of data collection. + */ + @JsonProperty(value = "usageStartDate") + private DateTime usageStartDate; + + /** + * Get the blob storage absolute sas uri with write permission to the container which the usage data needs to be uploaded to. + * + * @return the blobStorageAbsoluteSasUri value + */ + public String blobStorageAbsoluteSasUri() { + return this.blobStorageAbsoluteSasUri; + } + + /** + * Set the blob storage absolute sas uri with write permission to the container which the usage data needs to be uploaded to. + * + * @param blobStorageAbsoluteSasUri the blobStorageAbsoluteSasUri value to set + * @return the ExportResourceUsageParameters object itself. + */ + public ExportResourceUsageParameters withBlobStorageAbsoluteSasUri(String blobStorageAbsoluteSasUri) { + this.blobStorageAbsoluteSasUri = blobStorageAbsoluteSasUri; + return this; + } + + /** + * Get the start time of the usage. If not provided, usage will be reported since the beginning of data collection. + * + * @return the usageStartDate value + */ + public DateTime usageStartDate() { + return this.usageStartDate; + } + + /** + * Set the start time of the usage. If not provided, usage will be reported since the beginning of data collection. + * + * @param usageStartDate the usageStartDate value to set + * @return the ExportResourceUsageParameters object itself. + */ + public ExportResourceUsageParameters withUsageStartDate(DateTime usageStartDate) { + this.usageStartDate = usageStartDate; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExternalSubnet.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExternalSubnet.java new file mode 100644 index 000000000000..b2fc05858bb0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExternalSubnet.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subnet information as returned by the Microsoft.Network API. + */ +public class ExternalSubnet { + /** + * Gets or sets the identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Gets or sets the name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get gets or sets the identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set gets or sets the identifier. + * + * @param id the id value to set + * @return the ExternalSubnet object itself. + */ + public ExternalSubnet withId(String id) { + this.id = id; + return this; + } + + /** + * Get gets or sets the name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set gets or sets the name. + * + * @param name the name value to set + * @return the ExternalSubnet object itself. + */ + public ExternalSubnet withName(String name) { + this.name = name; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExternalSubnetFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExternalSubnetFragment.java new file mode 100644 index 000000000000..6d57a31d9673 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ExternalSubnetFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subnet information as returned by the Microsoft.Network API. + */ +public class ExternalSubnetFragment { + /** + * Gets or sets the identifier. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Gets or sets the name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get gets or sets the identifier. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set gets or sets the identifier. + * + * @param id the id value to set + * @return the ExternalSubnetFragment object itself. + */ + public ExternalSubnetFragment withId(String id) { + this.id = id; + return this; + } + + /** + * Get gets or sets the name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set gets or sets the name. + * + * @param name the name value to set + * @return the ExternalSubnetFragment object itself. + */ + public ExternalSubnetFragment withName(String name) { + this.name = name; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/FileUploadOptions.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/FileUploadOptions.java new file mode 100644 index 000000000000..c459e56caa40 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/FileUploadOptions.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FileUploadOptions. + */ +public final class FileUploadOptions extends ExpandableStringEnum { + /** Static value UploadFilesAndGenerateSasTokens for FileUploadOptions. */ + public static final FileUploadOptions UPLOAD_FILES_AND_GENERATE_SAS_TOKENS = fromString("UploadFilesAndGenerateSasTokens"); + + /** Static value None for FileUploadOptions. */ + public static final FileUploadOptions NONE = fromString("None"); + + /** + * Creates or finds a FileUploadOptions from its string representation. + * @param name a name to look for + * @return the corresponding FileUploadOptions + */ + @JsonCreator + public static FileUploadOptions fromString(String name) { + return fromString(name, FileUploadOptions.class); + } + + /** + * @return known FileUploadOptions values + */ + public static Collection values() { + return values(FileUploadOptions.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Formula.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Formula.java new file mode 100644 index 000000000000..48954af6e617 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Formula.java @@ -0,0 +1,356 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * 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. + */ + LabVirtualMachineCreationParameter 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 uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the vm value. + */ + FormulaPropertiesFromVm vm(); + + /** + * The entirety of the Formula definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * 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 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(LabVirtualMachineCreationParameter formulaContent); + } + + /** + * The stage of the formula definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * 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 of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the formula definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithDescription, DefinitionStages.WithFormulaContent, DefinitionStages.WithLocation, DefinitionStages.WithOsType, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithVm { + } + } + /** + * The template for a Formula update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAuthor, UpdateStages.WithDescription, UpdateStages.WithFormulaContent, UpdateStages.WithLocation, UpdateStages.WithOsType, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier, 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 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(LabVirtualMachineCreationParameter formulaContent); + } + + /** + * The stage of the formula update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * 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 of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the formula update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/FormulaPropertiesFromVm.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/FormulaPropertiesFromVm.java new file mode 100644 index 000000000000..87f308316367 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Formulas.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Formulas.java new file mode 100644 index 000000000000..221d6b47cbd7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name); + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImage.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImage.java new file mode 100644 index 000000000000..3fec0b670cfd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.GalleryImageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImageReference.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImageReference.java new file mode 100644 index 000000000000..af07b7e1a947 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImageReferenceFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImageReferenceFragment.java new file mode 100644 index 000000000000..abafd0a39428 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImageReferenceFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The reference information for an Azure Marketplace image. + */ +public class GalleryImageReferenceFragment { + /** + * 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 GalleryImageReferenceFragment object itself. + */ + public GalleryImageReferenceFragment 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 GalleryImageReferenceFragment object itself. + */ + public GalleryImageReferenceFragment 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 GalleryImageReferenceFragment object itself. + */ + public GalleryImageReferenceFragment 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 GalleryImageReferenceFragment object itself. + */ + public GalleryImageReferenceFragment 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 GalleryImageReferenceFragment object itself. + */ + public GalleryImageReferenceFragment withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImages.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GalleryImages.java new file mode 100644 index 000000000000..aa55f58a78c1 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.GalleryImagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GalleryImages. + */ +public interface GalleryImages extends HasInner { + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GenerateArmTemplateRequest.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GenerateArmTemplateRequest.java new file mode 100644 index 000000000000..740e26ff0f52 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GenerateArmTemplateRequest.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.v2016_05_15; + +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; + + /** + * Options for uploading the files for the artifact. + * UploadFilesAndGenerateSasTokens is the default value. Possible values + * include: 'UploadFilesAndGenerateSasTokens', 'None'. + */ + @JsonProperty(value = "fileUploadOptions") + private FileUploadOptions fileUploadOptions; + + /** + * 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; + } + + /** + * Get options for uploading the files for the artifact. UploadFilesAndGenerateSasTokens is the default value. Possible values include: 'UploadFilesAndGenerateSasTokens', 'None'. + * + * @return the fileUploadOptions value + */ + public FileUploadOptions fileUploadOptions() { + return this.fileUploadOptions; + } + + /** + * Set options for uploading the files for the artifact. UploadFilesAndGenerateSasTokens is the default value. Possible values include: 'UploadFilesAndGenerateSasTokens', 'None'. + * + * @param fileUploadOptions the fileUploadOptions value to set + * @return the GenerateArmTemplateRequest object itself. + */ + public GenerateArmTemplateRequest withFileUploadOptions(FileUploadOptions fileUploadOptions) { + this.fileUploadOptions = fileUploadOptions; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GenerateUploadUriParameter.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GenerateUploadUriParameter.java new file mode 100644 index 000000000000..692dad74d4b9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GenerateUploadUriResponse.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GenerateUploadUriResponse.java new file mode 100644 index 000000000000..13eed6c033c9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.GenerateUploadUriResponseInner; + +/** + * Type representing GenerateUploadUriResponse. + */ +public interface GenerateUploadUriResponse extends HasInner, HasManager { + /** + * @return the uploadUri value. + */ + String uploadUri(); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GlobalSchedules.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GlobalSchedules.java new file mode 100644 index 000000000000..fcdafc829602 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/GlobalSchedules.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +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.v2016_05_15.implementation.GlobalSchedulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing GlobalSchedules. + */ +public interface GlobalSchedules extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable executeAsync(String resourceGroupName, String name); + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable retargetAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HostCachingOptions.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HostCachingOptions.java new file mode 100644 index 000000000000..6acfd8516bea --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HostCachingOptions.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HostCachingOptions. + */ +public final class HostCachingOptions extends ExpandableStringEnum { + /** Static value None for HostCachingOptions. */ + public static final HostCachingOptions NONE = fromString("None"); + + /** Static value ReadOnly for HostCachingOptions. */ + public static final HostCachingOptions READ_ONLY = fromString("ReadOnly"); + + /** Static value ReadWrite for HostCachingOptions. */ + public static final HostCachingOptions READ_WRITE = fromString("ReadWrite"); + + /** + * Creates or finds a HostCachingOptions from its string representation. + * @param name a name to look for + * @return the corresponding HostCachingOptions + */ + @JsonCreator + public static HostCachingOptions fromString(String name) { + return fromString(name, HostCachingOptions.class); + } + + /** + * @return known HostCachingOptions values + */ + public static Collection values() { + return values(HostCachingOptions.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HourDetails.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HourDetails.java new file mode 100644 index 000000000000..85c8a355fb6b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HourDetailsFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HourDetailsFragment.java new file mode 100644 index 000000000000..f8d758d765f7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HourDetailsFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an hourly schedule. + */ +public class HourDetailsFragment { + /** + * 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 HourDetailsFragment object itself. + */ + public HourDetailsFragment withMinute(Integer minute) { + this.minute = minute; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HttpStatusCode.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HttpStatusCode.java new file mode 100644 index 000000000000..ddfcec574bb2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/HttpStatusCode.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HttpStatusCode. + */ +public final class HttpStatusCode extends ExpandableStringEnum { + /** Static value Continue for HttpStatusCode. */ + public static final HttpStatusCode CONTINUE = fromString("Continue"); + + /** Static value SwitchingProtocols for HttpStatusCode. */ + public static final HttpStatusCode SWITCHING_PROTOCOLS = fromString("SwitchingProtocols"); + + /** Static value OK for HttpStatusCode. */ + public static final HttpStatusCode OK = fromString("OK"); + + /** Static value Created for HttpStatusCode. */ + public static final HttpStatusCode CREATED = fromString("Created"); + + /** Static value Accepted for HttpStatusCode. */ + public static final HttpStatusCode ACCEPTED = fromString("Accepted"); + + /** Static value NonAuthoritativeInformation for HttpStatusCode. */ + public static final HttpStatusCode NON_AUTHORITATIVE_INFORMATION = fromString("NonAuthoritativeInformation"); + + /** Static value NoContent for HttpStatusCode. */ + public static final HttpStatusCode NO_CONTENT = fromString("NoContent"); + + /** Static value ResetContent for HttpStatusCode. */ + public static final HttpStatusCode RESET_CONTENT = fromString("ResetContent"); + + /** Static value PartialContent for HttpStatusCode. */ + public static final HttpStatusCode PARTIAL_CONTENT = fromString("PartialContent"); + + /** Static value MultipleChoices for HttpStatusCode. */ + public static final HttpStatusCode MULTIPLE_CHOICES = fromString("MultipleChoices"); + + /** Static value MovedPermanently for HttpStatusCode. */ + public static final HttpStatusCode MOVED_PERMANENTLY = fromString("MovedPermanently"); + + /** Static value Redirect for HttpStatusCode. */ + public static final HttpStatusCode REDIRECT = fromString("Redirect"); + + /** Static value SeeOther for HttpStatusCode. */ + public static final HttpStatusCode SEE_OTHER = fromString("SeeOther"); + + /** Static value NotModified for HttpStatusCode. */ + public static final HttpStatusCode NOT_MODIFIED = fromString("NotModified"); + + /** Static value UseProxy for HttpStatusCode. */ + public static final HttpStatusCode USE_PROXY = fromString("UseProxy"); + + /** Static value Unused for HttpStatusCode. */ + public static final HttpStatusCode UNUSED = fromString("Unused"); + + /** Static value TemporaryRedirect for HttpStatusCode. */ + public static final HttpStatusCode TEMPORARY_REDIRECT = fromString("TemporaryRedirect"); + + /** Static value BadRequest for HttpStatusCode. */ + public static final HttpStatusCode BAD_REQUEST = fromString("BadRequest"); + + /** Static value Unauthorized for HttpStatusCode. */ + public static final HttpStatusCode UNAUTHORIZED = fromString("Unauthorized"); + + /** Static value PaymentRequired for HttpStatusCode. */ + public static final HttpStatusCode PAYMENT_REQUIRED = fromString("PaymentRequired"); + + /** Static value Forbidden for HttpStatusCode. */ + public static final HttpStatusCode FORBIDDEN = fromString("Forbidden"); + + /** Static value NotFound for HttpStatusCode. */ + public static final HttpStatusCode NOT_FOUND = fromString("NotFound"); + + /** Static value MethodNotAllowed for HttpStatusCode. */ + public static final HttpStatusCode METHOD_NOT_ALLOWED = fromString("MethodNotAllowed"); + + /** Static value NotAcceptable for HttpStatusCode. */ + public static final HttpStatusCode NOT_ACCEPTABLE = fromString("NotAcceptable"); + + /** Static value ProxyAuthenticationRequired for HttpStatusCode. */ + public static final HttpStatusCode PROXY_AUTHENTICATION_REQUIRED = fromString("ProxyAuthenticationRequired"); + + /** Static value RequestTimeout for HttpStatusCode. */ + public static final HttpStatusCode REQUEST_TIMEOUT = fromString("RequestTimeout"); + + /** Static value Conflict for HttpStatusCode. */ + public static final HttpStatusCode CONFLICT = fromString("Conflict"); + + /** Static value Gone for HttpStatusCode. */ + public static final HttpStatusCode GONE = fromString("Gone"); + + /** Static value LengthRequired for HttpStatusCode. */ + public static final HttpStatusCode LENGTH_REQUIRED = fromString("LengthRequired"); + + /** Static value PreconditionFailed for HttpStatusCode. */ + public static final HttpStatusCode PRECONDITION_FAILED = fromString("PreconditionFailed"); + + /** Static value RequestEntityTooLarge for HttpStatusCode. */ + public static final HttpStatusCode REQUEST_ENTITY_TOO_LARGE = fromString("RequestEntityTooLarge"); + + /** Static value RequestUriTooLong for HttpStatusCode. */ + public static final HttpStatusCode REQUEST_URI_TOO_LONG = fromString("RequestUriTooLong"); + + /** Static value UnsupportedMediaType for HttpStatusCode. */ + public static final HttpStatusCode UNSUPPORTED_MEDIA_TYPE = fromString("UnsupportedMediaType"); + + /** Static value RequestedRangeNotSatisfiable for HttpStatusCode. */ + public static final HttpStatusCode REQUESTED_RANGE_NOT_SATISFIABLE = fromString("RequestedRangeNotSatisfiable"); + + /** Static value ExpectationFailed for HttpStatusCode. */ + public static final HttpStatusCode EXPECTATION_FAILED = fromString("ExpectationFailed"); + + /** Static value UpgradeRequired for HttpStatusCode. */ + public static final HttpStatusCode UPGRADE_REQUIRED = fromString("UpgradeRequired"); + + /** Static value InternalServerError for HttpStatusCode. */ + public static final HttpStatusCode INTERNAL_SERVER_ERROR = fromString("InternalServerError"); + + /** Static value NotImplemented for HttpStatusCode. */ + public static final HttpStatusCode NOT_IMPLEMENTED = fromString("NotImplemented"); + + /** Static value BadGateway for HttpStatusCode. */ + public static final HttpStatusCode BAD_GATEWAY = fromString("BadGateway"); + + /** Static value ServiceUnavailable for HttpStatusCode. */ + public static final HttpStatusCode SERVICE_UNAVAILABLE = fromString("ServiceUnavailable"); + + /** Static value GatewayTimeout for HttpStatusCode. */ + public static final HttpStatusCode GATEWAY_TIMEOUT = fromString("GatewayTimeout"); + + /** Static value HttpVersionNotSupported for HttpStatusCode. */ + public static final HttpStatusCode HTTP_VERSION_NOT_SUPPORTED = fromString("HttpVersionNotSupported"); + + /** + * Creates or finds a HttpStatusCode from its string representation. + * @param name a name to look for + * @return the corresponding HttpStatusCode + */ + @JsonCreator + public static HttpStatusCode fromString(String name) { + return fromString(name, HttpStatusCode.class); + } + + /** + * @return known HttpStatusCode values + */ + public static Collection values() { + return values(HttpStatusCode.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/IdentityProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/IdentityProperties.java new file mode 100644 index 000000000000..41d3d5aed707 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/IdentityProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a managed identity. + */ +public class IdentityProperties { + /** + * Managed identity. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The principal id of resource identity. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * The tenant identifier of resource. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * The client secret URL of the identity. + */ + @JsonProperty(value = "clientSecretUrl") + private String clientSecretUrl; + + /** + * Get managed identity. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set managed identity. + * + * @param type the type value to set + * @return the IdentityProperties object itself. + */ + public IdentityProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the principal id of resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principal id of resource identity. + * + * @param principalId the principalId value to set + * @return the IdentityProperties object itself. + */ + public IdentityProperties withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the tenant identifier of resource. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenant identifier of resource. + * + * @param tenantId the tenantId value to set + * @return the IdentityProperties object itself. + */ + public IdentityProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the client secret URL of the identity. + * + * @return the clientSecretUrl value + */ + public String clientSecretUrl() { + return this.clientSecretUrl; + } + + /** + * Set the client secret URL of the identity. + * + * @param clientSecretUrl the clientSecretUrl value to set + * @return the IdentityProperties object itself. + */ + public IdentityProperties withClientSecretUrl(String clientSecretUrl) { + this.clientSecretUrl = clientSecretUrl; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/InboundNatRule.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/InboundNatRule.java new file mode 100644 index 000000000000..ac8ac40ecc14 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/InboundNatRule.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule for NAT - exposing a VM's port (backendPort) on the public IP address + * using a load balancer. + */ +public class InboundNatRule { + /** + * The transport protocol for the endpoint. Possible values include: 'Tcp', + * 'Udp'. + */ + @JsonProperty(value = "transportProtocol") + private TransportProtocol transportProtocol; + + /** + * The external endpoint port of the inbound connection. Possible values + * range between 1 and 65535, inclusive. If unspecified, a value will be + * allocated automatically. + */ + @JsonProperty(value = "frontendPort") + private Integer frontendPort; + + /** + * The port to which the external traffic will be redirected. + */ + @JsonProperty(value = "backendPort") + private Integer backendPort; + + /** + * Get the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp'. + * + * @return the transportProtocol value + */ + public TransportProtocol transportProtocol() { + return this.transportProtocol; + } + + /** + * Set the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp'. + * + * @param transportProtocol the transportProtocol value to set + * @return the InboundNatRule object itself. + */ + public InboundNatRule withTransportProtocol(TransportProtocol transportProtocol) { + this.transportProtocol = transportProtocol; + return this; + } + + /** + * Get the external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + * + * @return the frontendPort value + */ + public Integer frontendPort() { + return this.frontendPort; + } + + /** + * Set the external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + * + * @param frontendPort the frontendPort value to set + * @return the InboundNatRule object itself. + */ + public InboundNatRule withFrontendPort(Integer frontendPort) { + this.frontendPort = frontendPort; + return this; + } + + /** + * Get the port to which the external traffic will be redirected. + * + * @return the backendPort value + */ + public Integer backendPort() { + return this.backendPort; + } + + /** + * Set the port to which the external traffic will be redirected. + * + * @param backendPort the backendPort value to set + * @return the InboundNatRule object itself. + */ + public InboundNatRule withBackendPort(Integer backendPort) { + this.backendPort = backendPort; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/InboundNatRuleFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/InboundNatRuleFragment.java new file mode 100644 index 000000000000..08481ecedeaf --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/InboundNatRuleFragment.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule for NAT - exposing a VM's port (backendPort) on the public IP address + * using a load balancer. + */ +public class InboundNatRuleFragment { + /** + * The transport protocol for the endpoint. Possible values include: 'Tcp', + * 'Udp'. + */ + @JsonProperty(value = "transportProtocol") + private TransportProtocol transportProtocol; + + /** + * The external endpoint port of the inbound connection. Possible values + * range between 1 and 65535, inclusive. If unspecified, a value will be + * allocated automatically. + */ + @JsonProperty(value = "frontendPort") + private Integer frontendPort; + + /** + * The port to which the external traffic will be redirected. + */ + @JsonProperty(value = "backendPort") + private Integer backendPort; + + /** + * Get the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp'. + * + * @return the transportProtocol value + */ + public TransportProtocol transportProtocol() { + return this.transportProtocol; + } + + /** + * Set the transport protocol for the endpoint. Possible values include: 'Tcp', 'Udp'. + * + * @param transportProtocol the transportProtocol value to set + * @return the InboundNatRuleFragment object itself. + */ + public InboundNatRuleFragment withTransportProtocol(TransportProtocol transportProtocol) { + this.transportProtocol = transportProtocol; + return this; + } + + /** + * Get the external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + * + * @return the frontendPort value + */ + public Integer frontendPort() { + return this.frontendPort; + } + + /** + * Set the external endpoint port of the inbound connection. Possible values range between 1 and 65535, inclusive. If unspecified, a value will be allocated automatically. + * + * @param frontendPort the frontendPort value to set + * @return the InboundNatRuleFragment object itself. + */ + public InboundNatRuleFragment withFrontendPort(Integer frontendPort) { + this.frontendPort = frontendPort; + return this; + } + + /** + * Get the port to which the external traffic will be redirected. + * + * @return the backendPort value + */ + public Integer backendPort() { + return this.backendPort; + } + + /** + * Set the port to which the external traffic will be redirected. + * + * @param backendPort the backendPort value to set + * @return the InboundNatRuleFragment object itself. + */ + public InboundNatRuleFragment withBackendPort(Integer backendPort) { + this.backendPort = backendPort; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Lab.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Lab.java new file mode 100644 index 000000000000..a0ecd7955ddd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Lab.java @@ -0,0 +1,219 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +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.v2016_05_15.implementation.DevTestLabsManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 defaultPremiumStorageAccount value. + */ + String defaultPremiumStorageAccount(); + + /** + * @return the defaultStorageAccount value. + */ + String defaultStorageAccount(); + + /** + * @return the labStorageType value. + */ + StorageType labStorageType(); + + /** + * @return the premiumDataDisks value. + */ + PremiumDataDisk premiumDataDisks(); + + /** + * @return the premiumDataDiskStorageAccount value. + */ + String premiumDataDiskStorageAccount(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @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 LabStorageType. + */ + interface WithLabStorageType { + /** + * Specifies labStorageType. + * @param labStorageType Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + * @return the next definition stage + */ + WithCreate withLabStorageType(StorageType labStorageType); + } + + /** + * The stage of the lab definition allowing to specify PremiumDataDisks. + */ + interface WithPremiumDataDisks { + /** + * Specifies premiumDataDisks. + * @param premiumDataDisks The setting to enable usage of premium data disks. + When its value is 'Enabled', creation of standard or premium data disks is allowed. + When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'Disabled', 'Enabled' + * @return the next definition stage + */ + WithCreate withPremiumDataDisks(PremiumDataDisk premiumDataDisks); + } + + /** + * 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 UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithLabStorageType, DefinitionStages.WithPremiumDataDisks, DefinitionStages.WithProvisioningState, DefinitionStages.WithUniqueIdentifier { + } + } + /** + * The template for a Lab update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithLabStorageType, UpdateStages.WithPremiumDataDisks, UpdateStages.WithProvisioningState, UpdateStages.WithUniqueIdentifier { + } + + /** + * Grouping of Lab update stages. + */ + interface UpdateStages { + /** + * The stage of the lab update allowing to specify LabStorageType. + */ + interface WithLabStorageType { + /** + * Specifies labStorageType. + * @param labStorageType Type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium' + * @return the next update stage + */ + Update withLabStorageType(StorageType labStorageType); + } + + /** + * The stage of the lab update allowing to specify PremiumDataDisks. + */ + interface WithPremiumDataDisks { + /** + * Specifies premiumDataDisks. + * @param premiumDataDisks The setting to enable usage of premium data disks. + When its value is 'Enabled', creation of standard or premium data disks is allowed. + When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'Disabled', 'Enabled' + * @return the next update stage + */ + Update withPremiumDataDisks(PremiumDataDisk premiumDataDisks); + } + + /** + * 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 UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCost.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCost.java new file mode 100644 index 000000000000..a40867f3376e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCost.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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.LabCostInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing LabCost. + */ +public interface LabCost extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the currencyCode value. + */ + String currencyCode(); + + /** + * @return the endDateTime value. + */ + DateTime endDateTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the labCostDetails value. + */ + List labCostDetails(); + + /** + * @return the labCostSummary value. + */ + LabCostSummaryProperties labCostSummary(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the resourceCosts value. + */ + List resourceCosts(); + + /** + * @return the startDateTime value. + */ + DateTime startDateTime(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the targetCost value. + */ + TargetCostProperties targetCost(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * The entirety of the LabCost definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithCreate { + } + + /** + * Grouping of LabCost definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LabCost definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the labcost 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the labcost definition allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The creation date of the cost + * @return the next definition stage + */ + WithCreate withCreatedDate(DateTime createdDate); + } + + /** + * The stage of the labcost definition allowing to specify CurrencyCode. + */ + interface WithCurrencyCode { + /** + * Specifies currencyCode. + * @param currencyCode The currency code of the cost + * @return the next definition stage + */ + WithCreate withCurrencyCode(String currencyCode); + } + + /** + * The stage of the labcost definition allowing to specify EndDateTime. + */ + interface WithEndDateTime { + /** + * Specifies endDateTime. + * @param endDateTime The end time of the cost data + * @return the next definition stage + */ + WithCreate withEndDateTime(DateTime endDateTime); + } + + /** + * The stage of the labcost definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the labcost 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 labcost definition allowing to specify StartDateTime. + */ + interface WithStartDateTime { + /** + * Specifies startDateTime. + * @param startDateTime The start time of the cost data + * @return the next definition stage + */ + WithCreate withStartDateTime(DateTime startDateTime); + } + + /** + * The stage of the labcost definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the labcost definition allowing to specify TargetCost. + */ + interface WithTargetCost { + /** + * Specifies targetCost. + * @param targetCost The target cost properties + * @return the next definition stage + */ + WithCreate withTargetCost(TargetCostProperties targetCost); + } + + /** + * The stage of the labcost definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithCreatedDate, DefinitionStages.WithCurrencyCode, DefinitionStages.WithEndDateTime, DefinitionStages.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithStartDateTime, DefinitionStages.WithTags, DefinitionStages.WithTargetCost, DefinitionStages.WithUniqueIdentifier { + } + } + /** + * The template for a LabCost update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithCreatedDate, UpdateStages.WithCurrencyCode, UpdateStages.WithEndDateTime, UpdateStages.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithStartDateTime, UpdateStages.WithTags, UpdateStages.WithTargetCost, UpdateStages.WithUniqueIdentifier { + } + + /** + * Grouping of LabCost update stages. + */ + interface UpdateStages { + /** + * The stage of the labcost update allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The creation date of the cost + * @return the next update stage + */ + Update withCreatedDate(DateTime createdDate); + } + + /** + * The stage of the labcost update allowing to specify CurrencyCode. + */ + interface WithCurrencyCode { + /** + * Specifies currencyCode. + * @param currencyCode The currency code of the cost + * @return the next update stage + */ + Update withCurrencyCode(String currencyCode); + } + + /** + * The stage of the labcost update allowing to specify EndDateTime. + */ + interface WithEndDateTime { + /** + * Specifies endDateTime. + * @param endDateTime The end time of the cost data + * @return the next update stage + */ + Update withEndDateTime(DateTime endDateTime); + } + + /** + * The stage of the labcost update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the labcost 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 labcost update allowing to specify StartDateTime. + */ + interface WithStartDateTime { + /** + * Specifies startDateTime. + * @param startDateTime The start time of the cost data + * @return the next update stage + */ + Update withStartDateTime(DateTime startDateTime); + } + + /** + * The stage of the labcost update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the labcost update allowing to specify TargetCost. + */ + interface WithTargetCost { + /** + * Specifies targetCost. + * @param targetCost The target cost properties + * @return the next update stage + */ + Update withTargetCost(TargetCostProperties targetCost); + } + + /** + * The stage of the labcost update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCostDetailsProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCostDetailsProperties.java new file mode 100644 index 000000000000..fabb064a45a1 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCostDetailsProperties.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.v2016_05_15; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a lab cost item. + */ +public class LabCostDetailsProperties { + /** + * The date of the cost item. + */ + @JsonProperty(value = "date") + private DateTime dateProperty; + + /** + * The cost component 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 CostType 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 LabCostDetailsProperties object itself. + */ + public LabCostDetailsProperties withDateProperty(DateTime dateProperty) { + this.dateProperty = dateProperty; + return this; + } + + /** + * Get the cost component of the cost item. + * + * @return the cost value + */ + public Double cost() { + return this.cost; + } + + /** + * Set the cost component of the cost item. + * + * @param cost the cost value to set + * @return the LabCostDetailsProperties object itself. + */ + public LabCostDetailsProperties withCost(Double cost) { + this.cost = cost; + return this; + } + + /** + * Get the type of the cost. Possible values include: 'Unavailable', 'Reported', 'Projected'. + * + * @return the costType value + */ + public CostType 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 LabCostDetailsProperties object itself. + */ + public LabCostDetailsProperties withCostType(CostType costType) { + this.costType = costType; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCostSummaryProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCostSummaryProperties.java new file mode 100644 index 000000000000..d89a69306ae7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabCostSummaryProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the cost summary. + */ +public class LabCostSummaryProperties { + /** + * The cost component of the cost item. + */ + @JsonProperty(value = "estimatedLabCost") + private Double estimatedLabCost; + + /** + * Get the cost component of the cost item. + * + * @return the estimatedLabCost value + */ + public Double estimatedLabCost() { + return this.estimatedLabCost; + } + + /** + * Set the cost component of the cost item. + * + * @param estimatedLabCost the estimatedLabCost value to set + * @return the LabCostSummaryProperties object itself. + */ + public LabCostSummaryProperties withEstimatedLabCost(Double estimatedLabCost) { + this.estimatedLabCost = estimatedLabCost; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabFragment.java new file mode 100644 index 000000000000..bc0e7dfa4181 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabFragment.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A lab. + */ +@JsonFlatten +@SkipParentValidation +public class LabFragment extends Resource { + /** + * Type of storage used by the lab. It can be either Premium or Standard. + * Default is Premium. Possible values include: 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.labStorageType") + private StorageType labStorageType; + + /** + * The setting to enable usage of premium data disks. + * When its value is 'Enabled', creation of standard or premium data disks + * is allowed. + * When its value is 'Disabled', only creation of standard data disks is + * allowed. Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.premiumDataDisks") + private PremiumDataDisk premiumDataDisks; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium'. + * + * @return the labStorageType value + */ + public StorageType labStorageType() { + return this.labStorageType; + } + + /** + * Set type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium'. + * + * @param labStorageType the labStorageType value to set + * @return the LabFragment object itself. + */ + public LabFragment withLabStorageType(StorageType labStorageType) { + this.labStorageType = labStorageType; + return this; + } + + /** + * Get the setting to enable usage of premium data disks. + When its value is 'Enabled', creation of standard or premium data disks is allowed. + When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'Disabled', 'Enabled'. + * + * @return the premiumDataDisks value + */ + public PremiumDataDisk premiumDataDisks() { + return this.premiumDataDisks; + } + + /** + * Set the setting to enable usage of premium data disks. + When its value is 'Enabled', creation of standard or premium data disks is allowed. + When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'Disabled', 'Enabled'. + * + * @param premiumDataDisks the premiumDataDisks value to set + * @return the LabFragment object itself. + */ + public LabFragment withPremiumDataDisks(PremiumDataDisk premiumDataDisks) { + this.premiumDataDisks = premiumDataDisks; + 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 LabFragment object itself. + */ + public LabFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the LabFragment object itself. + */ + public LabFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabResourceCostProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabResourceCostProperties.java new file mode 100644 index 000000000000..276ce5bbf143 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabResourceCostProperties.java @@ -0,0 +1,251 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of a resource cost item. + */ +public class LabResourceCostProperties { + /** + * The name of the resource. + */ + @JsonProperty(value = "resourcename") + private String resourcename; + + /** + * The unique identifier of the resource. + */ + @JsonProperty(value = "resourceUId") + private String resourceUId; + + /** + * The cost component of the resource cost item. + */ + @JsonProperty(value = "resourceCost") + private Double resourceCost; + + /** + * The logical resource type (ex. virtualmachine, storageaccount). + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /** + * The owner of the resource (ex. janedoe@microsoft.com). + */ + @JsonProperty(value = "resourceOwner") + private String resourceOwner; + + /** + * The category of the resource (ex. Premium_LRS, Standard_DS1). + */ + @JsonProperty(value = "resourcePricingTier") + private String resourcePricingTier; + + /** + * The status of the resource (ex. Active). + */ + @JsonProperty(value = "resourceStatus") + private String resourceStatus; + + /** + * The ID of the resource. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The ID of the external resource. + */ + @JsonProperty(value = "externalResourceId") + private String externalResourceId; + + /** + * Get the name of the resource. + * + * @return the resourcename value + */ + public String resourcename() { + return this.resourcename; + } + + /** + * Set the name of the resource. + * + * @param resourcename the resourcename value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourcename(String resourcename) { + this.resourcename = resourcename; + return this; + } + + /** + * Get the unique identifier of the resource. + * + * @return the resourceUId value + */ + public String resourceUId() { + return this.resourceUId; + } + + /** + * Set the unique identifier of the resource. + * + * @param resourceUId the resourceUId value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceUId(String resourceUId) { + this.resourceUId = resourceUId; + return this; + } + + /** + * Get the cost component of the resource cost item. + * + * @return the resourceCost value + */ + public Double resourceCost() { + return this.resourceCost; + } + + /** + * Set the cost component of the resource cost item. + * + * @param resourceCost the resourceCost value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceCost(Double resourceCost) { + this.resourceCost = resourceCost; + return this; + } + + /** + * Get the logical resource type (ex. virtualmachine, storageaccount). + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the logical resource type (ex. virtualmachine, storageaccount). + * + * @param resourceType the resourceType value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the owner of the resource (ex. janedoe@microsoft.com). + * + * @return the resourceOwner value + */ + public String resourceOwner() { + return this.resourceOwner; + } + + /** + * Set the owner of the resource (ex. janedoe@microsoft.com). + * + * @param resourceOwner the resourceOwner value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceOwner(String resourceOwner) { + this.resourceOwner = resourceOwner; + return this; + } + + /** + * Get the category of the resource (ex. Premium_LRS, Standard_DS1). + * + * @return the resourcePricingTier value + */ + public String resourcePricingTier() { + return this.resourcePricingTier; + } + + /** + * Set the category of the resource (ex. Premium_LRS, Standard_DS1). + * + * @param resourcePricingTier the resourcePricingTier value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourcePricingTier(String resourcePricingTier) { + this.resourcePricingTier = resourcePricingTier; + return this; + } + + /** + * Get the status of the resource (ex. Active). + * + * @return the resourceStatus value + */ + public String resourceStatus() { + return this.resourceStatus; + } + + /** + * Set the status of the resource (ex. Active). + * + * @param resourceStatus the resourceStatus value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceStatus(String resourceStatus) { + this.resourceStatus = resourceStatus; + return this; + } + + /** + * Get the ID of the resource. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the ID of the resource. + * + * @param resourceId the resourceId value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the ID of the external resource. + * + * @return the externalResourceId value + */ + public String externalResourceId() { + return this.externalResourceId; + } + + /** + * Set the ID of the external resource. + * + * @param externalResourceId the externalResourceId value to set + * @return the LabResourceCostProperties object itself. + */ + public LabResourceCostProperties withExternalResourceId(String externalResourceId) { + this.externalResourceId = externalResourceId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabSchedule.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabSchedule.java new file mode 100644 index 000000000000..fe6e3976e2c9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabSchedule.java @@ -0,0 +1,443 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing LabSchedule. + */ +public interface LabSchedule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @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 notificationSettings value. + */ + NotificationSettings notificationSettings(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the status value. + */ + EnableStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * @return the taskType value. + */ + String taskType(); + + /** + * @return the timeZoneId value. + */ + String timeZoneId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the weeklyRecurrence value. + */ + WeekDetails weeklyRecurrence(); + + /** + * The entirety of the LabSchedule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithCreate { + } + + /** + * Grouping of LabSchedule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LabSchedule definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the labschedule 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the labschedule definition allowing to specify DailyRecurrence. + */ + interface WithDailyRecurrence { + /** + * Specifies dailyRecurrence. + * @param dailyRecurrence If the schedule will occur once each day of the week, specify the daily recurrence + * @return the next definition stage + */ + WithCreate withDailyRecurrence(DayDetails dailyRecurrence); + } + + /** + * The stage of the labschedule definition allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence If the schedule will occur multiple times a day, specify the hourly recurrence + * @return the next definition stage + */ + WithCreate withHourlyRecurrence(HourDetails hourlyRecurrence); + } + + /** + * The stage of the labschedule definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the labschedule definition allowing to specify NotificationSettings. + */ + interface WithNotificationSettings { + /** + * Specifies notificationSettings. + * @param notificationSettings Notification settings + * @return the next definition stage + */ + WithCreate withNotificationSettings(NotificationSettings notificationSettings); + } + + /** + * The stage of the labschedule 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 labschedule definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withStatus(EnableStatus status); + } + + /** + * The stage of the labschedule definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the labschedule definition allowing to specify TargetResourceId. + */ + interface WithTargetResourceId { + /** + * Specifies targetResourceId. + * @param targetResourceId The resource ID to which the schedule belongs + * @return the next definition stage + */ + WithCreate withTargetResourceId(String targetResourceId); + } + + /** + * The stage of the labschedule definition allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart) + * @return the next definition stage + */ + WithCreate withTaskType(String taskType); + } + + /** + * The stage of the labschedule definition allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone ID (e.g. Pacific Standard time) + * @return the next definition stage + */ + WithCreate withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the labschedule definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the labschedule definition allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence If the schedule will occur only some days of the week, specify the weekly recurrence + * @return the next definition stage + */ + WithCreate withWeeklyRecurrence(WeekDetails weeklyRecurrence); + } + + /** + * The stage of the 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.WithLocation, DefinitionStages.WithNotificationSettings, DefinitionStages.WithProvisioningState, DefinitionStages.WithStatus, DefinitionStages.WithTags, DefinitionStages.WithTargetResourceId, DefinitionStages.WithTaskType, DefinitionStages.WithTimeZoneId, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithWeeklyRecurrence { + } + } + /** + * The template for a LabSchedule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDailyRecurrence, UpdateStages.WithHourlyRecurrence, UpdateStages.WithLocation, UpdateStages.WithNotificationSettings, UpdateStages.WithProvisioningState, UpdateStages.WithStatus, UpdateStages.WithTags, UpdateStages.WithTargetResourceId, UpdateStages.WithTaskType, UpdateStages.WithTimeZoneId, UpdateStages.WithUniqueIdentifier, UpdateStages.WithWeeklyRecurrence { + } + + /** + * Grouping of LabSchedule update stages. + */ + interface UpdateStages { + /** + * The stage of the labschedule update allowing to specify DailyRecurrence. + */ + interface WithDailyRecurrence { + /** + * Specifies dailyRecurrence. + * @param dailyRecurrence If the schedule will occur once each day of the week, specify the daily recurrence + * @return the next update stage + */ + Update withDailyRecurrence(DayDetailsFragment dailyRecurrence); + } + + /** + * The stage of the labschedule update allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence If the schedule will occur multiple times a day, specify the hourly recurrence + * @return the next update stage + */ + Update withHourlyRecurrence(HourDetailsFragment hourlyRecurrence); + } + + /** + * The stage of the labschedule update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the labschedule update allowing to specify NotificationSettings. + */ + interface WithNotificationSettings { + /** + * Specifies notificationSettings. + * @param notificationSettings Notification settings + * @return the next update stage + */ + Update withNotificationSettings(NotificationSettingsFragment notificationSettings); + } + + /** + * The stage of the labschedule 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 labschedule update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withStatus(EnableStatus status); + } + + /** + * The stage of the labschedule update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the labschedule update allowing to specify TargetResourceId. + */ + interface WithTargetResourceId { + /** + * Specifies targetResourceId. + * @param targetResourceId The resource ID to which the schedule belongs + * @return the next update stage + */ + Update withTargetResourceId(String targetResourceId); + } + + /** + * The stage of the labschedule update allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart) + * @return the next update stage + */ + Update withTaskType(String taskType); + } + + /** + * The stage of the labschedule update allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone ID (e.g. Pacific Standard time) + * @return the next update stage + */ + Update withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the labschedule update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the labschedule update allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence If the schedule will occur only some days of the week, specify the weekly recurrence + * @return the next update stage + */ + Update withWeeklyRecurrence(WeekDetailsFragment weeklyRecurrence); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVhd.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVhd.java new file mode 100644 index 000000000000..ff367e0c34c9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.LabVhdInner; + +/** + * Type representing LabVhd. + */ +public interface LabVhd extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachine.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachine.java new file mode 100644 index 000000000000..4d252d5354c5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachine.java @@ -0,0 +1,1025 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ApplicableScheduleInner; + +/** + * Type representing LabVirtualMachine. + */ +public interface LabVirtualMachine extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the allowClaim value. + */ + Boolean allowClaim(); + + /** + * @return the applicableSchedule value. + */ + ApplicableSchedule applicableSchedule(); + + /** + * @return the artifactDeploymentStatus value. + */ + ArtifactDeploymentStatusProperties artifactDeploymentStatus(); + + /** + * @return the artifacts value. + */ + List artifacts(); + + /** + * @return the computeId value. + */ + String computeId(); + + /** + * @return the computeVm value. + */ + ComputeVmProperties computeVm(); + + /** + * @return the createdByUser value. + */ + String createdByUser(); + + /** + * @return the createdByUserId value. + */ + String createdByUserId(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the customImageId value. + */ + String customImageId(); + + /** + * @return the disallowPublicIpAddress value. + */ + Boolean disallowPublicIpAddress(); + + /** + * @return the environmentId value. + */ + String environmentId(); + + /** + * @return the expirationDate value. + */ + DateTime expirationDate(); + + /** + * @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 networkInterface value. + */ + NetworkInterfaceProperties networkInterface(); + + /** + * @return the notes value. + */ + String notes(); + + /** + * @return the osType value. + */ + String osType(); + + /** + * @return the ownerObjectId value. + */ + String ownerObjectId(); + + /** + * @return the ownerUserPrincipalName value. + */ + String ownerUserPrincipalName(); + + /** + * @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 storageType value. + */ + String storageType(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the userName value. + */ + String userName(); + + /** + * @return the virtualMachineCreationSource value. + */ + VirtualMachineCreationSource virtualMachineCreationSource(); + + /** + * The entirety of the LabVirtualMachine definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify AllowClaim. + */ + interface WithAllowClaim { + /** + * Specifies allowClaim. + * @param allowClaim Indicates whether another user can take ownership of the virtual machine + * @return the next definition stage + */ + WithCreate withAllowClaim(Boolean allowClaim); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify ApplicableSchedule. + */ + interface WithApplicableSchedule { + /** + * Specifies applicableSchedule. + * @param applicableSchedule The applicable schedule for the virtual machine + * @return the next definition stage + */ + WithCreate withApplicableSchedule(ApplicableScheduleInner applicableSchedule); + } + + /** + * 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 ComputeVm. + */ + interface WithComputeVm { + /** + * Specifies computeVm. + * @param computeVm The compute virtual machine properties + * @return the next definition stage + */ + WithCreate withComputeVm(ComputeVmProperties computeVm); + } + + /** + * 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 CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The creation date of the virtual machine + * @return the next definition stage + */ + WithCreate withCreatedDate(DateTime createdDate); + } + + /** + * 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 EnvironmentId. + */ + interface WithEnvironmentId { + /** + * Specifies environmentId. + * @param environmentId The resource ID of the environment that contains this virtual machine, if any + * @return the next definition stage + */ + WithCreate withEnvironmentId(String environmentId); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify ExpirationDate. + */ + interface WithExpirationDate { + /** + * Specifies expirationDate. + * @param expirationDate The expiration date for VM + * @return the next definition stage + */ + WithCreate withExpirationDate(DateTime expirationDate); + } + + /** + * 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 Indicates whether this virtual machine uses an SSH key for authentication + * @return the next definition stage + */ + WithCreate withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify LabSubnetName. + */ + interface WithLabSubnetName { + /** + * Specifies 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 Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify NetworkInterface. + */ + interface WithNetworkInterface { + /** + * Specifies networkInterface. + * @param networkInterface The network interface properties + * @return the next definition stage + */ + WithCreate withNetworkInterface(NetworkInterfaceProperties networkInterface); + } + + /** + * 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 OwnerUserPrincipalName. + */ + interface WithOwnerUserPrincipalName { + /** + * Specifies ownerUserPrincipalName. + * @param ownerUserPrincipalName The user principal name of the virtual machine owner + * @return the next definition stage + */ + WithCreate withOwnerUserPrincipalName(String ownerUserPrincipalName); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify 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 StorageType. + */ + interface WithStorageType { + /** + * Specifies storageType. + * @param storageType Storage type to use for virtual machine (i.e. Standard, Premium) + * @return the next definition stage + */ + WithCreate withStorageType(String storageType); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the labvirtualmachine definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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 labvirtualmachine definition allowing to specify VirtualMachineCreationSource. + */ + interface WithVirtualMachineCreationSource { + /** + * Specifies virtualMachineCreationSource. + * @param virtualMachineCreationSource Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + * @return the next definition stage + */ + WithCreate withVirtualMachineCreationSource(VirtualMachineCreationSource virtualMachineCreationSource); + } + + /** + * 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.WithAllowClaim, DefinitionStages.WithApplicableSchedule, DefinitionStages.WithArtifactDeploymentStatus, DefinitionStages.WithArtifacts, DefinitionStages.WithComputeVm, DefinitionStages.WithCreatedByUser, DefinitionStages.WithCreatedByUserId, DefinitionStages.WithCreatedDate, DefinitionStages.WithCustomImageId, DefinitionStages.WithDisallowPublicIpAddress, DefinitionStages.WithEnvironmentId, DefinitionStages.WithExpirationDate, DefinitionStages.WithFqdn, DefinitionStages.WithGalleryImageReference, DefinitionStages.WithIsAuthenticationWithSshKey, DefinitionStages.WithLabSubnetName, DefinitionStages.WithLabVirtualNetworkId, DefinitionStages.WithLocation, DefinitionStages.WithNetworkInterface, DefinitionStages.WithNotes, DefinitionStages.WithOsType, DefinitionStages.WithOwnerObjectId, DefinitionStages.WithOwnerUserPrincipalName, DefinitionStages.WithPassword, DefinitionStages.WithProvisioningState, DefinitionStages.WithSize, DefinitionStages.WithSshKey, DefinitionStages.WithStorageType, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithUserName, DefinitionStages.WithVirtualMachineCreationSource { + } + } + /** + * The template for a LabVirtualMachine update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAllowClaim, UpdateStages.WithApplicableSchedule, UpdateStages.WithArtifactDeploymentStatus, UpdateStages.WithArtifacts, UpdateStages.WithComputeVm, UpdateStages.WithCreatedByUser, UpdateStages.WithCreatedByUserId, UpdateStages.WithCreatedDate, UpdateStages.WithCustomImageId, UpdateStages.WithDisallowPublicIpAddress, UpdateStages.WithEnvironmentId, UpdateStages.WithExpirationDate, UpdateStages.WithFqdn, UpdateStages.WithGalleryImageReference, UpdateStages.WithIsAuthenticationWithSshKey, UpdateStages.WithLabSubnetName, UpdateStages.WithLabVirtualNetworkId, UpdateStages.WithLocation, UpdateStages.WithNetworkInterface, UpdateStages.WithNotes, UpdateStages.WithOsType, UpdateStages.WithOwnerObjectId, UpdateStages.WithOwnerUserPrincipalName, UpdateStages.WithPassword, UpdateStages.WithProvisioningState, UpdateStages.WithSize, UpdateStages.WithSshKey, UpdateStages.WithStorageType, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier, UpdateStages.WithUserName, UpdateStages.WithVirtualMachineCreationSource { + } + + /** + * Grouping of LabVirtualMachine update stages. + */ + interface UpdateStages { + /** + * The stage of the labvirtualmachine update allowing to specify AllowClaim. + */ + interface WithAllowClaim { + /** + * Specifies allowClaim. + * @param allowClaim Indicates whether another user can take ownership of the virtual machine + * @return the next update stage + */ + Update withAllowClaim(Boolean allowClaim); + } + + /** + * The stage of the labvirtualmachine update allowing to specify ApplicableSchedule. + */ + interface WithApplicableSchedule { + /** + * Specifies applicableSchedule. + * @param applicableSchedule The applicable schedule for the virtual machine + * @return the next update stage + */ + Update withApplicableSchedule(ApplicableScheduleFragment applicableSchedule); + } + + /** + * 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(ArtifactDeploymentStatusPropertiesFragment 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 ComputeVm. + */ + interface WithComputeVm { + /** + * Specifies computeVm. + * @param computeVm The compute virtual machine properties + * @return the next update stage + */ + Update withComputeVm(ComputeVmPropertiesFragment computeVm); + } + + /** + * 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 CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The creation date of the virtual machine + * @return the next update stage + */ + Update withCreatedDate(DateTime createdDate); + } + + /** + * 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 EnvironmentId. + */ + interface WithEnvironmentId { + /** + * Specifies environmentId. + * @param environmentId The resource ID of the environment that contains this virtual machine, if any + * @return the next update stage + */ + Update withEnvironmentId(String environmentId); + } + + /** + * The stage of the labvirtualmachine update allowing to specify ExpirationDate. + */ + interface WithExpirationDate { + /** + * Specifies expirationDate. + * @param expirationDate The expiration date for VM + * @return the next update stage + */ + Update withExpirationDate(DateTime expirationDate); + } + + /** + * 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(GalleryImageReferenceFragment galleryImageReference); + } + + /** + * The stage of the labvirtualmachine update allowing to specify IsAuthenticationWithSshKey. + */ + interface WithIsAuthenticationWithSshKey { + /** + * Specifies isAuthenticationWithSshKey. + * @param isAuthenticationWithSshKey Indicates 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 Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the labvirtualmachine update allowing to specify NetworkInterface. + */ + interface WithNetworkInterface { + /** + * Specifies networkInterface. + * @param networkInterface The network interface properties + * @return the next update stage + */ + Update withNetworkInterface(NetworkInterfacePropertiesFragment networkInterface); + } + + /** + * 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 OwnerUserPrincipalName. + */ + interface WithOwnerUserPrincipalName { + /** + * Specifies ownerUserPrincipalName. + * @param ownerUserPrincipalName The user principal name of the virtual machine owner + * @return the next update stage + */ + Update withOwnerUserPrincipalName(String ownerUserPrincipalName); + } + + /** + * 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 StorageType. + */ + interface WithStorageType { + /** + * Specifies storageType. + * @param storageType Storage type to use for virtual machine (i.e. Standard, Premium) + * @return the next update stage + */ + Update withStorageType(String storageType); + } + + /** + * The stage of the labvirtualmachine update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the labvirtualmachine update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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); + } + + /** + * The stage of the labvirtualmachine update allowing to specify VirtualMachineCreationSource. + */ + interface WithVirtualMachineCreationSource { + /** + * Specifies virtualMachineCreationSource. + * @param virtualMachineCreationSource Tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage' + * @return the next update stage + */ + Update withVirtualMachineCreationSource(VirtualMachineCreationSource virtualMachineCreationSource); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachineCreationParameter.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachineCreationParameter.java new file mode 100644 index 000000000000..9b913ddedd4c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachineCreationParameter.java @@ -0,0 +1,912 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ApplicableScheduleInner; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Properties for creating a virtual machine. + */ +@JsonFlatten +public class LabVirtualMachineCreationParameter { + /** + * The number of virtual machine instances to create. + */ + @JsonProperty(value = "properties.bulkCreationParameters") + private BulkCreationParameters bulkCreationParameters; + + /** + * The notes of the virtual machine. + */ + @JsonProperty(value = "properties.notes") + private String notes; + + /** + * The object identifier of the owner of the virtual machine. + */ + @JsonProperty(value = "properties.ownerObjectId") + private String ownerObjectId; + + /** + * The user principal name of the virtual machine owner. + */ + @JsonProperty(value = "properties.ownerUserPrincipalName") + private String ownerUserPrincipalName; + + /** + * The 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 creation date of the virtual machine. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * 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; + + /** + * Indicates whether this virtual machine uses an SSH key for + * authentication. + */ + @JsonProperty(value = "properties.isAuthenticationWithSshKey") + private Boolean isAuthenticationWithSshKey; + + /** + * The fully-qualified domain name of the virtual machine. + */ + @JsonProperty(value = "properties.fqdn") + 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 compute virtual machine properties. + */ + @JsonProperty(value = "properties.computeVm") + private ComputeVmProperties computeVm; + + /** + * The network interface properties. + */ + @JsonProperty(value = "properties.networkInterface") + private NetworkInterfaceProperties networkInterface; + + /** + * The applicable schedule for the virtual machine. + */ + @JsonProperty(value = "properties.applicableSchedule") + private ApplicableScheduleInner applicableSchedule; + + /** + * The expiration date for VM. + */ + @JsonProperty(value = "properties.expirationDate") + private DateTime expirationDate; + + /** + * Indicates whether another user can take ownership of the virtual + * machine. + */ + @JsonProperty(value = "properties.allowClaim") + private Boolean allowClaim; + + /** + * Storage type to use for virtual machine (i.e. Standard, Premium). + */ + @JsonProperty(value = "properties.storageType") + private String storageType; + + /** + * Tells source of creation of lab virtual machine. Output property only. + * Possible values include: 'FromCustomImage', 'FromGalleryImage'. + */ + @JsonProperty(value = "properties.virtualMachineCreationSource") + private VirtualMachineCreationSource virtualMachineCreationSource; + + /** + * The resource ID of the environment that contains this virtual machine, + * if any. + */ + @JsonProperty(value = "properties.environmentId") + private String environmentId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * The name of the virtual machine or environment. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The location of the new virtual machine or environment. + */ + @JsonProperty(value = "location") + private String location; + + /** + * The tags of the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the number of virtual machine instances to create. + * + * @return the bulkCreationParameters value + */ + public BulkCreationParameters bulkCreationParameters() { + return this.bulkCreationParameters; + } + + /** + * Set the number of virtual machine instances to create. + * + * @param bulkCreationParameters the bulkCreationParameters value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withBulkCreationParameters(BulkCreationParameters bulkCreationParameters) { + this.bulkCreationParameters = bulkCreationParameters; + return this; + } + + /** + * Get the notes 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withOwnerObjectId(String ownerObjectId) { + this.ownerObjectId = ownerObjectId; + return this; + } + + /** + * Get the user principal name of the virtual machine owner. + * + * @return the ownerUserPrincipalName value + */ + public String ownerUserPrincipalName() { + return this.ownerUserPrincipalName; + } + + /** + * Set the user principal name of the virtual machine owner. + * + * @param ownerUserPrincipalName the ownerUserPrincipalName value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withOwnerUserPrincipalName(String ownerUserPrincipalName) { + this.ownerUserPrincipalName = ownerUserPrincipalName; + return this; + } + + /** + * Get the 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withCreatedByUser(String createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + /** + * Get the creation date of the virtual machine. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set the creation date of the virtual machine. + * + * @param createdDate the createdDate value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withSshKey(String sshKey) { + this.sshKey = sshKey; + return this; + } + + /** + * Get indicates whether this virtual machine uses an SSH key for authentication. + * + * @return the isAuthenticationWithSshKey value + */ + public Boolean isAuthenticationWithSshKey() { + return this.isAuthenticationWithSshKey; + } + + /** + * Set indicates whether this virtual machine uses an SSH key for authentication. + * + * @param isAuthenticationWithSshKey the isAuthenticationWithSshKey value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey) { + this.isAuthenticationWithSshKey = isAuthenticationWithSshKey; + return this; + } + + /** + * Get the 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withGalleryImageReference(GalleryImageReference galleryImageReference) { + this.galleryImageReference = galleryImageReference; + return this; + } + + /** + * Get the compute virtual machine properties. + * + * @return the computeVm value + */ + public ComputeVmProperties computeVm() { + return this.computeVm; + } + + /** + * Set the compute virtual machine properties. + * + * @param computeVm the computeVm value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withComputeVm(ComputeVmProperties computeVm) { + this.computeVm = computeVm; + return this; + } + + /** + * Get the network interface properties. + * + * @return the networkInterface value + */ + public NetworkInterfaceProperties networkInterface() { + return this.networkInterface; + } + + /** + * Set the network interface properties. + * + * @param networkInterface the networkInterface value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withNetworkInterface(NetworkInterfaceProperties networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Get the applicable schedule for the virtual machine. + * + * @return the applicableSchedule value + */ + public ApplicableScheduleInner applicableSchedule() { + return this.applicableSchedule; + } + + /** + * Set the applicable schedule for the virtual machine. + * + * @param applicableSchedule the applicableSchedule value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withApplicableSchedule(ApplicableScheduleInner applicableSchedule) { + this.applicableSchedule = applicableSchedule; + return this; + } + + /** + * Get the expiration date for VM. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set the expiration date for VM. + * + * @param expirationDate the expirationDate value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withExpirationDate(DateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get indicates whether another user can take ownership of the virtual machine. + * + * @return the allowClaim value + */ + public Boolean allowClaim() { + return this.allowClaim; + } + + /** + * Set indicates whether another user can take ownership of the virtual machine. + * + * @param allowClaim the allowClaim value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withAllowClaim(Boolean allowClaim) { + this.allowClaim = allowClaim; + return this; + } + + /** + * Get storage type to use for virtual machine (i.e. Standard, Premium). + * + * @return the storageType value + */ + public String storageType() { + return this.storageType; + } + + /** + * Set storage type to use for virtual machine (i.e. Standard, Premium). + * + * @param storageType the storageType value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withStorageType(String storageType) { + this.storageType = storageType; + return this; + } + + /** + * Get tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage'. + * + * @return the virtualMachineCreationSource value + */ + public VirtualMachineCreationSource virtualMachineCreationSource() { + return this.virtualMachineCreationSource; + } + + /** + * Set tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage'. + * + * @param virtualMachineCreationSource the virtualMachineCreationSource value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withVirtualMachineCreationSource(VirtualMachineCreationSource virtualMachineCreationSource) { + this.virtualMachineCreationSource = virtualMachineCreationSource; + return this; + } + + /** + * Get the resource ID of the environment that contains this virtual machine, if any. + * + * @return the environmentId value + */ + public String environmentId() { + return this.environmentId; + } + + /** + * Set the resource ID of the environment that contains this virtual machine, if any. + * + * @param environmentId the environmentId value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withEnvironmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Get the 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 LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + + /** + * Get the name of the virtual machine or environment. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the virtual machine or environment. + * + * @param name the name value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location of the new virtual machine or environment. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the new virtual machine or environment. + * + * @param location the location value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags of the resource. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags of the resource. + * + * @param tags the tags value to set + * @return the LabVirtualMachineCreationParameter object itself. + */ + public LabVirtualMachineCreationParameter withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachineFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachineFragment.java new file mode 100644 index 000000000000..40cffbb2ed42 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LabVirtualMachineFragment.java @@ -0,0 +1,809 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A virtual machine. + */ +@JsonFlatten +@SkipParentValidation +public class LabVirtualMachineFragment 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 user principal name of the virtual machine owner. + */ + @JsonProperty(value = "properties.ownerUserPrincipalName") + private String ownerUserPrincipalName; + + /** + * The object identifier of the creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUserId") + private String createdByUserId; + + /** + * The email address of creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUser") + private String createdByUser; + + /** + * The creation date of the virtual machine. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * 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; + + /** + * Indicates whether this virtual machine uses an SSH key for + * authentication. + */ + @JsonProperty(value = "properties.isAuthenticationWithSshKey") + private Boolean isAuthenticationWithSshKey; + + /** + * The fully-qualified domain name of the virtual machine. + */ + @JsonProperty(value = "properties.fqdn") + 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 ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus; + + /** + * The Microsoft Azure Marketplace image reference of the virtual machine. + */ + @JsonProperty(value = "properties.galleryImageReference") + private GalleryImageReferenceFragment galleryImageReference; + + /** + * The compute virtual machine properties. + */ + @JsonProperty(value = "properties.computeVm") + private ComputeVmPropertiesFragment computeVm; + + /** + * The network interface properties. + */ + @JsonProperty(value = "properties.networkInterface") + private NetworkInterfacePropertiesFragment networkInterface; + + /** + * The applicable schedule for the virtual machine. + */ + @JsonProperty(value = "properties.applicableSchedule") + private ApplicableScheduleFragment applicableSchedule; + + /** + * The expiration date for VM. + */ + @JsonProperty(value = "properties.expirationDate") + private DateTime expirationDate; + + /** + * Indicates whether another user can take ownership of the virtual + * machine. + */ + @JsonProperty(value = "properties.allowClaim") + private Boolean allowClaim; + + /** + * Storage type to use for virtual machine (i.e. Standard, Premium). + */ + @JsonProperty(value = "properties.storageType") + private String storageType; + + /** + * Tells source of creation of lab virtual machine. Output property only. + * Possible values include: 'FromCustomImage', 'FromGalleryImage'. + */ + @JsonProperty(value = "properties.virtualMachineCreationSource") + private VirtualMachineCreationSource virtualMachineCreationSource; + + /** + * The resource ID of the environment that contains this virtual machine, + * if any. + */ + @JsonProperty(value = "properties.environmentId") + private String environmentId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withOwnerObjectId(String ownerObjectId) { + this.ownerObjectId = ownerObjectId; + return this; + } + + /** + * Get the user principal name of the virtual machine owner. + * + * @return the ownerUserPrincipalName value + */ + public String ownerUserPrincipalName() { + return this.ownerUserPrincipalName; + } + + /** + * Set the user principal name of the virtual machine owner. + * + * @param ownerUserPrincipalName the ownerUserPrincipalName value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withOwnerUserPrincipalName(String ownerUserPrincipalName) { + this.ownerUserPrincipalName = ownerUserPrincipalName; + 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withCreatedByUser(String createdByUser) { + this.createdByUser = createdByUser; + return this; + } + + /** + * Get the creation date of the virtual machine. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set the creation date of the virtual machine. + * + * @param createdDate the createdDate value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withSshKey(String sshKey) { + this.sshKey = sshKey; + return this; + } + + /** + * Get indicates whether this virtual machine uses an SSH key for authentication. + * + * @return the isAuthenticationWithSshKey value + */ + public Boolean isAuthenticationWithSshKey() { + return this.isAuthenticationWithSshKey; + } + + /** + * Set indicates whether this virtual machine uses an SSH key for authentication. + * + * @param isAuthenticationWithSshKey the isAuthenticationWithSshKey value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withArtifacts(List artifacts) { + this.artifacts = artifacts; + return this; + } + + /** + * Get the artifact deployment status for the virtual machine. + * + * @return the artifactDeploymentStatus value + */ + public ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus() { + return this.artifactDeploymentStatus; + } + + /** + * Set the artifact deployment status for the virtual machine. + * + * @param artifactDeploymentStatus the artifactDeploymentStatus value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withArtifactDeploymentStatus(ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus) { + this.artifactDeploymentStatus = artifactDeploymentStatus; + return this; + } + + /** + * Get the Microsoft Azure Marketplace image reference of the virtual machine. + * + * @return the galleryImageReference value + */ + public GalleryImageReferenceFragment galleryImageReference() { + return this.galleryImageReference; + } + + /** + * Set the Microsoft Azure Marketplace image reference of the virtual machine. + * + * @param galleryImageReference the galleryImageReference value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withGalleryImageReference(GalleryImageReferenceFragment galleryImageReference) { + this.galleryImageReference = galleryImageReference; + return this; + } + + /** + * Get the compute virtual machine properties. + * + * @return the computeVm value + */ + public ComputeVmPropertiesFragment computeVm() { + return this.computeVm; + } + + /** + * Set the compute virtual machine properties. + * + * @param computeVm the computeVm value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withComputeVm(ComputeVmPropertiesFragment computeVm) { + this.computeVm = computeVm; + return this; + } + + /** + * Get the network interface properties. + * + * @return the networkInterface value + */ + public NetworkInterfacePropertiesFragment networkInterface() { + return this.networkInterface; + } + + /** + * Set the network interface properties. + * + * @param networkInterface the networkInterface value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withNetworkInterface(NetworkInterfacePropertiesFragment networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Get the applicable schedule for the virtual machine. + * + * @return the applicableSchedule value + */ + public ApplicableScheduleFragment applicableSchedule() { + return this.applicableSchedule; + } + + /** + * Set the applicable schedule for the virtual machine. + * + * @param applicableSchedule the applicableSchedule value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withApplicableSchedule(ApplicableScheduleFragment applicableSchedule) { + this.applicableSchedule = applicableSchedule; + return this; + } + + /** + * Get the expiration date for VM. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set the expiration date for VM. + * + * @param expirationDate the expirationDate value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withExpirationDate(DateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get indicates whether another user can take ownership of the virtual machine. + * + * @return the allowClaim value + */ + public Boolean allowClaim() { + return this.allowClaim; + } + + /** + * Set indicates whether another user can take ownership of the virtual machine. + * + * @param allowClaim the allowClaim value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withAllowClaim(Boolean allowClaim) { + this.allowClaim = allowClaim; + return this; + } + + /** + * Get storage type to use for virtual machine (i.e. Standard, Premium). + * + * @return the storageType value + */ + public String storageType() { + return this.storageType; + } + + /** + * Set storage type to use for virtual machine (i.e. Standard, Premium). + * + * @param storageType the storageType value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withStorageType(String storageType) { + this.storageType = storageType; + return this; + } + + /** + * Get tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage'. + * + * @return the virtualMachineCreationSource value + */ + public VirtualMachineCreationSource virtualMachineCreationSource() { + return this.virtualMachineCreationSource; + } + + /** + * Set tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage'. + * + * @param virtualMachineCreationSource the virtualMachineCreationSource value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withVirtualMachineCreationSource(VirtualMachineCreationSource virtualMachineCreationSource) { + this.virtualMachineCreationSource = virtualMachineCreationSource; + return this; + } + + /** + * Get the resource ID of the environment that contains this virtual machine, if any. + * + * @return the environmentId value + */ + public String environmentId() { + return this.environmentId; + } + + /** + * Set the resource ID of the environment that contains this virtual machine, if any. + * + * @param environmentId the environmentId value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withEnvironmentId(String environmentId) { + this.environmentId = environmentId; + 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 LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the LabVirtualMachineFragment object itself. + */ + public LabVirtualMachineFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Labs.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Labs.java new file mode 100644 index 000000000000..c89d21beb6d3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Labs.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.v2016_05_15; + +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.v2016_05_15.implementation.LabsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Labs. + */ +public interface Labs extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable claimAnyVmAsync(String resourceGroupName, String name); + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter); + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable exportResourceUsageAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters); + + /** + * 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LinuxOsInfo.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LinuxOsInfo.java new file mode 100644 index 000000000000..b28411d46dce --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LinuxOsInfo.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a Linux OS. + */ +public class LinuxOsInfo { + /** + * The state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, + * DeprovisionApplied). Possible values include: 'NonDeprovisioned', + * 'DeprovisionRequested', 'DeprovisionApplied'. + */ + @JsonProperty(value = "linuxOsState") + private LinuxOsState linuxOsState; + + /** + * Get the state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). Possible values include: 'NonDeprovisioned', 'DeprovisionRequested', 'DeprovisionApplied'. + * + * @return the linuxOsState value + */ + public LinuxOsState linuxOsState() { + return this.linuxOsState; + } + + /** + * Set the state of the Linux OS (i.e. NonDeprovisioned, DeprovisionRequested, DeprovisionApplied). 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LinuxOsState.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/LinuxOsState.java new file mode 100644 index 000000000000..f84bfbae4a91 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NetworkInterfaceProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NetworkInterfaceProperties.java new file mode 100644 index 000000000000..c70711c06b7e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NetworkInterfaceProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a network interface. + */ +public class NetworkInterfaceProperties { + /** + * The resource ID of the virtual network. + */ + @JsonProperty(value = "virtualNetworkId") + private String virtualNetworkId; + + /** + * The resource ID of the sub net. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /** + * The resource ID of the public IP address. + */ + @JsonProperty(value = "publicIpAddressId") + private String publicIpAddressId; + + /** + * The public IP address. + */ + @JsonProperty(value = "publicIpAddress") + private String publicIpAddress; + + /** + * The private IP address. + */ + @JsonProperty(value = "privateIpAddress") + private String privateIpAddress; + + /** + * The DNS name. + */ + @JsonProperty(value = "dnsName") + private String dnsName; + + /** + * The RdpAuthority property is a server DNS host name or IP address + * followed by the service port number for RDP (Remote Desktop Protocol). + */ + @JsonProperty(value = "rdpAuthority") + private String rdpAuthority; + + /** + * The SshAuthority property is a server DNS host name or IP address + * followed by the service port number for SSH. + */ + @JsonProperty(value = "sshAuthority") + private String sshAuthority; + + /** + * The configuration for sharing a public IP address across multiple + * virtual machines. + */ + @JsonProperty(value = "sharedPublicIpAddressConfiguration") + private SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration; + + /** + * Get the resource ID of the virtual network. + * + * @return the virtualNetworkId value + */ + public String virtualNetworkId() { + return this.virtualNetworkId; + } + + /** + * Set the resource ID of the virtual network. + * + * @param virtualNetworkId the virtualNetworkId value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withVirtualNetworkId(String virtualNetworkId) { + this.virtualNetworkId = virtualNetworkId; + return this; + } + + /** + * Get the resource ID of the sub net. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the resource ID of the sub net. + * + * @param subnetId the subnetId value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the resource ID of the public IP address. + * + * @return the publicIpAddressId value + */ + public String publicIpAddressId() { + return this.publicIpAddressId; + } + + /** + * Set the resource ID of the public IP address. + * + * @param publicIpAddressId the publicIpAddressId value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withPublicIpAddressId(String publicIpAddressId) { + this.publicIpAddressId = publicIpAddressId; + return this; + } + + /** + * Get the public IP address. + * + * @return the publicIpAddress value + */ + public String publicIpAddress() { + return this.publicIpAddress; + } + + /** + * Set the public IP address. + * + * @param publicIpAddress the publicIpAddress value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withPublicIpAddress(String publicIpAddress) { + this.publicIpAddress = publicIpAddress; + return this; + } + + /** + * Get the private IP address. + * + * @return the privateIpAddress value + */ + public String privateIpAddress() { + return this.privateIpAddress; + } + + /** + * Set the private IP address. + * + * @param privateIpAddress the privateIpAddress value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withPrivateIpAddress(String privateIpAddress) { + this.privateIpAddress = privateIpAddress; + return this; + } + + /** + * Get the DNS name. + * + * @return the dnsName value + */ + public String dnsName() { + return this.dnsName; + } + + /** + * Set the DNS name. + * + * @param dnsName the dnsName value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withDnsName(String dnsName) { + this.dnsName = dnsName; + return this; + } + + /** + * Get the RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). + * + * @return the rdpAuthority value + */ + public String rdpAuthority() { + return this.rdpAuthority; + } + + /** + * Set the RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). + * + * @param rdpAuthority the rdpAuthority value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withRdpAuthority(String rdpAuthority) { + this.rdpAuthority = rdpAuthority; + return this; + } + + /** + * Get the SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. + * + * @return the sshAuthority value + */ + public String sshAuthority() { + return this.sshAuthority; + } + + /** + * Set the SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. + * + * @param sshAuthority the sshAuthority value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withSshAuthority(String sshAuthority) { + this.sshAuthority = sshAuthority; + return this; + } + + /** + * Get the configuration for sharing a public IP address across multiple virtual machines. + * + * @return the sharedPublicIpAddressConfiguration value + */ + public SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration() { + return this.sharedPublicIpAddressConfiguration; + } + + /** + * Set the configuration for sharing a public IP address across multiple virtual machines. + * + * @param sharedPublicIpAddressConfiguration the sharedPublicIpAddressConfiguration value to set + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withSharedPublicIpAddressConfiguration(SharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration) { + this.sharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NetworkInterfacePropertiesFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NetworkInterfacePropertiesFragment.java new file mode 100644 index 000000000000..e1d74bbe9d6c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NetworkInterfacePropertiesFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a network interface. + */ +public class NetworkInterfacePropertiesFragment { + /** + * The resource ID of the virtual network. + */ + @JsonProperty(value = "virtualNetworkId") + private String virtualNetworkId; + + /** + * The resource ID of the sub net. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /** + * The resource ID of the public IP address. + */ + @JsonProperty(value = "publicIpAddressId") + private String publicIpAddressId; + + /** + * The public IP address. + */ + @JsonProperty(value = "publicIpAddress") + private String publicIpAddress; + + /** + * The private IP address. + */ + @JsonProperty(value = "privateIpAddress") + private String privateIpAddress; + + /** + * The DNS name. + */ + @JsonProperty(value = "dnsName") + private String dnsName; + + /** + * The RdpAuthority property is a server DNS host name or IP address + * followed by the service port number for RDP (Remote Desktop Protocol). + */ + @JsonProperty(value = "rdpAuthority") + private String rdpAuthority; + + /** + * The SshAuthority property is a server DNS host name or IP address + * followed by the service port number for SSH. + */ + @JsonProperty(value = "sshAuthority") + private String sshAuthority; + + /** + * The configuration for sharing a public IP address across multiple + * virtual machines. + */ + @JsonProperty(value = "sharedPublicIpAddressConfiguration") + private SharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration; + + /** + * Get the resource ID of the virtual network. + * + * @return the virtualNetworkId value + */ + public String virtualNetworkId() { + return this.virtualNetworkId; + } + + /** + * Set the resource ID of the virtual network. + * + * @param virtualNetworkId the virtualNetworkId value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withVirtualNetworkId(String virtualNetworkId) { + this.virtualNetworkId = virtualNetworkId; + return this; + } + + /** + * Get the resource ID of the sub net. + * + * @return the subnetId value + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the resource ID of the sub net. + * + * @param subnetId the subnetId value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the resource ID of the public IP address. + * + * @return the publicIpAddressId value + */ + public String publicIpAddressId() { + return this.publicIpAddressId; + } + + /** + * Set the resource ID of the public IP address. + * + * @param publicIpAddressId the publicIpAddressId value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withPublicIpAddressId(String publicIpAddressId) { + this.publicIpAddressId = publicIpAddressId; + return this; + } + + /** + * Get the public IP address. + * + * @return the publicIpAddress value + */ + public String publicIpAddress() { + return this.publicIpAddress; + } + + /** + * Set the public IP address. + * + * @param publicIpAddress the publicIpAddress value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withPublicIpAddress(String publicIpAddress) { + this.publicIpAddress = publicIpAddress; + return this; + } + + /** + * Get the private IP address. + * + * @return the privateIpAddress value + */ + public String privateIpAddress() { + return this.privateIpAddress; + } + + /** + * Set the private IP address. + * + * @param privateIpAddress the privateIpAddress value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withPrivateIpAddress(String privateIpAddress) { + this.privateIpAddress = privateIpAddress; + return this; + } + + /** + * Get the DNS name. + * + * @return the dnsName value + */ + public String dnsName() { + return this.dnsName; + } + + /** + * Set the DNS name. + * + * @param dnsName the dnsName value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withDnsName(String dnsName) { + this.dnsName = dnsName; + return this; + } + + /** + * Get the RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). + * + * @return the rdpAuthority value + */ + public String rdpAuthority() { + return this.rdpAuthority; + } + + /** + * Set the RdpAuthority property is a server DNS host name or IP address followed by the service port number for RDP (Remote Desktop Protocol). + * + * @param rdpAuthority the rdpAuthority value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withRdpAuthority(String rdpAuthority) { + this.rdpAuthority = rdpAuthority; + return this; + } + + /** + * Get the SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. + * + * @return the sshAuthority value + */ + public String sshAuthority() { + return this.sshAuthority; + } + + /** + * Set the SshAuthority property is a server DNS host name or IP address followed by the service port number for SSH. + * + * @param sshAuthority the sshAuthority value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withSshAuthority(String sshAuthority) { + this.sshAuthority = sshAuthority; + return this; + } + + /** + * Get the configuration for sharing a public IP address across multiple virtual machines. + * + * @return the sharedPublicIpAddressConfiguration value + */ + public SharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration() { + return this.sharedPublicIpAddressConfiguration; + } + + /** + * Set the configuration for sharing a public IP address across multiple virtual machines. + * + * @param sharedPublicIpAddressConfiguration the sharedPublicIpAddressConfiguration value to set + * @return the NetworkInterfacePropertiesFragment object itself. + */ + public NetworkInterfacePropertiesFragment withSharedPublicIpAddressConfiguration(SharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration) { + this.sharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannel.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannel.java new file mode 100644 index 000000000000..411eb2f7f1a5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannel.java @@ -0,0 +1,299 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.NotificationChannelInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing NotificationChannel. + */ +public interface NotificationChannel extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the events value. + */ + List events(); + + /** + * @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 uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the webHookUrl value. + */ + String webHookUrl(); + + /** + * The entirety of the NotificationChannel definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithCreate { + } + + /** + * Grouping of NotificationChannel definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a NotificationChannel definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the notificationchannel 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the notificationchannel definition allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of notification + * @return the next definition stage + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the notificationchannel definition allowing to specify Events. + */ + interface WithEvents { + /** + * Specifies events. + * @param events The list of event for which this notification is enabled + * @return the next definition stage + */ + WithCreate withEvents(List events); + } + + /** + * The stage of the notificationchannel definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the notificationchannel 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 notificationchannel definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the notificationchannel definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the notificationchannel definition allowing to specify WebHookUrl. + */ + interface WithWebHookUrl { + /** + * Specifies webHookUrl. + * @param webHookUrl The webhook URL to send notifications to + * @return the next definition stage + */ + WithCreate withWebHookUrl(String webHookUrl); + } + + /** + * 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.WithEvents, DefinitionStages.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithWebHookUrl { + } + } + /** + * The template for a NotificationChannel update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDescription, UpdateStages.WithEvents, UpdateStages.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier, UpdateStages.WithWebHookUrl { + } + + /** + * Grouping of NotificationChannel update stages. + */ + interface UpdateStages { + /** + * The stage of the notificationchannel update allowing to specify Description. + */ + interface WithDescription { + /** + * Specifies description. + * @param description Description of notification + * @return the next update stage + */ + Update withDescription(String description); + } + + /** + * The stage of the notificationchannel update allowing to specify Events. + */ + interface WithEvents { + /** + * Specifies events. + * @param events The list of event for which this notification is enabled + * @return the next update stage + */ + Update withEvents(List events); + } + + /** + * The stage of the notificationchannel update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the notificationchannel 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 notificationchannel update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the notificationchannel update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the notificationchannel update allowing to specify WebHookUrl. + */ + interface WithWebHookUrl { + /** + * Specifies webHookUrl. + * @param webHookUrl The webhook URL to send notifications to + * @return the next update stage + */ + Update withWebHookUrl(String webHookUrl); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannelEventType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannelEventType.java new file mode 100644 index 000000000000..8d9baf51644c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannelEventType.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NotificationChannelEventType. + */ +public final class NotificationChannelEventType extends ExpandableStringEnum { + /** Static value AutoShutdown for NotificationChannelEventType. */ + public static final NotificationChannelEventType AUTO_SHUTDOWN = fromString("AutoShutdown"); + + /** Static value Cost for NotificationChannelEventType. */ + public static final NotificationChannelEventType COST = fromString("Cost"); + + /** + * Creates or finds a NotificationChannelEventType from its string representation. + * @param name a name to look for + * @return the corresponding NotificationChannelEventType + */ + @JsonCreator + public static NotificationChannelEventType fromString(String name) { + return fromString(name, NotificationChannelEventType.class); + } + + /** + * @return known NotificationChannelEventType values + */ + public static Collection values() { + return values(NotificationChannelEventType.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannelFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannelFragment.java new file mode 100644 index 000000000000..aa31bd9ccf07 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannelFragment.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A notification. + */ +@JsonFlatten +@SkipParentValidation +public class NotificationChannelFragment extends Resource { + /** + * The webhook URL to send notifications to. + */ + @JsonProperty(value = "properties.webHookUrl") + private String webHookUrl; + + /** + * Description of notification. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The list of event for which this notification is enabled. + */ + @JsonProperty(value = "properties.events") + private List events; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the webhook URL to send notifications to. + * + * @return the webHookUrl value + */ + public String webHookUrl() { + return this.webHookUrl; + } + + /** + * Set the webhook URL to send notifications to. + * + * @param webHookUrl the webHookUrl value to set + * @return the NotificationChannelFragment object itself. + */ + public NotificationChannelFragment withWebHookUrl(String webHookUrl) { + this.webHookUrl = webHookUrl; + return this; + } + + /** + * Get description of notification. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of notification. + * + * @param description the description value to set + * @return the NotificationChannelFragment object itself. + */ + public NotificationChannelFragment withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the list of event for which this notification is enabled. + * + * @return the events value + */ + public List events() { + return this.events; + } + + /** + * Set the list of event for which this notification is enabled. + * + * @param events the events value to set + * @return the NotificationChannelFragment object itself. + */ + public NotificationChannelFragment withEvents(List events) { + this.events = events; + 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 NotificationChannelFragment object itself. + */ + public NotificationChannelFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the NotificationChannelFragment object itself. + */ + public NotificationChannelFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannels.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannels.java new file mode 100644 index 000000000000..36f2d87d50e4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationChannels.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.NotificationChannelsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing NotificationChannels. + */ +public interface NotificationChannels extends SupportsCreating, HasInner { + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable notifyAsync(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters); + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String name); + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationSettings.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationSettings.java new file mode 100644 index 000000000000..866e13f810ed --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationSettings.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Notification settings for a schedule. + */ +public class NotificationSettings { + /** + * If notifications are enabled for this schedule (i.e. Enabled, Disabled). + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "status") + private NotificationStatus status; + + /** + * Time in minutes before event at which notification will be sent. + */ + @JsonProperty(value = "timeInMinutes") + private Integer timeInMinutes; + + /** + * The webhook URL to which the notification will be sent. + */ + @JsonProperty(value = "webhookUrl") + private String webhookUrl; + + /** + * Get if notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'Disabled', 'Enabled'. + * + * @return the status value + */ + public NotificationStatus status() { + return this.status; + } + + /** + * Set if notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'Disabled', 'Enabled'. + * + * @param status the status value to set + * @return the NotificationSettings object itself. + */ + public NotificationSettings withStatus(NotificationStatus status) { + this.status = status; + return this; + } + + /** + * Get time in minutes before event at which notification will be sent. + * + * @return the timeInMinutes value + */ + public Integer timeInMinutes() { + return this.timeInMinutes; + } + + /** + * Set time in minutes before event at which notification will be sent. + * + * @param timeInMinutes the timeInMinutes value to set + * @return the NotificationSettings object itself. + */ + public NotificationSettings withTimeInMinutes(Integer timeInMinutes) { + this.timeInMinutes = timeInMinutes; + return this; + } + + /** + * Get the webhook URL to which the notification will be sent. + * + * @return the webhookUrl value + */ + public String webhookUrl() { + return this.webhookUrl; + } + + /** + * Set the webhook URL to which the notification will be sent. + * + * @param webhookUrl the webhookUrl value to set + * @return the NotificationSettings object itself. + */ + public NotificationSettings withWebhookUrl(String webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationSettingsFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationSettingsFragment.java new file mode 100644 index 000000000000..ef34b0d3886d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationSettingsFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Notification settings for a schedule. + */ +public class NotificationSettingsFragment { + /** + * If notifications are enabled for this schedule (i.e. Enabled, Disabled). + * Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "status") + private NotificationStatus status; + + /** + * Time in minutes before event at which notification will be sent. + */ + @JsonProperty(value = "timeInMinutes") + private Integer timeInMinutes; + + /** + * The webhook URL to which the notification will be sent. + */ + @JsonProperty(value = "webhookUrl") + private String webhookUrl; + + /** + * Get if notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'Disabled', 'Enabled'. + * + * @return the status value + */ + public NotificationStatus status() { + return this.status; + } + + /** + * Set if notifications are enabled for this schedule (i.e. Enabled, Disabled). Possible values include: 'Disabled', 'Enabled'. + * + * @param status the status value to set + * @return the NotificationSettingsFragment object itself. + */ + public NotificationSettingsFragment withStatus(NotificationStatus status) { + this.status = status; + return this; + } + + /** + * Get time in minutes before event at which notification will be sent. + * + * @return the timeInMinutes value + */ + public Integer timeInMinutes() { + return this.timeInMinutes; + } + + /** + * Set time in minutes before event at which notification will be sent. + * + * @param timeInMinutes the timeInMinutes value to set + * @return the NotificationSettingsFragment object itself. + */ + public NotificationSettingsFragment withTimeInMinutes(Integer timeInMinutes) { + this.timeInMinutes = timeInMinutes; + return this; + } + + /** + * Get the webhook URL to which the notification will be sent. + * + * @return the webhookUrl value + */ + public String webhookUrl() { + return this.webhookUrl; + } + + /** + * Set the webhook URL to which the notification will be sent. + * + * @param webhookUrl the webhookUrl value to set + * @return the NotificationSettingsFragment object itself. + */ + public NotificationSettingsFragment withWebhookUrl(String webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationStatus.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationStatus.java new file mode 100644 index 000000000000..1671e22da4fe --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotificationStatus.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NotificationStatus. + */ +public final class NotificationStatus extends ExpandableStringEnum { + /** Static value Disabled for NotificationStatus. */ + public static final NotificationStatus DISABLED = fromString("Disabled"); + + /** Static value Enabled for NotificationStatus. */ + public static final NotificationStatus ENABLED = fromString("Enabled"); + + /** + * Creates or finds a NotificationStatus from its string representation. + * @param name a name to look for + * @return the corresponding NotificationStatus + */ + @JsonCreator + public static NotificationStatus fromString(String name) { + return fromString(name, NotificationStatus.class); + } + + /** + * @return known NotificationStatus values + */ + public static Collection values() { + return values(NotificationStatus.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotifyParameters.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotifyParameters.java new file mode 100644 index 000000000000..8e1b72b1edc4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/NotifyParameters.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for generating a Notification. + */ +public class NotifyParameters { + /** + * The type of event (i.e. AutoShutdown, Cost). Possible values include: + * 'AutoShutdown', 'Cost'. + */ + @JsonProperty(value = "eventName") + private NotificationChannelEventType eventName; + + /** + * Properties for the notification in json format. + */ + @JsonProperty(value = "jsonPayload") + private String jsonPayload; + + /** + * Get the type of event (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + * + * @return the eventName value + */ + public NotificationChannelEventType eventName() { + return this.eventName; + } + + /** + * Set the type of event (i.e. AutoShutdown, Cost). Possible values include: 'AutoShutdown', 'Cost'. + * + * @param eventName the eventName value to set + * @return the NotifyParameters object itself. + */ + public NotifyParameters withEventName(NotificationChannelEventType eventName) { + this.eventName = eventName; + return this; + } + + /** + * Get properties for the notification in json format. + * + * @return the jsonPayload value + */ + public String jsonPayload() { + return this.jsonPayload; + } + + /** + * Set properties for the notification in json format. + * + * @param jsonPayload the jsonPayload value to set + * @return the NotifyParameters object itself. + */ + public NotifyParameters withJsonPayload(String jsonPayload) { + this.jsonPayload = jsonPayload; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationError.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationError.java new file mode 100644 index 000000000000..40242c9d46d5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationError.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details for the operation in case of a failure. + */ +public class OperationError { + /** + * The error code of the operation error. + */ + @JsonProperty(value = "code") + private String code; + + /** + * The error message of the operation error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the error code of the operation error. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set the error code of the operation error. + * + * @param code the code value to set + * @return the OperationError object itself. + */ + public OperationError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the error message of the operation error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the error message of the operation error. + * + * @param message the message value to set + * @return the OperationError object itself. + */ + public OperationError withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationMetadata.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationMetadata.java new file mode 100644 index 000000000000..53e743da0d52 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationMetadata.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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DevTestLabsManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.OperationMetadataInner; + +/** + * Type representing OperationMetadata. + */ +public interface OperationMetadata extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationMetadataDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationMetadataDisplay.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationMetadataDisplay.java new file mode 100644 index 000000000000..ebc1ec921f78 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationMetadataDisplay.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that describes the operations. + */ +public class OperationMetadataDisplay { + /** + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Operation type: read, write, delete, listKeys/action, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Friendly name of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get friendly name of the resource provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set friendly name of the resource provider. + * + * @param provider the provider value to set + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource type on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource type on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: read, write, delete, listKeys/action, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: read, write, delete, listKeys/action, etc. + * + * @param operation the operation value to set + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get friendly name of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set friendly name of the operation. + * + * @param description the description value to set + * @return the OperationMetadataDisplay object itself. + */ + public OperationMetadataDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationResult.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationResult.java new file mode 100644 index 000000000000..99126203a227 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/OperationResult.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.OperationResultInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.DevTestLabsManager; + +/** + * Type representing OperationResult. + */ +public interface OperationResult extends HasInner, HasManager { + /** + * @return the error value. + */ + OperationError error(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the statusCode value. + */ + HttpStatusCode statusCode(); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Operations.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Operations.java new file mode 100644 index 000000000000..9c0955394062 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Operations.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.v2016_05_15; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String locationName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ParameterInfo.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ParameterInfo.java new file mode 100644 index 000000000000..5e9e709ce421 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about an artifact's parameter. + */ +public class ParameterInfo { + /** + * 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 ParameterInfo object itself. + */ + public ParameterInfo 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 ParameterInfo object itself. + */ + public ParameterInfo withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ParametersValueFileInfo.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ParametersValueFileInfo.java new file mode 100644 index 000000000000..a09876122224 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ParametersValueFileInfo.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A file containing a set of parameter values for an ARM template. + */ +public class ParametersValueFileInfo { + /** + * File name. + */ + @JsonProperty(value = "fileName") + private String fileName; + + /** + * Contents of the file. + */ + @JsonProperty(value = "parametersValueInfo") + private Object parametersValueInfo; + + /** + * Get file name. + * + * @return the fileName value + */ + public String fileName() { + return this.fileName; + } + + /** + * Set file name. + * + * @param fileName the fileName value to set + * @return the ParametersValueFileInfo object itself. + */ + public ParametersValueFileInfo withFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get contents of the file. + * + * @return the parametersValueInfo value + */ + public Object parametersValueInfo() { + return this.parametersValueInfo; + } + + /** + * Set contents of the file. + * + * @param parametersValueInfo the parametersValueInfo value to set + * @return the ParametersValueFileInfo object itself. + */ + public ParametersValueFileInfo withParametersValueInfo(Object parametersValueInfo) { + this.parametersValueInfo = parametersValueInfo; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PercentageCostThresholdProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PercentageCostThresholdProperties.java new file mode 100644 index 000000000000..bbbf74a1a6c6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PercentageCostThresholdProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a percentage cost threshold. + */ +public class PercentageCostThresholdProperties { + /** + * The cost threshold value. + */ + @JsonProperty(value = "thresholdValue") + private Double thresholdValue; + + /** + * Get the cost threshold value. + * + * @return the thresholdValue value + */ + public Double thresholdValue() { + return this.thresholdValue; + } + + /** + * Set the cost threshold value. + * + * @param thresholdValue the thresholdValue value to set + * @return the PercentageCostThresholdProperties object itself. + */ + public PercentageCostThresholdProperties withThresholdValue(Double thresholdValue) { + this.thresholdValue = thresholdValue; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Policies.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Policies.java new file mode 100644 index 000000000000..8a3defccc605 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Policies.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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.PoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Policies. + */ +public interface Policies 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 getAsync(String resourceGroupName, String labName, String policySetName, String name); + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 deleteAsync(String resourceGroupName, String labName, String policySetName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Policy.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Policy.java new file mode 100644 index 000000000000..1e15caabc205 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Policy.java @@ -0,0 +1,386 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing Policy. + */ +public interface Policy extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @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(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * The entirety of the Policy definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithPolicyset, 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 + */ + WithCreate withExistingPolicyset(String resourceGroupName, String labName, String policySetName); + } + + /** + * 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 (i.e. AllowedValuesPolicy, MaxValuePolicy). 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 (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + * @return the next definition stage + */ + WithCreate withFactName(PolicyFactName factName); + } + + /** + * The stage of the policy definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * 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 of the resource + * @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 (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy) + * @return the next definition stage + */ + WithCreate withThreshold(String threshold); + } + + /** + * The stage of the policy definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithStatus, DefinitionStages.WithTags, DefinitionStages.WithThreshold, DefinitionStages.WithUniqueIdentifier { + } + } + /** + * 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.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithStatus, UpdateStages.WithTags, UpdateStages.WithThreshold, UpdateStages.WithUniqueIdentifier { + } + + /** + * 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 (i.e. AllowedValuesPolicy, MaxValuePolicy). 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 (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost' + * @return the next update stage + */ + Update withFactName(PolicyFactName factName); + } + + /** + * The stage of the policy update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * 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 of the resource + * @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 (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy) + * @return the next update stage + */ + Update withThreshold(String threshold); + } + + /** + * The stage of the policy update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyEvaluatorType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyEvaluatorType.java new file mode 100644 index 000000000000..c7cac3157aa2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyFactName.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyFactName.java new file mode 100644 index 000000000000..d65fdb5134a3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyFactName.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.v2016_05_15; + +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 UserOwnedLabPremiumVmCount for PolicyFactName. */ + public static final PolicyFactName USER_OWNED_LAB_PREMIUM_VM_COUNT = fromString("UserOwnedLabPremiumVmCount"); + + /** Static value LabVmCount for PolicyFactName. */ + public static final PolicyFactName LAB_VM_COUNT = fromString("LabVmCount"); + + /** Static value LabPremiumVmCount for PolicyFactName. */ + public static final PolicyFactName LAB_PREMIUM_VM_COUNT = fromString("LabPremiumVmCount"); + + /** Static value LabVmSize for PolicyFactName. */ + public static final PolicyFactName LAB_VM_SIZE = fromString("LabVmSize"); + + /** Static value GalleryImage for PolicyFactName. */ + public static final PolicyFactName GALLERY_IMAGE = fromString("GalleryImage"); + + /** Static value UserOwnedLabVmCountInSubnet for PolicyFactName. */ + public static final PolicyFactName USER_OWNED_LAB_VM_COUNT_IN_SUBNET = fromString("UserOwnedLabVmCountInSubnet"); + + /** Static value LabTargetCost for PolicyFactName. */ + public static final PolicyFactName LAB_TARGET_COST = fromString("LabTargetCost"); + + /** + * 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyFragment.java new file mode 100644 index 000000000000..2d93220c64b9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyFragment.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A Policy. + */ +@JsonFlatten +@SkipParentValidation +public class PolicyFragment 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 (e.g. LabVmCount, LabVmSize, + * MaxVmsAllowedPerLab, etc. Possible values include: + * 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', + * 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', + * 'UserOwnedLabVmCountInSubnet', 'LabTargetCost'. + */ + @JsonProperty(value = "properties.factName") + private PolicyFactName factName; + + /** + * The fact data of the policy. + */ + @JsonProperty(value = "properties.factData") + private String factData; + + /** + * The threshold of the policy (i.e. a number for MaxValuePolicy, and a + * JSON array of values for AllowedValuesPolicy). + */ + @JsonProperty(value = "properties.threshold") + private String threshold; + + /** + * The evaluator type of the policy (i.e. AllowedValuesPolicy, + * MaxValuePolicy). 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; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * 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 PolicyFragment object itself. + */ + public PolicyFragment 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 PolicyFragment object itself. + */ + public PolicyFragment withStatus(PolicyStatus status) { + this.status = status; + return this; + } + + /** + * Get the fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost'. + * + * @return the factName value + */ + public PolicyFactName factName() { + return this.factName; + } + + /** + * Set the fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost'. + * + * @param factName the factName value to set + * @return the PolicyFragment object itself. + */ + public PolicyFragment 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 PolicyFragment object itself. + */ + public PolicyFragment withFactData(String factData) { + this.factData = factData; + return this; + } + + /** + * Get the threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + * + * @return the threshold value + */ + public String threshold() { + return this.threshold; + } + + /** + * Set the threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + * + * @param threshold the threshold value to set + * @return the PolicyFragment object itself. + */ + public PolicyFragment withThreshold(String threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. + * + * @return the evaluatorType value + */ + public PolicyEvaluatorType evaluatorType() { + return this.evaluatorType; + } + + /** + * Set the evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. + * + * @param evaluatorType the evaluatorType value to set + * @return the PolicyFragment object itself. + */ + public PolicyFragment 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 PolicyFragment object itself. + */ + public PolicyFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the PolicyFragment object itself. + */ + public PolicyFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicySetResult.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicySetResult.java new file mode 100644 index 000000000000..a05cc91d2bd3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicySets.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicySets.java new file mode 100644 index 000000000000..35be2c7cd7dc --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyStatus.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyStatus.java new file mode 100644 index 000000000000..9c0effd85f99 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyViolation.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PolicyViolation.java new file mode 100644 index 000000000000..d9ffacf7cf42 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Port.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Port.java new file mode 100644 index 000000000000..a2a6064ef016 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Port.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a network port. + */ +public class Port { + /** + * Protocol type of the port. Possible values include: 'Tcp', 'Udp'. + */ + @JsonProperty(value = "transportProtocol") + private TransportProtocol transportProtocol; + + /** + * Backend port of the target virtual machine. + */ + @JsonProperty(value = "backendPort") + private Integer backendPort; + + /** + * Get protocol type of the port. Possible values include: 'Tcp', 'Udp'. + * + * @return the transportProtocol value + */ + public TransportProtocol transportProtocol() { + return this.transportProtocol; + } + + /** + * Set protocol type of the port. Possible values include: 'Tcp', 'Udp'. + * + * @param transportProtocol the transportProtocol value to set + * @return the Port object itself. + */ + public Port withTransportProtocol(TransportProtocol transportProtocol) { + this.transportProtocol = transportProtocol; + return this; + } + + /** + * Get backend port of the target virtual machine. + * + * @return the backendPort value + */ + public Integer backendPort() { + return this.backendPort; + } + + /** + * Set backend port of the target virtual machine. + * + * @param backendPort the backendPort value to set + * @return the Port object itself. + */ + public Port withBackendPort(Integer backendPort) { + this.backendPort = backendPort; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PortFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PortFragment.java new file mode 100644 index 000000000000..6d0d6314c9ff --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PortFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a network port. + */ +public class PortFragment { + /** + * Protocol type of the port. Possible values include: 'Tcp', 'Udp'. + */ + @JsonProperty(value = "transportProtocol") + private TransportProtocol transportProtocol; + + /** + * Backend port of the target virtual machine. + */ + @JsonProperty(value = "backendPort") + private Integer backendPort; + + /** + * Get protocol type of the port. Possible values include: 'Tcp', 'Udp'. + * + * @return the transportProtocol value + */ + public TransportProtocol transportProtocol() { + return this.transportProtocol; + } + + /** + * Set protocol type of the port. Possible values include: 'Tcp', 'Udp'. + * + * @param transportProtocol the transportProtocol value to set + * @return the PortFragment object itself. + */ + public PortFragment withTransportProtocol(TransportProtocol transportProtocol) { + this.transportProtocol = transportProtocol; + return this; + } + + /** + * Get backend port of the target virtual machine. + * + * @return the backendPort value + */ + public Integer backendPort() { + return this.backendPort; + } + + /** + * Set backend port of the target virtual machine. + * + * @param backendPort the backendPort value to set + * @return the PortFragment object itself. + */ + public PortFragment withBackendPort(Integer backendPort) { + this.backendPort = backendPort; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PremiumDataDisk.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PremiumDataDisk.java new file mode 100644 index 000000000000..702d5b1cf98e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/PremiumDataDisk.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PremiumDataDisk. + */ +public final class PremiumDataDisk extends ExpandableStringEnum { + /** Static value Disabled for PremiumDataDisk. */ + public static final PremiumDataDisk DISABLED = fromString("Disabled"); + + /** Static value Enabled for PremiumDataDisk. */ + public static final PremiumDataDisk ENABLED = fromString("Enabled"); + + /** + * Creates or finds a PremiumDataDisk from its string representation. + * @param name a name to look for + * @return the corresponding PremiumDataDisk + */ + @JsonCreator + public static PremiumDataDisk fromString(String name) { + return fromString(name, PremiumDataDisk.class); + } + + /** + * @return known PremiumDataDisk values + */ + public static Collection values() { + return values(PremiumDataDisk.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ProviderOperations.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ProviderOperations.java new file mode 100644 index 000000000000..7cd67406ae3c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ProviderOperations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ProviderOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ProviderOperations. + */ +public interface ProviderOperations extends HasInner { + /** + * Result of the request to list REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ReportingCycleType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ReportingCycleType.java new file mode 100644 index 000000000000..09d10a9c6ee3 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ReportingCycleType.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ReportingCycleType. + */ +public final class ReportingCycleType extends ExpandableStringEnum { + /** Static value CalendarMonth for ReportingCycleType. */ + public static final ReportingCycleType CALENDAR_MONTH = fromString("CalendarMonth"); + + /** Static value Custom for ReportingCycleType. */ + public static final ReportingCycleType CUSTOM = fromString("Custom"); + + /** + * Creates or finds a ReportingCycleType from its string representation. + * @param name a name to look for + * @return the corresponding ReportingCycleType + */ + @JsonCreator + public static ReportingCycleType fromString(String name) { + return fromString(name, ReportingCycleType.class); + } + + /** + * @return known ReportingCycleType values + */ + public static Collection values() { + return values(ReportingCycleType.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/RetargetScheduleProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/RetargetScheduleProperties.java new file mode 100644 index 000000000000..a09ec2bf327a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/RetargetScheduleProperties.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties for retargeting a virtual machine schedule. + */ +public class RetargetScheduleProperties { + /** + * The resource Id of the virtual machine on which the schedule operates. + */ + @JsonProperty(value = "currentResourceId") + private String currentResourceId; + + /** + * The resource Id of the virtual machine that the schedule should be + * retargeted to. + */ + @JsonProperty(value = "targetResourceId") + private String targetResourceId; + + /** + * Get the resource Id of the virtual machine on which the schedule operates. + * + * @return the currentResourceId value + */ + public String currentResourceId() { + return this.currentResourceId; + } + + /** + * Set the resource Id of the virtual machine on which the schedule operates. + * + * @param currentResourceId the currentResourceId value to set + * @return the RetargetScheduleProperties object itself. + */ + public RetargetScheduleProperties withCurrentResourceId(String currentResourceId) { + this.currentResourceId = currentResourceId; + return this; + } + + /** + * Get the resource Id of the virtual machine that the schedule should be retargeted to. + * + * @return the targetResourceId value + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the resource Id of the virtual machine that the schedule should be retargeted to. + * + * @param targetResourceId the targetResourceId value to set + * @return the RetargetScheduleProperties object itself. + */ + public RetargetScheduleProperties withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Schedule.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Schedule.java new file mode 100644 index 000000000000..cd215b6f5521 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Schedule.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.v2016_05_15; + +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.v2016_05_15.implementation.DevTestLabsManager; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ScheduleInner; + +/** + * Type representing Schedule. + */ +public interface Schedule extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the dailyRecurrence value. + */ + DayDetails dailyRecurrence(); + + /** + * @return the hourlyRecurrence value. + */ + HourDetails hourlyRecurrence(); + + /** + * @return the notificationSettings value. + */ + NotificationSettings notificationSettings(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the status value. + */ + EnableStatus status(); + + /** + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * @return the taskType value. + */ + String taskType(); + + /** + * @return the timeZoneId value. + */ + String timeZoneId(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the weeklyRecurrence value. + */ + WeekDetails weeklyRecurrence(); + + /** + * The entirety of the Schedule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Schedule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Schedule definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Schedule definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the schedule definition allowing to specify DailyRecurrence. + */ + interface WithDailyRecurrence { + /** + * Specifies dailyRecurrence. + * @param dailyRecurrence If the schedule will occur once each day of the week, specify the daily recurrence + * @return the next definition stage + */ + WithCreate withDailyRecurrence(DayDetails dailyRecurrence); + } + + /** + * The stage of the schedule definition allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence If the schedule will occur multiple times a day, specify the hourly recurrence + * @return the next definition stage + */ + WithCreate withHourlyRecurrence(HourDetails hourlyRecurrence); + } + + /** + * The stage of the schedule definition allowing to specify NotificationSettings. + */ + interface WithNotificationSettings { + /** + * Specifies notificationSettings. + * @param notificationSettings Notification settings + * @return the next definition stage + */ + WithCreate withNotificationSettings(NotificationSettings notificationSettings); + } + + /** + * 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 (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withStatus(EnableStatus status); + } + + /** + * The stage of the schedule definition allowing to specify TargetResourceId. + */ + interface WithTargetResourceId { + /** + * Specifies targetResourceId. + * @param targetResourceId The resource ID to which the schedule belongs + * @return the next definition stage + */ + WithCreate withTargetResourceId(String targetResourceId); + } + + /** + * The stage of the schedule definition allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart) + * @return the next definition stage + */ + WithCreate withTaskType(String taskType); + } + + /** + * The stage of the schedule definition allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone ID (e.g. Pacific Standard time) + * @return the next definition stage + */ + WithCreate withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the schedule definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the schedule definition allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence If the schedule will occur only some days of the week, specify the weekly recurrence + * @return the next definition stage + */ + WithCreate withWeeklyRecurrence(WeekDetails weeklyRecurrence); + } + + /** + * The stage of the 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.WithDailyRecurrence, DefinitionStages.WithHourlyRecurrence, DefinitionStages.WithNotificationSettings, DefinitionStages.WithProvisioningState, DefinitionStages.WithStatus, DefinitionStages.WithTargetResourceId, DefinitionStages.WithTaskType, DefinitionStages.WithTimeZoneId, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithWeeklyRecurrence { + } + } + /** + * The template for a Schedule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithDailyRecurrence, UpdateStages.WithHourlyRecurrence, UpdateStages.WithNotificationSettings, UpdateStages.WithProvisioningState, UpdateStages.WithStatus, UpdateStages.WithTargetResourceId, UpdateStages.WithTaskType, UpdateStages.WithTimeZoneId, UpdateStages.WithUniqueIdentifier, 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 If the schedule will occur once each day of the week, specify the daily recurrence + * @return the next update stage + */ + Update withDailyRecurrence(DayDetailsFragment dailyRecurrence); + } + + /** + * The stage of the schedule update allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence If the schedule will occur multiple times a day, specify the hourly recurrence + * @return the next update stage + */ + Update withHourlyRecurrence(HourDetailsFragment hourlyRecurrence); + } + + /** + * The stage of the schedule update allowing to specify NotificationSettings. + */ + interface WithNotificationSettings { + /** + * Specifies notificationSettings. + * @param notificationSettings Notification settings + * @return the next update stage + */ + Update withNotificationSettings(NotificationSettingsFragment notificationSettings); + } + + /** + * 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 (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withStatus(EnableStatus status); + } + + /** + * The stage of the schedule update allowing to specify TargetResourceId. + */ + interface WithTargetResourceId { + /** + * Specifies targetResourceId. + * @param targetResourceId The resource ID to which the schedule belongs + * @return the next update stage + */ + Update withTargetResourceId(String targetResourceId); + } + + /** + * The stage of the schedule update allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart) + * @return the next update stage + */ + Update withTaskType(String taskType); + } + + /** + * The stage of the schedule update allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone ID (e.g. Pacific Standard time) + * @return the next update stage + */ + Update withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the schedule update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the schedule update allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence If the schedule will occur only some days of the week, specify the weekly recurrence + * @return the next update stage + */ + Update withWeeklyRecurrence(WeekDetailsFragment weeklyRecurrence); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ScheduleFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ScheduleFragment.java new file mode 100644 index 000000000000..d4774eade946 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ScheduleFragment.java @@ -0,0 +1,286 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A schedule. + */ +@JsonFlatten +@SkipParentValidation +public class ScheduleFragment extends Resource { + /** + * The status of the schedule (i.e. Enabled, Disabled). Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /** + * The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + */ + @JsonProperty(value = "properties.taskType") + private String taskType; + + /** + * If the schedule will occur only some days of the week, specify the + * weekly recurrence. + */ + @JsonProperty(value = "properties.weeklyRecurrence") + private WeekDetailsFragment weeklyRecurrence; + + /** + * If the schedule will occur once each day of the week, specify the daily + * recurrence. + */ + @JsonProperty(value = "properties.dailyRecurrence") + private DayDetailsFragment dailyRecurrence; + + /** + * If the schedule will occur multiple times a day, specify the hourly + * recurrence. + */ + @JsonProperty(value = "properties.hourlyRecurrence") + private HourDetailsFragment hourlyRecurrence; + + /** + * The time zone ID (e.g. Pacific Standard time). + */ + @JsonProperty(value = "properties.timeZoneId") + private String timeZoneId; + + /** + * Notification settings. + */ + @JsonProperty(value = "properties.notificationSettings") + private NotificationSettingsFragment notificationSettings; + + /** + * The resource ID to which the schedule belongs. + */ + @JsonProperty(value = "properties.targetResourceId") + private String targetResourceId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the status of the schedule (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status of the schedule (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled'. + * + * @param status the status value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withStatus(EnableStatus status) { + this.status = status; + return this; + } + + /** + * Get the task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @return the taskType value + */ + public String taskType() { + return this.taskType; + } + + /** + * Set the task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @param taskType the taskType value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withTaskType(String taskType) { + this.taskType = taskType; + return this; + } + + /** + * Get if the schedule will occur only some days of the week, specify the weekly recurrence. + * + * @return the weeklyRecurrence value + */ + public WeekDetailsFragment weeklyRecurrence() { + return this.weeklyRecurrence; + } + + /** + * Set if the schedule will occur only some days of the week, specify the weekly recurrence. + * + * @param weeklyRecurrence the weeklyRecurrence value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withWeeklyRecurrence(WeekDetailsFragment weeklyRecurrence) { + this.weeklyRecurrence = weeklyRecurrence; + return this; + } + + /** + * Get if the schedule will occur once each day of the week, specify the daily recurrence. + * + * @return the dailyRecurrence value + */ + public DayDetailsFragment dailyRecurrence() { + return this.dailyRecurrence; + } + + /** + * Set if the schedule will occur once each day of the week, specify the daily recurrence. + * + * @param dailyRecurrence the dailyRecurrence value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withDailyRecurrence(DayDetailsFragment dailyRecurrence) { + this.dailyRecurrence = dailyRecurrence; + return this; + } + + /** + * Get if the schedule will occur multiple times a day, specify the hourly recurrence. + * + * @return the hourlyRecurrence value + */ + public HourDetailsFragment hourlyRecurrence() { + return this.hourlyRecurrence; + } + + /** + * Set if the schedule will occur multiple times a day, specify the hourly recurrence. + * + * @param hourlyRecurrence the hourlyRecurrence value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withHourlyRecurrence(HourDetailsFragment hourlyRecurrence) { + this.hourlyRecurrence = hourlyRecurrence; + return this; + } + + /** + * Get the time zone ID (e.g. Pacific Standard time). + * + * @return the timeZoneId value + */ + public String timeZoneId() { + return this.timeZoneId; + } + + /** + * Set the time zone ID (e.g. Pacific Standard time). + * + * @param timeZoneId the timeZoneId value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withTimeZoneId(String timeZoneId) { + this.timeZoneId = timeZoneId; + return this; + } + + /** + * Get notification settings. + * + * @return the notificationSettings value + */ + public NotificationSettingsFragment notificationSettings() { + return this.notificationSettings; + } + + /** + * Set notification settings. + * + * @param notificationSettings the notificationSettings value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withNotificationSettings(NotificationSettingsFragment notificationSettings) { + this.notificationSettings = notificationSettings; + return this; + } + + /** + * Get the resource ID to which the schedule belongs. + * + * @return the targetResourceId value + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the resource ID to which the schedule belongs. + * + * @param targetResourceId the targetResourceId value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + 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 ScheduleFragment object itself. + */ + public ScheduleFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the ScheduleFragment object itself. + */ + public ScheduleFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Schedules.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Schedules.java new file mode 100644 index 000000000000..a7324235af7f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Schedules.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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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); + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listApplicableAsync(final String resourceGroupName, final String labName, final 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 getAsync(String resourceGroupName, String labName, String name); + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Secret.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Secret.java new file mode 100644 index 000000000000..7d7ff6529273 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Secret.java @@ -0,0 +1,235 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.SecretInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; + +/** + * Type representing Secret. + */ +public interface Secret extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @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 uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the value value. + */ + String value(); + + /** + * The entirety of the Secret definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithUser, DefinitionStages.WithCreate { + } + + /** + * Grouping of Secret definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Secret definition. + */ + interface Blank extends WithUser { + } + + /** + * The stage of the secret definition allowing to specify User. + */ + interface WithUser { + /** + * Specifies resourceGroupName, labName, userName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @param userName The name of the user profile + * @return the next definition stage + */ + WithCreate withExistingUser(String resourceGroupName, String labName, String userName); + } + + /** + * The stage of the secret definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the secret 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 secret definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the secret definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the secret definition allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value The value of the secret for secret creation + * @return the next definition stage + */ + WithCreate withValue(String value); + } + + /** + * 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.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithValue { + } + } + /** + * The template for a Secret update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier, UpdateStages.WithValue { + } + + /** + * Grouping of Secret update stages. + */ + interface UpdateStages { + /** + * The stage of the secret update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the secret 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 secret update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the secret update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the secret update allowing to specify Value. + */ + interface WithValue { + /** + * Specifies value. + * @param value The value of the secret for secret creation + * @return the next update stage + */ + Update withValue(String value); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Secrets.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Secrets.java new file mode 100644 index 000000000000..b6b750ed6e48 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Secrets.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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.SecretsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Secrets. + */ +public interface Secrets extends SupportsCreating, HasInner { + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String userName, String name); + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String userName); + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String userName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ServiceRunner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ServiceRunner.java new file mode 100644 index 000000000000..30ede861c31f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ServiceRunner.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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ServiceRunnerInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; + +/** + * Type representing ServiceRunner. + */ +public interface ServiceRunner extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + IdentityProperties identity(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the ServiceRunner definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithCreate { + } + + /** + * Grouping of ServiceRunner definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a ServiceRunner definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the servicerunner 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the servicerunner definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the resource + * @return the next definition stage + */ + WithCreate withIdentity(IdentityProperties identity); + } + + /** + * The stage of the servicerunner definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the servicerunner definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @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.WithIdentity, DefinitionStages.WithLocation, DefinitionStages.WithTags { + } + } + /** + * The template for a ServiceRunner update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIdentity, UpdateStages.WithLocation, UpdateStages.WithTags { + } + + /** + * Grouping of ServiceRunner update stages. + */ + interface UpdateStages { + /** + * The stage of the servicerunner update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the resource + * @return the next update stage + */ + Update withIdentity(IdentityProperties identity); + } + + /** + * The stage of the servicerunner update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the servicerunner update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ServiceRunners.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ServiceRunners.java new file mode 100644 index 000000000000..f1a651475212 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ServiceRunners.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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.ServiceRunnersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ServiceRunners. + */ +public interface ServiceRunners extends SupportsCreating, HasInner { + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String name); + + /** + * List service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SharedPublicIpAddressConfiguration.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SharedPublicIpAddressConfiguration.java new file mode 100644 index 000000000000..f0c3c32ae2a4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SharedPublicIpAddressConfiguration.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a virtual machine that determine how it is connected to a load + * balancer. + */ +public class SharedPublicIpAddressConfiguration { + /** + * The incoming NAT rules. + */ + @JsonProperty(value = "inboundNatRules") + private List inboundNatRules; + + /** + * Get the incoming NAT rules. + * + * @return the inboundNatRules value + */ + public List inboundNatRules() { + return this.inboundNatRules; + } + + /** + * Set the incoming NAT rules. + * + * @param inboundNatRules the inboundNatRules value to set + * @return the SharedPublicIpAddressConfiguration object itself. + */ + public SharedPublicIpAddressConfiguration withInboundNatRules(List inboundNatRules) { + this.inboundNatRules = inboundNatRules; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SharedPublicIpAddressConfigurationFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SharedPublicIpAddressConfigurationFragment.java new file mode 100644 index 000000000000..3aac205da336 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SharedPublicIpAddressConfigurationFragment.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a virtual machine that determine how it is connected to a load + * balancer. + */ +public class SharedPublicIpAddressConfigurationFragment { + /** + * The incoming NAT rules. + */ + @JsonProperty(value = "inboundNatRules") + private List inboundNatRules; + + /** + * Get the incoming NAT rules. + * + * @return the inboundNatRules value + */ + public List inboundNatRules() { + return this.inboundNatRules; + } + + /** + * Set the incoming NAT rules. + * + * @param inboundNatRules the inboundNatRules value to set + * @return the SharedPublicIpAddressConfigurationFragment object itself. + */ + public SharedPublicIpAddressConfigurationFragment withInboundNatRules(List inboundNatRules) { + this.inboundNatRules = inboundNatRules; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ShutdownNotificationContent.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ShutdownNotificationContent.java new file mode 100644 index 000000000000..8975cd5d35dd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/ShutdownNotificationContent.java @@ -0,0 +1,304 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The contents of a shutdown notification. Webhooks can use this type to + * deserialize the request body when they get notified of an imminent shutdown. + */ +public class ShutdownNotificationContent { + /** + * The URL to skip auto-shutdown. + */ + @JsonProperty(value = "skipUrl") + private String skipUrl; + + /** + * The URL to delay shutdown by 60 minutes. + */ + @JsonProperty(value = "delayUrl60") + private String delayUrl60; + + /** + * The URL to delay shutdown by 2 hours. + */ + @JsonProperty(value = "delayUrl120") + private String delayUrl120; + + /** + * The virtual machine to be shut down. + */ + @JsonProperty(value = "vmName") + private String vmName; + + /** + * The GUID for the virtual machine to be shut down. + */ + @JsonProperty(value = "guid") + private String guid; + + /** + * The owner of the virtual machine. + */ + @JsonProperty(value = "owner") + private String owner; + + /** + * The event for which a notification will be sent. + */ + @JsonProperty(value = "eventType") + private String eventType; + + /** + * The text for the notification. + */ + @JsonProperty(value = "text") + private String text; + + /** + * The subscription ID for the schedule. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /** + * The resource group name for the schedule. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /** + * The lab for the schedule. + */ + @JsonProperty(value = "labName") + private String labName; + + /** + * Get the URL to skip auto-shutdown. + * + * @return the skipUrl value + */ + public String skipUrl() { + return this.skipUrl; + } + + /** + * Set the URL to skip auto-shutdown. + * + * @param skipUrl the skipUrl value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withSkipUrl(String skipUrl) { + this.skipUrl = skipUrl; + return this; + } + + /** + * Get the URL to delay shutdown by 60 minutes. + * + * @return the delayUrl60 value + */ + public String delayUrl60() { + return this.delayUrl60; + } + + /** + * Set the URL to delay shutdown by 60 minutes. + * + * @param delayUrl60 the delayUrl60 value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withDelayUrl60(String delayUrl60) { + this.delayUrl60 = delayUrl60; + return this; + } + + /** + * Get the URL to delay shutdown by 2 hours. + * + * @return the delayUrl120 value + */ + public String delayUrl120() { + return this.delayUrl120; + } + + /** + * Set the URL to delay shutdown by 2 hours. + * + * @param delayUrl120 the delayUrl120 value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withDelayUrl120(String delayUrl120) { + this.delayUrl120 = delayUrl120; + return this; + } + + /** + * Get the virtual machine to be shut down. + * + * @return the vmName value + */ + public String vmName() { + return this.vmName; + } + + /** + * Set the virtual machine to be shut down. + * + * @param vmName the vmName value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withVmName(String vmName) { + this.vmName = vmName; + return this; + } + + /** + * Get the GUID for the virtual machine to be shut down. + * + * @return the guid value + */ + public String guid() { + return this.guid; + } + + /** + * Set the GUID for the virtual machine to be shut down. + * + * @param guid the guid value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withGuid(String guid) { + this.guid = guid; + return this; + } + + /** + * Get the owner of the virtual machine. + * + * @return the owner value + */ + public String owner() { + return this.owner; + } + + /** + * Set the owner of the virtual machine. + * + * @param owner the owner value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withOwner(String owner) { + this.owner = owner; + return this; + } + + /** + * Get the event for which a notification will be sent. + * + * @return the eventType value + */ + public String eventType() { + return this.eventType; + } + + /** + * Set the event for which a notification will be sent. + * + * @param eventType the eventType value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withEventType(String eventType) { + this.eventType = eventType; + return this; + } + + /** + * Get the text for the notification. + * + * @return the text value + */ + public String text() { + return this.text; + } + + /** + * Set the text for the notification. + * + * @param text the text value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withText(String text) { + this.text = text; + return this; + } + + /** + * Get the subscription ID for the schedule. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscription ID for the schedule. + * + * @param subscriptionId the subscriptionId value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resource group name for the schedule. + * + * @return the resourceGroupName value + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resource group name for the schedule. + * + * @param resourceGroupName the resourceGroupName value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the lab for the schedule. + * + * @return the labName value + */ + public String labName() { + return this.labName; + } + + /** + * Set the lab for the schedule. + * + * @param labName the labName value to set + * @return the ShutdownNotificationContent object itself. + */ + public ShutdownNotificationContent withLabName(String labName) { + this.labName = labName; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SourceControlType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SourceControlType.java new file mode 100644 index 000000000000..c12335c48c07 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/StorageType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/StorageType.java new file mode 100644 index 000000000000..4118c010d048 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/StorageType.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for StorageType. + */ +public final class StorageType extends ExpandableStringEnum { + /** Static value Standard for StorageType. */ + public static final StorageType STANDARD = fromString("Standard"); + + /** Static value Premium for StorageType. */ + public static final StorageType PREMIUM = fromString("Premium"); + + /** + * Creates or finds a StorageType from its string representation. + * @param name a name to look for + * @return the corresponding StorageType + */ + @JsonCreator + public static StorageType fromString(String name) { + return fromString(name, StorageType.class); + } + + /** + * @return known StorageType values + */ + public static Collection values() { + return values(StorageType.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Subnet.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Subnet.java new file mode 100644 index 000000000000..9c01ea9e8e50 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Subnet.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subnet information. + */ +public class Subnet { + /** + * The resource ID of the subnet. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The name of the subnet as seen in the lab. + */ + @JsonProperty(value = "labSubnetName") + private String labSubnetName; + + /** + * The permission policy of the subnet for allowing public IP addresses + * (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', + * 'Allow'. + */ + @JsonProperty(value = "allowPublicIp") + private UsagePermissionType allowPublicIp; + + /** + * Get the resource ID of the subnet. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource ID of the subnet. + * + * @param resourceId the resourceId value to set + * @return the Subnet object itself. + */ + public Subnet withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the name of the subnet as seen in the lab. + * + * @return the labSubnetName value + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set the name of the subnet as seen in the lab. + * + * @param labSubnetName the labSubnetName value to set + * @return the Subnet object itself. + */ + public Subnet withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get the permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow'. + * + * @return the allowPublicIp value + */ + public UsagePermissionType allowPublicIp() { + return this.allowPublicIp; + } + + /** + * Set the permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetFragment.java new file mode 100644 index 000000000000..fdcc37769ad6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Subnet information. + */ +public class SubnetFragment { + /** + * The resource ID of the subnet. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The name of the subnet as seen in the lab. + */ + @JsonProperty(value = "labSubnetName") + private String labSubnetName; + + /** + * The permission policy of the subnet for allowing public IP addresses + * (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', + * 'Allow'. + */ + @JsonProperty(value = "allowPublicIp") + private UsagePermissionType allowPublicIp; + + /** + * Get the resource ID of the subnet. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource ID of the subnet. + * + * @param resourceId the resourceId value to set + * @return the SubnetFragment object itself. + */ + public SubnetFragment withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the name of the subnet as seen in the lab. + * + * @return the labSubnetName value + */ + public String labSubnetName() { + return this.labSubnetName; + } + + /** + * Set the name of the subnet as seen in the lab. + * + * @param labSubnetName the labSubnetName value to set + * @return the SubnetFragment object itself. + */ + public SubnetFragment withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get the permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow'. + * + * @return the allowPublicIp value + */ + public UsagePermissionType allowPublicIp() { + return this.allowPublicIp; + } + + /** + * Set the permission policy of the subnet for allowing public IP addresses (i.e. Allow, Deny)). Possible values include: 'Default', 'Deny', 'Allow'. + * + * @param allowPublicIp the allowPublicIp value to set + * @return the SubnetFragment object itself. + */ + public SubnetFragment withAllowPublicIp(UsagePermissionType allowPublicIp) { + this.allowPublicIp = allowPublicIp; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetOverride.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetOverride.java new file mode 100644 index 000000000000..06cbe6287e1c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetOverride.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Property overrides on a subnet of a virtual network. + */ +public class SubnetOverride { + /** + * The resource ID of the subnet. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The name given to the subnet within the lab. + */ + @JsonProperty(value = "labSubnetName") + private String labSubnetName; + + /** + * Indicates whether this subnet can be used during virtual machine + * creation (i.e. Allow, Deny). 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 (i.e. Allow, Deny). Possible values include: + * 'Default', 'Deny', 'Allow'. + */ + @JsonProperty(value = "usePublicIpAddressPermission") + private UsagePermissionType usePublicIpAddressPermission; + + /** + * Properties that virtual machines on this subnet will share. + */ + @JsonProperty(value = "sharedPublicIpAddressConfiguration") + private SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration; + + /** + * The virtual network pool associated with this subnet. + */ + @JsonProperty(value = "virtualNetworkPoolName") + private String virtualNetworkPoolName; + + /** + * Get the resource ID of the subnet. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource ID of the subnet. + * + * @param resourceId the resourceId value to set + * @return the SubnetOverride object itself. + */ + public SubnetOverride withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the 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 (i.e. Allow, Deny). 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 (i.e. Allow, Deny). 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 (i.e. Allow, Deny). 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 (i.e. Allow, Deny). 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; + } + + /** + * Get properties that virtual machines on this subnet will share. + * + * @return the sharedPublicIpAddressConfiguration value + */ + public SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration() { + return this.sharedPublicIpAddressConfiguration; + } + + /** + * Set properties that virtual machines on this subnet will share. + * + * @param sharedPublicIpAddressConfiguration the sharedPublicIpAddressConfiguration value to set + * @return the SubnetOverride object itself. + */ + public SubnetOverride withSharedPublicIpAddressConfiguration(SubnetSharedPublicIpAddressConfiguration sharedPublicIpAddressConfiguration) { + this.sharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + return this; + } + + /** + * Get the virtual network pool associated with this subnet. + * + * @return the virtualNetworkPoolName value + */ + public String virtualNetworkPoolName() { + return this.virtualNetworkPoolName; + } + + /** + * Set the virtual network pool associated with this subnet. + * + * @param virtualNetworkPoolName the virtualNetworkPoolName value to set + * @return the SubnetOverride object itself. + */ + public SubnetOverride withVirtualNetworkPoolName(String virtualNetworkPoolName) { + this.virtualNetworkPoolName = virtualNetworkPoolName; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetOverrideFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetOverrideFragment.java new file mode 100644 index 000000000000..af931cfbc4bc --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetOverrideFragment.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Property overrides on a subnet of a virtual network. + */ +public class SubnetOverrideFragment { + /** + * The resource ID of the subnet. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The name given to the subnet within the lab. + */ + @JsonProperty(value = "labSubnetName") + private String labSubnetName; + + /** + * Indicates whether this subnet can be used during virtual machine + * creation (i.e. Allow, Deny). 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 (i.e. Allow, Deny). Possible values include: + * 'Default', 'Deny', 'Allow'. + */ + @JsonProperty(value = "usePublicIpAddressPermission") + private UsagePermissionType usePublicIpAddressPermission; + + /** + * Properties that virtual machines on this subnet will share. + */ + @JsonProperty(value = "sharedPublicIpAddressConfiguration") + private SubnetSharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration; + + /** + * The virtual network pool associated with this subnet. + */ + @JsonProperty(value = "virtualNetworkPoolName") + private String virtualNetworkPoolName; + + /** + * Get the resource ID of the subnet. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource ID of the subnet. + * + * @param resourceId the resourceId value to set + * @return the SubnetOverrideFragment object itself. + */ + public SubnetOverrideFragment 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 SubnetOverrideFragment object itself. + */ + public SubnetOverrideFragment withLabSubnetName(String labSubnetName) { + this.labSubnetName = labSubnetName; + return this; + } + + /** + * Get indicates whether this subnet can be used during virtual machine creation (i.e. Allow, Deny). 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 (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow'. + * + * @param useInVmCreationPermission the useInVmCreationPermission value to set + * @return the SubnetOverrideFragment object itself. + */ + public SubnetOverrideFragment withUseInVmCreationPermission(UsagePermissionType useInVmCreationPermission) { + this.useInVmCreationPermission = useInVmCreationPermission; + return this; + } + + /** + * Get indicates whether public IP addresses can be assigned to virtual machines on this subnet (i.e. Allow, Deny). 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 (i.e. Allow, Deny). Possible values include: 'Default', 'Deny', 'Allow'. + * + * @param usePublicIpAddressPermission the usePublicIpAddressPermission value to set + * @return the SubnetOverrideFragment object itself. + */ + public SubnetOverrideFragment withUsePublicIpAddressPermission(UsagePermissionType usePublicIpAddressPermission) { + this.usePublicIpAddressPermission = usePublicIpAddressPermission; + return this; + } + + /** + * Get properties that virtual machines on this subnet will share. + * + * @return the sharedPublicIpAddressConfiguration value + */ + public SubnetSharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration() { + return this.sharedPublicIpAddressConfiguration; + } + + /** + * Set properties that virtual machines on this subnet will share. + * + * @param sharedPublicIpAddressConfiguration the sharedPublicIpAddressConfiguration value to set + * @return the SubnetOverrideFragment object itself. + */ + public SubnetOverrideFragment withSharedPublicIpAddressConfiguration(SubnetSharedPublicIpAddressConfigurationFragment sharedPublicIpAddressConfiguration) { + this.sharedPublicIpAddressConfiguration = sharedPublicIpAddressConfiguration; + return this; + } + + /** + * Get the virtual network pool associated with this subnet. + * + * @return the virtualNetworkPoolName value + */ + public String virtualNetworkPoolName() { + return this.virtualNetworkPoolName; + } + + /** + * Set the virtual network pool associated with this subnet. + * + * @param virtualNetworkPoolName the virtualNetworkPoolName value to set + * @return the SubnetOverrideFragment object itself. + */ + public SubnetOverrideFragment withVirtualNetworkPoolName(String virtualNetworkPoolName) { + this.virtualNetworkPoolName = virtualNetworkPoolName; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetSharedPublicIpAddressConfiguration.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetSharedPublicIpAddressConfiguration.java new file mode 100644 index 000000000000..675efd8f6896 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetSharedPublicIpAddressConfiguration.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Configuration for public IP address sharing. + */ +public class SubnetSharedPublicIpAddressConfiguration { + /** + * Backend ports that virtual machines on this subnet are allowed to + * expose. + */ + @JsonProperty(value = "allowedPorts") + private List allowedPorts; + + /** + * Get backend ports that virtual machines on this subnet are allowed to expose. + * + * @return the allowedPorts value + */ + public List allowedPorts() { + return this.allowedPorts; + } + + /** + * Set backend ports that virtual machines on this subnet are allowed to expose. + * + * @param allowedPorts the allowedPorts value to set + * @return the SubnetSharedPublicIpAddressConfiguration object itself. + */ + public SubnetSharedPublicIpAddressConfiguration withAllowedPorts(List allowedPorts) { + this.allowedPorts = allowedPorts; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetSharedPublicIpAddressConfigurationFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetSharedPublicIpAddressConfigurationFragment.java new file mode 100644 index 000000000000..17e0bfc146f7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/SubnetSharedPublicIpAddressConfigurationFragment.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Configuration for public IP address sharing. + */ +public class SubnetSharedPublicIpAddressConfigurationFragment { + /** + * Backend ports that virtual machines on this subnet are allowed to + * expose. + */ + @JsonProperty(value = "allowedPorts") + private List allowedPorts; + + /** + * Get backend ports that virtual machines on this subnet are allowed to expose. + * + * @return the allowedPorts value + */ + public List allowedPorts() { + return this.allowedPorts; + } + + /** + * Set backend ports that virtual machines on this subnet are allowed to expose. + * + * @param allowedPorts the allowedPorts value to set + * @return the SubnetSharedPublicIpAddressConfigurationFragment object itself. + */ + public SubnetSharedPublicIpAddressConfigurationFragment withAllowedPorts(List allowedPorts) { + this.allowedPorts = allowedPorts; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TargetCostProperties.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TargetCostProperties.java new file mode 100644 index 000000000000..91b4cde6725d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TargetCostProperties.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.v2016_05_15; + +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a cost target. + */ +public class TargetCostProperties { + /** + * Target cost status. Possible values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "status") + private TargetCostStatus status; + + /** + * Lab target cost. + */ + @JsonProperty(value = "target") + private Integer target; + + /** + * Cost thresholds. + */ + @JsonProperty(value = "costThresholds") + private List costThresholds; + + /** + * Reporting cycle start date. + */ + @JsonProperty(value = "cycleStartDateTime") + private DateTime cycleStartDateTime; + + /** + * Reporting cycle end date. + */ + @JsonProperty(value = "cycleEndDateTime") + private DateTime cycleEndDateTime; + + /** + * Reporting cycle type. Possible values include: 'CalendarMonth', + * 'Custom'. + */ + @JsonProperty(value = "cycleType") + private ReportingCycleType cycleType; + + /** + * Get target cost status. Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public TargetCostStatus status() { + return this.status; + } + + /** + * Set target cost status. Possible values include: 'Enabled', 'Disabled'. + * + * @param status the status value to set + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withStatus(TargetCostStatus status) { + this.status = status; + return this; + } + + /** + * Get lab target cost. + * + * @return the target value + */ + public Integer target() { + return this.target; + } + + /** + * Set lab target cost. + * + * @param target the target value to set + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withTarget(Integer target) { + this.target = target; + return this; + } + + /** + * Get cost thresholds. + * + * @return the costThresholds value + */ + public List costThresholds() { + return this.costThresholds; + } + + /** + * Set cost thresholds. + * + * @param costThresholds the costThresholds value to set + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCostThresholds(List costThresholds) { + this.costThresholds = costThresholds; + return this; + } + + /** + * Get reporting cycle start date. + * + * @return the cycleStartDateTime value + */ + public DateTime cycleStartDateTime() { + return this.cycleStartDateTime; + } + + /** + * Set reporting cycle start date. + * + * @param cycleStartDateTime the cycleStartDateTime value to set + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCycleStartDateTime(DateTime cycleStartDateTime) { + this.cycleStartDateTime = cycleStartDateTime; + return this; + } + + /** + * Get reporting cycle end date. + * + * @return the cycleEndDateTime value + */ + public DateTime cycleEndDateTime() { + return this.cycleEndDateTime; + } + + /** + * Set reporting cycle end date. + * + * @param cycleEndDateTime the cycleEndDateTime value to set + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCycleEndDateTime(DateTime cycleEndDateTime) { + this.cycleEndDateTime = cycleEndDateTime; + return this; + } + + /** + * Get reporting cycle type. Possible values include: 'CalendarMonth', 'Custom'. + * + * @return the cycleType value + */ + public ReportingCycleType cycleType() { + return this.cycleType; + } + + /** + * Set reporting cycle type. Possible values include: 'CalendarMonth', 'Custom'. + * + * @param cycleType the cycleType value to set + * @return the TargetCostProperties object itself. + */ + public TargetCostProperties withCycleType(ReportingCycleType cycleType) { + this.cycleType = cycleType; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TargetCostStatus.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TargetCostStatus.java new file mode 100644 index 000000000000..12c77189655a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TargetCostStatus.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TargetCostStatus. + */ +public final class TargetCostStatus extends ExpandableStringEnum { + /** Static value Enabled for TargetCostStatus. */ + public static final TargetCostStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for TargetCostStatus. */ + public static final TargetCostStatus DISABLED = fromString("Disabled"); + + /** + * Creates or finds a TargetCostStatus from its string representation. + * @param name a name to look for + * @return the corresponding TargetCostStatus + */ + @JsonCreator + public static TargetCostStatus fromString(String name) { + return fromString(name, TargetCostStatus.class); + } + + /** + * @return known TargetCostStatus values + */ + public static Collection values() { + return values(TargetCostStatus.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TransportProtocol.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TransportProtocol.java new file mode 100644 index 000000000000..c495a74be73f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/TransportProtocol.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TransportProtocol. + */ +public final class TransportProtocol extends ExpandableStringEnum { + /** Static value Tcp for TransportProtocol. */ + public static final TransportProtocol TCP = fromString("Tcp"); + + /** Static value Udp for TransportProtocol. */ + public static final TransportProtocol UDP = fromString("Udp"); + + /** + * Creates or finds a TransportProtocol from its string representation. + * @param name a name to look for + * @return the corresponding TransportProtocol + */ + @JsonCreator + public static TransportProtocol fromString(String name) { + return fromString(name, TransportProtocol.class); + } + + /** + * @return known TransportProtocol values + */ + public static Collection values() { + return values(TransportProtocol.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UsagePermissionType.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UsagePermissionType.java new file mode 100644 index 000000000000..678bf116cc9e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/User.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/User.java new file mode 100644 index 000000000000..63f7c6afb3ab --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/User.java @@ -0,0 +1,269 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.UserInner; +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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing User. + */ +public interface User extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the identity value. + */ + UserIdentity identity(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the secretStore value. + */ + UserSecretStore secretStore(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * The entirety of the User definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, DefinitionStages.WithCreate { + } + + /** + * Grouping of User definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a User definition. + */ + interface Blank extends WithLab { + } + + /** + * The stage of the user 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * The stage of the user definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the user + * @return the next definition stage + */ + WithCreate withIdentity(UserIdentity identity); + } + + /** + * The stage of the user definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the user 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 user definition allowing to specify SecretStore. + */ + interface WithSecretStore { + /** + * Specifies secretStore. + * @param secretStore The secret store of the user + * @return the next definition stage + */ + WithCreate withSecretStore(UserSecretStore secretStore); + } + + /** + * The stage of the user definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the user definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithIdentity, DefinitionStages.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithSecretStore, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier { + } + } + /** + * The template for a User update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithIdentity, UpdateStages.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithSecretStore, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier { + } + + /** + * Grouping of User update stages. + */ + interface UpdateStages { + /** + * The stage of the user update allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the user + * @return the next update stage + */ + Update withIdentity(UserIdentityFragment identity); + } + + /** + * The stage of the user update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the user 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 user update allowing to specify SecretStore. + */ + interface WithSecretStore { + /** + * Specifies secretStore. + * @param secretStore The secret store of the user + * @return the next update stage + */ + Update withSecretStore(UserSecretStoreFragment secretStore); + } + + /** + * The stage of the user update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the user update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserFragment.java new file mode 100644 index 000000000000..172b73880d44 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserFragment.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Profile of a lab user. + */ +@JsonFlatten +@SkipParentValidation +public class UserFragment extends Resource { + /** + * The identity of the user. + */ + @JsonProperty(value = "properties.identity") + private UserIdentityFragment identity; + + /** + * The secret store of the user. + */ + @JsonProperty(value = "properties.secretStore") + private UserSecretStoreFragment secretStore; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the identity of the user. + * + * @return the identity value + */ + public UserIdentityFragment identity() { + return this.identity; + } + + /** + * Set the identity of the user. + * + * @param identity the identity value to set + * @return the UserFragment object itself. + */ + public UserFragment withIdentity(UserIdentityFragment identity) { + this.identity = identity; + return this; + } + + /** + * Get the secret store of the user. + * + * @return the secretStore value + */ + public UserSecretStoreFragment secretStore() { + return this.secretStore; + } + + /** + * Set the secret store of the user. + * + * @param secretStore the secretStore value to set + * @return the UserFragment object itself. + */ + public UserFragment withSecretStore(UserSecretStoreFragment secretStore) { + this.secretStore = secretStore; + 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 UserFragment object itself. + */ + public UserFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the UserFragment object itself. + */ + public UserFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserIdentity.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserIdentity.java new file mode 100644 index 000000000000..d900fc183ff8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserIdentity.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity attributes of a lab user. + */ +public class UserIdentity { + /** + * Set to the principal name / UPN of the client JWT making the request. + */ + @JsonProperty(value = "principalName") + private String principalName; + + /** + * Set to the principal Id of the client JWT making the request. Service + * principal will not have the principal Id. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * Set to the tenant ID of the client JWT making the request. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Set to the object Id of the client JWT making the request. Not all users + * have object Id. For CSP (reseller) scenarios for example, object Id is + * not available. + */ + @JsonProperty(value = "objectId") + private String objectId; + + /** + * Set to the app Id of the client JWT making the request. + */ + @JsonProperty(value = "appId") + private String appId; + + /** + * Get set to the principal name / UPN of the client JWT making the request. + * + * @return the principalName value + */ + public String principalName() { + return this.principalName; + } + + /** + * Set set to the principal name / UPN of the client JWT making the request. + * + * @param principalName the principalName value to set + * @return the UserIdentity object itself. + */ + public UserIdentity withPrincipalName(String principalName) { + this.principalName = principalName; + return this; + } + + /** + * Get set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. + * + * @param principalId the principalId value to set + * @return the UserIdentity object itself. + */ + public UserIdentity withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get set to the tenant ID of the client JWT making the request. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set set to the tenant ID of the client JWT making the request. + * + * @param tenantId the tenantId value to set + * @return the UserIdentity object itself. + */ + public UserIdentity withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. + * + * @return the objectId value + */ + public String objectId() { + return this.objectId; + } + + /** + * Set set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. + * + * @param objectId the objectId value to set + * @return the UserIdentity object itself. + */ + public UserIdentity withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get set to the app Id of the client JWT making the request. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Set set to the app Id of the client JWT making the request. + * + * @param appId the appId value to set + * @return the UserIdentity object itself. + */ + public UserIdentity withAppId(String appId) { + this.appId = appId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserIdentityFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserIdentityFragment.java new file mode 100644 index 000000000000..f9d821aa2319 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserIdentityFragment.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity attributes of a lab user. + */ +public class UserIdentityFragment { + /** + * Set to the principal name / UPN of the client JWT making the request. + */ + @JsonProperty(value = "principalName") + private String principalName; + + /** + * Set to the principal Id of the client JWT making the request. Service + * principal will not have the principal Id. + */ + @JsonProperty(value = "principalId") + private String principalId; + + /** + * Set to the tenant ID of the client JWT making the request. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** + * Set to the object Id of the client JWT making the request. Not all users + * have object Id. For CSP (reseller) scenarios for example, object Id is + * not available. + */ + @JsonProperty(value = "objectId") + private String objectId; + + /** + * Set to the app Id of the client JWT making the request. + */ + @JsonProperty(value = "appId") + private String appId; + + /** + * Get set to the principal name / UPN of the client JWT making the request. + * + * @return the principalName value + */ + public String principalName() { + return this.principalName; + } + + /** + * Set set to the principal name / UPN of the client JWT making the request. + * + * @param principalName the principalName value to set + * @return the UserIdentityFragment object itself. + */ + public UserIdentityFragment withPrincipalName(String principalName) { + this.principalName = principalName; + return this; + } + + /** + * Get set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Set set to the principal Id of the client JWT making the request. Service principal will not have the principal Id. + * + * @param principalId the principalId value to set + * @return the UserIdentityFragment object itself. + */ + public UserIdentityFragment withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get set to the tenant ID of the client JWT making the request. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set set to the tenant ID of the client JWT making the request. + * + * @param tenantId the tenantId value to set + * @return the UserIdentityFragment object itself. + */ + public UserIdentityFragment withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. + * + * @return the objectId value + */ + public String objectId() { + return this.objectId; + } + + /** + * Set set to the object Id of the client JWT making the request. Not all users have object Id. For CSP (reseller) scenarios for example, object Id is not available. + * + * @param objectId the objectId value to set + * @return the UserIdentityFragment object itself. + */ + public UserIdentityFragment withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get set to the app Id of the client JWT making the request. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Set set to the app Id of the client JWT making the request. + * + * @param appId the appId value to set + * @return the UserIdentityFragment object itself. + */ + public UserIdentityFragment withAppId(String appId) { + this.appId = appId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserSecretStore.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserSecretStore.java new file mode 100644 index 000000000000..a9032c7d7eae --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserSecretStore.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a user's secret store. + */ +public class UserSecretStore { + /** + * The URI of the user's Key vault. + */ + @JsonProperty(value = "keyVaultUri") + private String keyVaultUri; + + /** + * The ID of the user's Key vault. + */ + @JsonProperty(value = "keyVaultId") + private String keyVaultId; + + /** + * Get the URI of the user's Key vault. + * + * @return the keyVaultUri value + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the URI of the user's Key vault. + * + * @param keyVaultUri the keyVaultUri value to set + * @return the UserSecretStore object itself. + */ + public UserSecretStore withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the ID of the user's Key vault. + * + * @return the keyVaultId value + */ + public String keyVaultId() { + return this.keyVaultId; + } + + /** + * Set the ID of the user's Key vault. + * + * @param keyVaultId the keyVaultId value to set + * @return the UserSecretStore object itself. + */ + public UserSecretStore withKeyVaultId(String keyVaultId) { + this.keyVaultId = keyVaultId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserSecretStoreFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserSecretStoreFragment.java new file mode 100644 index 000000000000..969ddf0a8ffa --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/UserSecretStoreFragment.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a user's secret store. + */ +public class UserSecretStoreFragment { + /** + * The URI of the user's Key vault. + */ + @JsonProperty(value = "keyVaultUri") + private String keyVaultUri; + + /** + * The ID of the user's Key vault. + */ + @JsonProperty(value = "keyVaultId") + private String keyVaultId; + + /** + * Get the URI of the user's Key vault. + * + * @return the keyVaultUri value + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the URI of the user's Key vault. + * + * @param keyVaultUri the keyVaultUri value to set + * @return the UserSecretStoreFragment object itself. + */ + public UserSecretStoreFragment withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the ID of the user's Key vault. + * + * @return the keyVaultId value + */ + public String keyVaultId() { + return this.keyVaultId; + } + + /** + * Set the ID of the user's Key vault. + * + * @param keyVaultId the keyVaultId value to set + * @return the UserSecretStoreFragment object itself. + */ + public UserSecretStoreFragment withKeyVaultId(String keyVaultId) { + this.keyVaultId = keyVaultId; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Users.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Users.java new file mode 100644 index 000000000000..085ac7c0f68a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/Users.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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.UsersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Users. + */ +public interface Users extends SupportsCreating, HasInner { + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String name); + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName); + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachineCreationSource.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachineCreationSource.java new file mode 100644 index 000000000000..2209e51a6a83 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachineCreationSource.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.v2016_05_15; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for VirtualMachineCreationSource. + */ +public final class VirtualMachineCreationSource extends ExpandableStringEnum { + /** Static value FromCustomImage for VirtualMachineCreationSource. */ + public static final VirtualMachineCreationSource FROM_CUSTOM_IMAGE = fromString("FromCustomImage"); + + /** Static value FromGalleryImage for VirtualMachineCreationSource. */ + public static final VirtualMachineCreationSource FROM_GALLERY_IMAGE = fromString("FromGalleryImage"); + + /** + * Creates or finds a VirtualMachineCreationSource from its string representation. + * @param name a name to look for + * @return the corresponding VirtualMachineCreationSource + */ + @JsonCreator + public static VirtualMachineCreationSource fromString(String name) { + return fromString(name, VirtualMachineCreationSource.class); + } + + /** + * @return known VirtualMachineCreationSource values + */ + public static Collection values() { + return values(VirtualMachineCreationSource.class); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachineSchedules.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachineSchedules.java new file mode 100644 index 000000000000..90946fcb9e1f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachineSchedules.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.VirtualMachineSchedulesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualMachineSchedules. + */ +public interface VirtualMachineSchedules 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, String name); + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String labName, String virtualMachineName, String name); + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String resourceGroupName, final String labName, final String virtualMachineName); + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String labName, String virtualMachineName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachines.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachines.java new file mode 100644 index 000000000000..65c34bc0fcf8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualMachines.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation.VirtualMachinesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualMachines. + */ +public interface VirtualMachines extends SupportsCreating, HasInner { + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable addDataDiskAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties); + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable applyArtifactsAsync(String resourceGroupName, String labName, String name); + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable claimAsync(String resourceGroupName, String labName, String name); + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable detachDataDiskAsync(String resourceGroupName, String labName, String name); + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listApplicableSchedulesAsync(String resourceGroupName, String labName, String name); + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable startAsync(String resourceGroupName, String labName, String name); + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @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 getAsync(String resourceGroupName, String labName, String name); + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetwork.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetwork.java new file mode 100644 index 000000000000..9a5de3eea8a2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetwork.java @@ -0,0 +1,357 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing VirtualNetwork. + */ +public interface VirtualNetwork extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the allowedSubnets value. + */ + List allowedSubnets(); + + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the externalProviderResourceId value. + */ + String externalProviderResourceId(); + + /** + * @return the externalSubnets value. + */ + List externalSubnets(); + + /** + * @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(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * The entirety of the VirtualNetwork definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLab, 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 + */ + WithCreate withExistingLab(String resourceGroupName, String labName); + } + + /** + * 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 ExternalSubnets. + */ + interface WithExternalSubnets { + /** + * Specifies externalSubnets. + * @param externalSubnets The external subnet properties + * @return the next definition stage + */ + WithCreate withExternalSubnets(List externalSubnets); + } + + /** + * The stage of the virtualnetwork definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * 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 of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the virtualnetwork definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * 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.WithExternalSubnets, DefinitionStages.WithLocation, DefinitionStages.WithProvisioningState, DefinitionStages.WithSubnetOverrides, DefinitionStages.WithTags, DefinitionStages.WithUniqueIdentifier { + } + } + /** + * 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.WithExternalSubnets, UpdateStages.WithLocation, UpdateStages.WithProvisioningState, UpdateStages.WithSubnetOverrides, UpdateStages.WithTags, UpdateStages.WithUniqueIdentifier { + } + + /** + * 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 ExternalSubnets. + */ + interface WithExternalSubnets { + /** + * Specifies externalSubnets. + * @param externalSubnets The external subnet properties + * @return the next update stage + */ + Update withExternalSubnets(List externalSubnets); + } + + /** + * The stage of the virtualnetwork update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * 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 of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the virtualnetwork update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetworkFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetworkFragment.java new file mode 100644 index 000000000000..25f2089f4bc8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetworkFragment.java @@ -0,0 +1,205 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A virtual network. + */ +@JsonFlatten +@SkipParentValidation +public class VirtualNetworkFragment 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 external subnet properties. + */ + @JsonProperty(value = "properties.externalSubnets") + private List externalSubnets; + + /** + * 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; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * 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 VirtualNetworkFragment object itself. + */ + public VirtualNetworkFragment 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 VirtualNetworkFragment object itself. + */ + public VirtualNetworkFragment 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 VirtualNetworkFragment object itself. + */ + public VirtualNetworkFragment withExternalProviderResourceId(String externalProviderResourceId) { + this.externalProviderResourceId = externalProviderResourceId; + return this; + } + + /** + * Get the external subnet properties. + * + * @return the externalSubnets value + */ + public List externalSubnets() { + return this.externalSubnets; + } + + /** + * Set the external subnet properties. + * + * @param externalSubnets the externalSubnets value to set + * @return the VirtualNetworkFragment object itself. + */ + public VirtualNetworkFragment withExternalSubnets(List externalSubnets) { + this.externalSubnets = externalSubnets; + 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 VirtualNetworkFragment object itself. + */ + public VirtualNetworkFragment 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 VirtualNetworkFragment object itself. + */ + public VirtualNetworkFragment withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the VirtualNetworkFragment object itself. + */ + public VirtualNetworkFragment withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetworks.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualNetworks.java new file mode 100644 index 000000000000..cd0833939def --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name); + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 deleteAsync(String resourceGroupName, String labName, String name); + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualmachineLabSchedule.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualmachineLabSchedule.java new file mode 100644 index 000000000000..adca75a210c5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/VirtualmachineLabSchedule.java @@ -0,0 +1,444 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.implementation.DevTestLabsManager; +import java.util.Map; +import org.joda.time.DateTime; + +/** + * Type representing VirtualmachineLabSchedule. + */ +public interface VirtualmachineLabSchedule extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the createdDate value. + */ + DateTime createdDate(); + + /** + * @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 notificationSettings value. + */ + NotificationSettings notificationSettings(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the status value. + */ + EnableStatus status(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * @return the taskType value. + */ + String taskType(); + + /** + * @return the timeZoneId value. + */ + String timeZoneId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the uniqueIdentifier value. + */ + String uniqueIdentifier(); + + /** + * @return the weeklyRecurrence value. + */ + WeekDetails weeklyRecurrence(); + + /** + * The entirety of the VirtualmachineLabSchedule definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithVirtualmachine, DefinitionStages.WithCreate { + } + + /** + * Grouping of VirtualmachineLabSchedule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a VirtualmachineLabSchedule definition. + */ + interface Blank extends WithVirtualmachine { + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify Virtualmachine. + */ + interface WithVirtualmachine { + /** + * Specifies resourceGroupName, labName, virtualMachineName. + * @param resourceGroupName The name of the resource group + * @param labName The name of the lab + * @param virtualMachineName The name of the virtual machine + * @return the next definition stage + */ + WithCreate withExistingVirtualmachine(String resourceGroupName, String labName, String virtualMachineName); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify DailyRecurrence. + */ + interface WithDailyRecurrence { + /** + * Specifies dailyRecurrence. + * @param dailyRecurrence If the schedule will occur once each day of the week, specify the daily recurrence + * @return the next definition stage + */ + WithCreate withDailyRecurrence(DayDetails dailyRecurrence); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence If the schedule will occur multiple times a day, specify the hourly recurrence + * @return the next definition stage + */ + WithCreate withHourlyRecurrence(HourDetails hourlyRecurrence); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify NotificationSettings. + */ + interface WithNotificationSettings { + /** + * Specifies notificationSettings. + * @param notificationSettings Notification settings + * @return the next definition stage + */ + WithCreate withNotificationSettings(NotificationSettings notificationSettings); + } + + /** + * The stage of the virtualmachinelabschedule 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 virtualmachinelabschedule definition allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withStatus(EnableStatus status); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify TargetResourceId. + */ + interface WithTargetResourceId { + /** + * Specifies targetResourceId. + * @param targetResourceId The resource ID to which the schedule belongs + * @return the next definition stage + */ + WithCreate withTargetResourceId(String targetResourceId); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart) + * @return the next definition stage + */ + WithCreate withTaskType(String taskType); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone ID (e.g. Pacific Standard time) + * @return the next definition stage + */ + WithCreate withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next definition stage + */ + WithCreate withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the virtualmachinelabschedule definition allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence If the schedule will occur only some days of the week, specify the weekly recurrence + * @return the next definition stage + */ + WithCreate withWeeklyRecurrence(WeekDetails weeklyRecurrence); + } + + /** + * The stage of the 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.WithLocation, DefinitionStages.WithNotificationSettings, DefinitionStages.WithProvisioningState, DefinitionStages.WithStatus, DefinitionStages.WithTags, DefinitionStages.WithTargetResourceId, DefinitionStages.WithTaskType, DefinitionStages.WithTimeZoneId, DefinitionStages.WithUniqueIdentifier, DefinitionStages.WithWeeklyRecurrence { + } + } + /** + * The template for a VirtualmachineLabSchedule update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithDailyRecurrence, UpdateStages.WithHourlyRecurrence, UpdateStages.WithLocation, UpdateStages.WithNotificationSettings, UpdateStages.WithProvisioningState, UpdateStages.WithStatus, UpdateStages.WithTags, UpdateStages.WithTargetResourceId, UpdateStages.WithTaskType, UpdateStages.WithTimeZoneId, UpdateStages.WithUniqueIdentifier, UpdateStages.WithWeeklyRecurrence { + } + + /** + * Grouping of VirtualmachineLabSchedule update stages. + */ + interface UpdateStages { + /** + * The stage of the virtualmachinelabschedule update allowing to specify DailyRecurrence. + */ + interface WithDailyRecurrence { + /** + * Specifies dailyRecurrence. + * @param dailyRecurrence If the schedule will occur once each day of the week, specify the daily recurrence + * @return the next update stage + */ + Update withDailyRecurrence(DayDetailsFragment dailyRecurrence); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify HourlyRecurrence. + */ + interface WithHourlyRecurrence { + /** + * Specifies hourlyRecurrence. + * @param hourlyRecurrence If the schedule will occur multiple times a day, specify the hourly recurrence + * @return the next update stage + */ + Update withHourlyRecurrence(HourDetailsFragment hourlyRecurrence); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location The location of the resource + * @return the next update stage + */ + Update withLocation(String location); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify NotificationSettings. + */ + interface WithNotificationSettings { + /** + * Specifies notificationSettings. + * @param notificationSettings Notification settings + * @return the next update stage + */ + Update withNotificationSettings(NotificationSettingsFragment notificationSettings); + } + + /** + * The stage of the virtualmachinelabschedule 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 virtualmachinelabschedule update allowing to specify Status. + */ + interface WithStatus { + /** + * Specifies status. + * @param status The status of the schedule (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withStatus(EnableStatus status); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags of the resource + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify TargetResourceId. + */ + interface WithTargetResourceId { + /** + * Specifies targetResourceId. + * @param targetResourceId The resource ID to which the schedule belongs + * @return the next update stage + */ + Update withTargetResourceId(String targetResourceId); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify TaskType. + */ + interface WithTaskType { + /** + * Specifies taskType. + * @param taskType The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart) + * @return the next update stage + */ + Update withTaskType(String taskType); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify TimeZoneId. + */ + interface WithTimeZoneId { + /** + * Specifies timeZoneId. + * @param timeZoneId The time zone ID (e.g. Pacific Standard time) + * @return the next update stage + */ + Update withTimeZoneId(String timeZoneId); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify UniqueIdentifier. + */ + interface WithUniqueIdentifier { + /** + * Specifies uniqueIdentifier. + * @param uniqueIdentifier The unique immutable identifier of a resource (Guid) + * @return the next update stage + */ + Update withUniqueIdentifier(String uniqueIdentifier); + } + + /** + * The stage of the virtualmachinelabschedule update allowing to specify WeeklyRecurrence. + */ + interface WithWeeklyRecurrence { + /** + * Specifies weeklyRecurrence. + * @param weeklyRecurrence If the schedule will occur only some days of the week, specify the weekly recurrence + * @return the next update stage + */ + Update withWeeklyRecurrence(WeekDetailsFragment weeklyRecurrence); + } + + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WeekDetails.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WeekDetails.java new file mode 100644 index 000000000000..4ffdf807b674 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WeekDetails.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a weekly schedule. + */ +public class WeekDetails { + /** + * The days of the week for which the schedule is set (e.g. Sunday, Monday, + * Tuesday, etc.). + */ + @JsonProperty(value = "weekdays") + private List weekdays; + + /** + * The time of the day the schedule will occur. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + * + * @return the weekdays value + */ + public List weekdays() { + return this.weekdays; + } + + /** + * Set the days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + * + * @param weekdays the weekdays value to set + * @return the WeekDetails object itself. + */ + public WeekDetails withWeekdays(List weekdays) { + this.weekdays = weekdays; + return this; + } + + /** + * Get the time of the day the schedule will occur. + * + * @return the time value + */ + public String time() { + return this.time; + } + + /** + * Set the time of the day the schedule will occur. + * + * @param time the time value to set + * @return the WeekDetails object itself. + */ + public WeekDetails withTime(String time) { + this.time = time; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WeekDetailsFragment.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WeekDetailsFragment.java new file mode 100644 index 000000000000..8f20f27e35e4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WeekDetailsFragment.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.v2016_05_15; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a weekly schedule. + */ +public class WeekDetailsFragment { + /** + * The days of the week for which the schedule is set (e.g. Sunday, Monday, + * Tuesday, etc.). + */ + @JsonProperty(value = "weekdays") + private List weekdays; + + /** + * The time of the day the schedule will occur. + */ + @JsonProperty(value = "time") + private String time; + + /** + * Get the days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + * + * @return the weekdays value + */ + public List weekdays() { + return this.weekdays; + } + + /** + * Set the days of the week for which the schedule is set (e.g. Sunday, Monday, Tuesday, etc.). + * + * @param weekdays the weekdays value to set + * @return the WeekDetailsFragment object itself. + */ + public WeekDetailsFragment withWeekdays(List weekdays) { + this.weekdays = weekdays; + return this; + } + + /** + * Get the time of the day the schedule will occur. + * + * @return the time value + */ + public String time() { + return this.time; + } + + /** + * Set the time of the day the schedule will occur. + * + * @param time the time value to set + * @return the WeekDetailsFragment object itself. + */ + public WeekDetailsFragment withTime(String time) { + this.time = time; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WindowsOsInfo.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WindowsOsInfo.java new file mode 100644 index 000000000000..aabb7dccd39e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WindowsOsInfo.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.v2016_05_15; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Information about a Windows OS. + */ +public class WindowsOsInfo { + /** + * The state of the Windows OS (i.e. NonSysprepped, SysprepRequested, + * SysprepApplied). Possible values include: 'NonSysprepped', + * 'SysprepRequested', 'SysprepApplied'. + */ + @JsonProperty(value = "windowsOsState") + private WindowsOsState windowsOsState; + + /** + * Get the state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). Possible values include: 'NonSysprepped', 'SysprepRequested', 'SysprepApplied'. + * + * @return the windowsOsState value + */ + public WindowsOsState windowsOsState() { + return this.windowsOsState; + } + + /** + * Set the state of the Windows OS (i.e. NonSysprepped, SysprepRequested, SysprepApplied). 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WindowsOsState.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/WindowsOsState.java new file mode 100644 index 000000000000..21d0cef058ad --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15; + +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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ApplicableScheduleImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ApplicableScheduleImpl.java new file mode 100644 index 000000000000..b645d0c8f537 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ApplicableScheduleImpl.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ApplicableSchedule; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; + +class ApplicableScheduleImpl extends WrapperImpl implements ApplicableSchedule { + private final DevTestLabsManager manager; + ApplicableScheduleImpl(ApplicableScheduleInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public ScheduleInner labVmsShutdown() { + return this.inner().labVmsShutdown(); + } + + @Override + public ScheduleInner labVmsStartup() { + return this.inner().labVmsStartup(); + } + + @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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ApplicableScheduleInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ApplicableScheduleInner.java new file mode 100644 index 000000000000..d21670e30b87 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ApplicableScheduleInner.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.v2016_05_15.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Schedules applicable to a virtual machine. The schedules may have been + * defined on a VM or on lab level. + */ +@JsonFlatten +@SkipParentValidation +public class ApplicableScheduleInner extends Resource { + /** + * The auto-shutdown schedule, if one has been set at the lab or lab + * resource level. + */ + @JsonProperty(value = "properties.labVmsShutdown") + private ScheduleInner labVmsShutdown; + + /** + * The auto-startup schedule, if one has been set at the lab or lab + * resource level. + */ + @JsonProperty(value = "properties.labVmsStartup") + private ScheduleInner labVmsStartup; + + /** + * Get the auto-shutdown schedule, if one has been set at the lab or lab resource level. + * + * @return the labVmsShutdown value + */ + public ScheduleInner labVmsShutdown() { + return this.labVmsShutdown; + } + + /** + * Set the auto-shutdown schedule, if one has been set at the lab or lab resource level. + * + * @param labVmsShutdown the labVmsShutdown value to set + * @return the ApplicableScheduleInner object itself. + */ + public ApplicableScheduleInner withLabVmsShutdown(ScheduleInner labVmsShutdown) { + this.labVmsShutdown = labVmsShutdown; + return this; + } + + /** + * Get the auto-startup schedule, if one has been set at the lab or lab resource level. + * + * @return the labVmsStartup value + */ + public ScheduleInner labVmsStartup() { + return this.labVmsStartup; + } + + /** + * Set the auto-startup schedule, if one has been set at the lab or lab resource level. + * + * @param labVmsStartup the labVmsStartup value to set + * @return the ApplicableScheduleInner object itself. + */ + public ApplicableScheduleInner withLabVmsStartup(ScheduleInner labVmsStartup) { + this.labVmsStartup = labVmsStartup; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateImpl.java new file mode 100644 index 000000000000..9309c588a72d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateImpl.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArmTemplate; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ParametersValueFileInfo; +import java.util.Map; + +class ArmTemplateImpl extends IndexableRefreshableWrapperImpl implements ArmTemplate { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String artifactSourceName; + private String name; + + ArmTemplateImpl(ArmTemplateInner 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(), "armtemplates"); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + ArmTemplatesInner client = this.manager().inner().armTemplates(); + return client.getAsync(this.resourceGroupName, this.labName, this.artifactSourceName, this.name); + } + + + + @Override + public Object contents() { + return this.inner().contents(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @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 List parametersValueFilesInfo() { + return this.inner().parametersValueFilesInfo(); + } + + @Override + public String publisher() { + return this.inner().publisher(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateInfoImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateInfoImpl.java new file mode 100644 index 000000000000..c35abf6e85ea --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateInfoInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateInfoInner.java new file mode 100644 index 000000000000..5d713639d511 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateInner.java new file mode 100644 index 000000000000..fead19c9bd4f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplateInner.java @@ -0,0 +1,131 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ParametersValueFileInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * An Azure Resource Manager template. + */ +@JsonFlatten +@SkipParentValidation +public class ArmTemplateInner extends Resource { + /** + * The display name of the ARM template. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The description of the ARM template. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The publisher of the ARM template. + */ + @JsonProperty(value = "properties.publisher", access = JsonProperty.Access.WRITE_ONLY) + private String publisher; + + /** + * The URI to the icon of the ARM template. + */ + @JsonProperty(value = "properties.icon", access = JsonProperty.Access.WRITE_ONLY) + private String icon; + + /** + * The contents of the ARM template. + */ + @JsonProperty(value = "properties.contents", access = JsonProperty.Access.WRITE_ONLY) + private Object contents; + + /** + * The creation date of the armTemplate. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * File name and parameter values information from all + * azuredeploy.*.parameters.json for the ARM template. + */ + @JsonProperty(value = "properties.parametersValueFilesInfo", access = JsonProperty.Access.WRITE_ONLY) + private List parametersValueFilesInfo; + + /** + * Get the display name of the ARM template. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the description of the ARM template. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the publisher of the ARM template. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the URI to the icon of the ARM template. + * + * @return the icon value + */ + public String icon() { + return this.icon; + } + + /** + * Get the contents of the ARM template. + * + * @return the contents value + */ + public Object contents() { + return this.contents; + } + + /** + * Get the creation date of the armTemplate. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Get file name and parameter values information from all azuredeploy.*.parameters.json for the ARM template. + * + * @return the parametersValueFilesInfo value + */ + public List parametersValueFilesInfo() { + return this.parametersValueFilesInfo; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplatesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplatesImpl.java new file mode 100644 index 000000000000..d746dffc589d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplatesImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArmTemplates; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArmTemplate; + +class ArmTemplatesImpl extends WrapperImpl implements ArmTemplates { + private final DevTestLabsManager manager; + + ArmTemplatesImpl(DevTestLabsManager manager) { + super(manager.inner().armTemplates()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + private ArmTemplateImpl wrapModel(ArmTemplateInner inner) { + return new ArmTemplateImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName, final String artifactSourceName) { + ArmTemplatesInner 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 ArmTemplate call(ArmTemplateInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String artifactSourceName, String name) { + ArmTemplatesInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, artifactSourceName, name) + .flatMap(new Func1>() { + @Override + public Observable call(ArmTemplateInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ArmTemplate)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplatesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplatesInner.java new file mode 100644 index 000000000000..7ae0f211e860 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArmTemplatesInner.java @@ -0,0 +1,662 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.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 ArmTemplates. + */ +public class ArmTemplatesInner { + /** The Retrofit service to perform REST calls. */ + private ArmTemplatesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of ArmTemplatesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ArmTemplatesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(ArmTemplatesService.class); + this.client = client; + } + + /** + * The interface defining all the services for ArmTemplates to be + * used by Retrofit to perform actually REST calls. + */ + interface ArmTemplatesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.ArmTemplates list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("artifactSourceName") String artifactSourceName, @Query("$expand") String expand, @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.v2016_05_15.ArmTemplates get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/armtemplates/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("artifactSourceName") String artifactSourceName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.ArmTemplates listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<ArmTemplateInner> 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 azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param 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 azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmTemplateInner> 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 azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmTemplateInner> 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 azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArmTemplateInner> 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, expand, 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 azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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<ArmTemplateInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String artifactSourceName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmTemplateInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ArmTemplateInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, 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 azure resource manager templates in a given artifact source. + * + 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 expand Specify the $expand query. Example: 'properties($select=displayName)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArmTemplateInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String artifactSourceName, final String expand, 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, expand, 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 azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ArmTemplateInner object if successful. + */ + public ArmTemplateInner get(String resourceGroupName, String labName, String artifactSourceName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name).toBlocking().single().body(); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @param 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 getAsync(String resourceGroupName, String labName, String artifactSourceName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name), serviceCallback); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmTemplateInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String artifactSourceName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name).map(new Func1, ArmTemplateInner>() { + @Override + public ArmTemplateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmTemplateInner object + */ + public Observable> getWithServiceResponseAsync(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."); + } + final String expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ArmTemplateInner object if successful. + */ + public ArmTemplateInner get(String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand).toBlocking().single().body(); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param 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 getAsync(String resourceGroupName, String labName, String artifactSourceName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand), serviceCallback); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmTemplateInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand).map(new Func1, ArmTemplateInner>() { + @Override + public ArmTemplateInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get azure resource manager template. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the azure Resource Manager template. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArmTemplateInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 azure resource manager templates in a given artifact source. + * + * @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<ArmTemplateInner> 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 azure resource manager templates in a given artifact source. + * + * @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 azure resource manager templates in a given artifact source. + * + * @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<ArmTemplateInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List azure resource manager templates in a given artifact source. + * + * @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<ArmTemplateInner> 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 azure resource manager templates in a given artifact source. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ArmTemplateInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactImpl.java new file mode 100644 index 000000000000..90c4eafc3e2c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactImpl.java @@ -0,0 +1,112 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Artifact; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +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.getAsync(this.resourceGroupName, this.labName, this.artifactSourceName, this.name); + } + + + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @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 String publisher() { + return this.inner().publisher(); + } + + @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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactInner.java new file mode 100644 index 000000000000..94bc2f638471 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactInner.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * An artifact. + */ +@JsonFlatten +@SkipParentValidation +public class ArtifactInner extends Resource { + /** + * The artifact's title. + */ + @JsonProperty(value = "properties.title", access = JsonProperty.Access.WRITE_ONLY) + private String title; + + /** + * The artifact's description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The artifact's publisher. + */ + @JsonProperty(value = "properties.publisher", access = JsonProperty.Access.WRITE_ONLY) + private String publisher; + + /** + * The file path to the artifact. + */ + @JsonProperty(value = "properties.filePath", access = JsonProperty.Access.WRITE_ONLY) + private String filePath; + + /** + * The URI to the artifact icon. + */ + @JsonProperty(value = "properties.icon", access = JsonProperty.Access.WRITE_ONLY) + private String icon; + + /** + * The artifact's target OS. + */ + @JsonProperty(value = "properties.targetOsType", access = JsonProperty.Access.WRITE_ONLY) + private String targetOsType; + + /** + * The artifact's parameters. + */ + @JsonProperty(value = "properties.parameters", access = JsonProperty.Access.WRITE_ONLY) + private Object parameters; + + /** + * The artifact's creation date. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * Get the artifact's title. + * + * @return the title value + */ + public String title() { + return this.title; + } + + /** + * Get the artifact's description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the artifact's publisher. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the file path to the artifact. + * + * @return the filePath value + */ + public String filePath() { + return this.filePath; + } + + /** + * Get the URI to the artifact icon. + * + * @return the icon value + */ + public String icon() { + return this.icon; + } + + /** + * Get the artifact's target OS. + * + * @return the targetOsType value + */ + public String targetOsType() { + return this.targetOsType; + } + + /** + * Get the artifact's parameters. + * + * @return the parameters value + */ + public Object parameters() { + return this.parameters; + } + + /** + * Get the artifact's creation date. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourceImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourceImpl.java new file mode 100644 index 000000000000..e888c05d73f4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourceImpl.java @@ -0,0 +1,305 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactSource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactSourceFragment; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.SourceControlType; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnableStatus; +import org.joda.time.DateTime; +import rx.functions.Func1; + +class ArtifactSourceImpl extends CreatableUpdatableImpl implements ArtifactSource, ArtifactSource.Definition, ArtifactSource.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + private ArtifactSourceFragment updateParameter; + + ArtifactSourceImpl(String name, DevTestLabsManager manager) { + super(name, new ArtifactSourceInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new ArtifactSourceFragment(); + } + + 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"); + // + this.updateParameter = new ArtifactSourceFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ArtifactSourcesInner client = this.manager().inner().artifactSources(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(new Func1() { + @Override + public ArtifactSourceInner call(ArtifactSourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ArtifactSourcesInner client = this.manager().inner().artifactSources(); + return client.updateAsync(this.resourceGroupName, this.labName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public ArtifactSourceInner call(ArtifactSourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ArtifactSourcesInner client = this.manager().inner().artifactSources(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ArtifactSourceFragment(); + } + + @Override + public String armTemplateFolderPath() { + return this.inner().armTemplateFolderPath(); + } + + @Override + public String branchRef() { + return this.inner().branchRef(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @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 uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @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 withArmTemplateFolderPath(String armTemplateFolderPath) { + if (isInCreateMode()) { + this.inner().withArmTemplateFolderPath(armTemplateFolderPath); + } else { + this.updateParameter.withArmTemplateFolderPath(armTemplateFolderPath); + } + return this; + } + + @Override + public ArtifactSourceImpl withBranchRef(String branchRef) { + if (isInCreateMode()) { + this.inner().withBranchRef(branchRef); + } else { + this.updateParameter.withBranchRef(branchRef); + } + return this; + } + + @Override + public ArtifactSourceImpl withDisplayName(String displayName) { + if (isInCreateMode()) { + this.inner().withDisplayName(displayName); + } else { + this.updateParameter.withDisplayName(displayName); + } + return this; + } + + @Override + public ArtifactSourceImpl withFolderPath(String folderPath) { + if (isInCreateMode()) { + this.inner().withFolderPath(folderPath); + } else { + this.updateParameter.withFolderPath(folderPath); + } + return this; + } + + @Override + public ArtifactSourceImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public ArtifactSourceImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public ArtifactSourceImpl withSecurityToken(String securityToken) { + if (isInCreateMode()) { + this.inner().withSecurityToken(securityToken); + } else { + this.updateParameter.withSecurityToken(securityToken); + } + return this; + } + + @Override + public ArtifactSourceImpl withSourceType(SourceControlType sourceType) { + if (isInCreateMode()) { + this.inner().withSourceType(sourceType); + } else { + this.updateParameter.withSourceType(sourceType); + } + return this; + } + + @Override + public ArtifactSourceImpl withStatus(EnableStatus status) { + if (isInCreateMode()) { + this.inner().withStatus(status); + } else { + this.updateParameter.withStatus(status); + } + return this; + } + + @Override + public ArtifactSourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public ArtifactSourceImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + + @Override + public ArtifactSourceImpl withUri(String uri) { + if (isInCreateMode()) { + this.inner().withUri(uri); + } else { + this.updateParameter.withUri(uri); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourceInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourceInner.java new file mode 100644 index 000000000000..771e793e7f0e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourceInner.java @@ -0,0 +1,301 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.SourceControlType; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnableStatus; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Properties of an artifact source. + */ +@JsonFlatten +@SkipParentValidation +public class ArtifactSourceInner extends Resource { + /** + * The artifact source's display name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The artifact source's URI. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /** + * The artifact source's type. Possible values include: 'VsoGit', 'GitHub'. + */ + @JsonProperty(value = "properties.sourceType") + private SourceControlType sourceType; + + /** + * The folder containing artifacts. + */ + @JsonProperty(value = "properties.folderPath") + private String folderPath; + + /** + * The folder containing Azure Resource Manager templates. + */ + @JsonProperty(value = "properties.armTemplateFolderPath") + private String armTemplateFolderPath; + + /** + * The artifact source's branch reference. + */ + @JsonProperty(value = "properties.branchRef") + private String branchRef; + + /** + * The security token to authenticate to the artifact source. + */ + @JsonProperty(value = "properties.securityToken") + private String securityToken; + + /** + * Indicates if the artifact source is enabled (values: Enabled, Disabled). + * Possible values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /** + * The artifact source's creation date. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the artifact source's display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the artifact source's display name. + * + * @param displayName the displayName value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the artifact source's URI. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + + /** + * Set the artifact source's URI. + * + * @param uri the uri value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the artifact source's type. Possible values include: 'VsoGit', 'GitHub'. + * + * @return the sourceType value + */ + public SourceControlType sourceType() { + return this.sourceType; + } + + /** + * Set the artifact source's type. 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 containing artifacts. + * + * @return the folderPath value + */ + public String folderPath() { + return this.folderPath; + } + + /** + * Set the folder containing artifacts. + * + * @param folderPath the folderPath value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withFolderPath(String folderPath) { + this.folderPath = folderPath; + return this; + } + + /** + * Get the folder containing Azure Resource Manager templates. + * + * @return the armTemplateFolderPath value + */ + public String armTemplateFolderPath() { + return this.armTemplateFolderPath; + } + + /** + * Set the folder containing Azure Resource Manager templates. + * + * @param armTemplateFolderPath the armTemplateFolderPath value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withArmTemplateFolderPath(String armTemplateFolderPath) { + this.armTemplateFolderPath = armTemplateFolderPath; + return this; + } + + /** + * Get the artifact source's branch reference. + * + * @return the branchRef value + */ + public String branchRef() { + return this.branchRef; + } + + /** + * Set the artifact source's branch reference. + * + * @param branchRef the branchRef value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withBranchRef(String branchRef) { + this.branchRef = branchRef; + return this; + } + + /** + * Get the security token to authenticate to the artifact source. + * + * @return the securityToken value + */ + public String securityToken() { + return this.securityToken; + } + + /** + * Set the security token to authenticate to the artifact source. + * + * @param securityToken the securityToken value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withSecurityToken(String securityToken) { + this.securityToken = securityToken; + return this; + } + + /** + * Get indicates if the artifact source is enabled (values: Enabled, Disabled). Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set indicates if the artifact source is enabled (values: Enabled, Disabled). 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 artifact source's creation date. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourcesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourcesImpl.java new file mode 100644 index 000000000000..35c5330b33a6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactSources; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name) { + ArtifactSourcesInner client = this.inner(); + return client.getAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + ArtifactSourcesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourcesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourcesInner.java new file mode 100644 index 000000000000..acdd38f40ce4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactSourcesInner.java @@ -0,0 +1,946 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.ArtifactSourceFragment; +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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.ArtifactSources get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.ArtifactSources createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}") + Observable> createOrUpdate(@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.v2016_05_15.ArtifactSources delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.ArtifactSources update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ArtifactSourceFragment 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.v2016_05_15.ArtifactSources listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given lab. + * + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifact sources in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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 expand Specify the $expand query. Example: 'properties($select=displayName)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($select=displayName)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 Properties of an 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 createOrUpdate(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return createOrUpdateWithServiceResponseAsync(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 Properties of an 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 createOrUpdateAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(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 Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, ArtifactSourceInner artifactSource) { + return createOrUpdateWithServiceResponseAsync(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 Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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 delete(String resourceGroupName, String labName, String name) { + deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(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> deleteWithServiceResponseAsync(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.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 Properties of an 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 update(String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource) { + return updateWithServiceResponseAsync(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 Properties of an 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 updateAsync(String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(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 Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String name, ArtifactSourceFragment artifactSource) { + return updateWithServiceResponseAsync(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 Properties of an artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactSourceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String name, ArtifactSourceFragment 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.update(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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactsImpl.java new file mode 100644 index 000000000000..b0d0434c1a0b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Artifacts; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArmTemplateInfo; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GenerateArmTemplateRequest; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String artifactSourceName, String name) { + ArtifactsInner client = this.inner(); + return client.getAsync(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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactsInner.java new file mode 100644 index 000000000000..a2420d8690f6 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ArtifactsInner.java @@ -0,0 +1,778 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.Artifacts get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/artifactsources/{artifactSourceName}/artifacts/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("artifactSourceName") String artifactSourceName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.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.v2016_05_15.Artifacts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param 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 in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, expand, 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 in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List artifacts in a given artifact source. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param expand Specify the $expand query. Example: 'properties($select=title)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, artifactSourceName, expand, 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 in a given artifact source. + * + 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 expand Specify the $expand query. Example: 'properties($select=title)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String artifactSourceName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String artifactSourceName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String artifactSourceName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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."); + } + final String expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get artifact. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param artifactSourceName The name of the artifact source. + * @param name The name of the artifact. + * @param expand Specify the $expand query. Example: 'properties($select=title)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand).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 expand Specify the $expand query. Example: 'properties($select=title)' + * @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 getAsync(String resourceGroupName, String labName, String artifactSourceName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($select=title)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, artifactSourceName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($select=title)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ArtifactInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String artifactSourceName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, artifactSourceName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 Parameters for generating an ARM template for deploying artifacts. + * @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 Parameters for generating an ARM template for deploying artifacts. + * @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 Parameters for generating an ARM template for deploying artifacts. + * @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 Parameters for generating an ARM template for deploying artifacts. + * @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 in a given artifact source. + * + * @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 in a given artifact source. + * + * @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 in a given artifact source. + * + * @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 in a given artifact source. + * + * @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 in a given artifact source. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CostsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CostsImpl.java new file mode 100644 index 000000000000..fda519059d83 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CostsImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Costs; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabCost; + +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; + } + + @Override + public LabCostImpl define(String name) { + return wrapModel(name); + } + + private LabCostImpl wrapModel(LabCostInner inner) { + return new LabCostImpl(inner, manager()); + } + + private LabCostImpl wrapModel(String name) { + return new LabCostImpl(name, this.manager()); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String name) { + CostsInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(LabCostInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((LabCost)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CostsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CostsInner.java new file mode 100644 index 000000000000..641549c3ab02 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CostsInner.java @@ -0,0 +1,353 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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 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.PUT; +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 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.v2016_05_15.Costs get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Costs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/costs/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body LabCostInner labCost, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * 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 LabCostInner object if successful. + */ + public LabCostInner get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 LabCostInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, LabCostInner>() { + @Override + public LabCostInner 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 LabCostInner object + */ + public Observable> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 LabCostInner object if successful. + */ + public LabCostInner get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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 expand Specify the $expand query. Example: 'properties($expand=labCostDetails)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabCostInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).map(new Func1, LabCostInner>() { + @Override + public LabCostInner 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. + * @param expand Specify the $expand query. Example: 'properties($expand=labCostDetails)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabCostInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 LabCostInner object if successful. + */ + public LabCostInner createOrUpdate(String resourceGroupName, String labName, String name, LabCostInner labCost) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, labCost).toBlocking().single().body(); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @param 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 createOrUpdateAsync(String resourceGroupName, String labName, String name, LabCostInner labCost, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, labCost), serviceCallback); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabCostInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, LabCostInner labCost) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, labCost).map(new Func1, LabCostInner>() { + @Override + public LabCostInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing cost. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the cost. + * @param labCost A cost item. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabCostInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String name, LabCostInner labCost) { + 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 (labCost == null) { + throw new IllegalArgumentException("Parameter labCost 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(labCost); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, name, labCost, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImageImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImageImpl.java new file mode 100644 index 000000000000..187a85d1bd63 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImageImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.CustomImage; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.CustomImagePropertiesFromVm; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.CustomImagePropertiesCustom; +import org.joda.time.DateTime; + +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.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CustomImagesInner client = this.manager().inner().customImages(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CustomImagesInner client = this.manager().inner().customImages(); + return client.getAsync(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 managedImageId() { + return this.inner().managedImageId(); + } + + @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 String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @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 withAuthor(String author) { + this.inner().withAuthor(author); + return this; + } + + @Override + public CustomImageImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public CustomImageImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public CustomImageImpl withManagedImageId(String managedImageId) { + this.inner().withManagedImageId(managedImageId); + 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 withUniqueIdentifier(String uniqueIdentifier) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImageInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImageInner.java new file mode 100644 index 000000000000..166333532738 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImageInner.java @@ -0,0 +1,222 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.CustomImagePropertiesFromVm; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.CustomImagePropertiesCustom; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A custom image. + */ +@JsonFlatten +@SkipParentValidation +public class CustomImageInner extends Resource { + /** + * The virtual machine from which the image is to be created. + */ + @JsonProperty(value = "properties.vm") + private CustomImagePropertiesFromVm vm; + + /** + * The VHD from which the image is to be created. + */ + @JsonProperty(value = "properties.vhd") + private CustomImagePropertiesCustom vhd; + + /** + * The description of the custom image. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The author of the custom image. + */ + @JsonProperty(value = "properties.author") + private String author; + + /** + * The creation date of the custom image. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The Managed Image Id backing the custom image. + */ + @JsonProperty(value = "properties.managedImageId") + private String managedImageId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the virtual machine from which the image is to be created. + * + * @return the vm value + */ + public CustomImagePropertiesFromVm vm() { + return this.vm; + } + + /** + * Set the virtual machine from which the image is to be created. + * + * @param vm the vm value to set + * @return the CustomImageInner object itself. + */ + public CustomImageInner withVm(CustomImagePropertiesFromVm vm) { + this.vm = vm; + return this; + } + + /** + * Get the VHD 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 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; + } + + /** + * Get the Managed Image Id backing the custom image. + * + * @return the managedImageId value + */ + public String managedImageId() { + return this.managedImageId; + } + + /** + * Set the Managed Image Id backing the custom image. + * + * @param managedImageId the managedImageId value to set + * @return the CustomImageInner object itself. + */ + public CustomImageInner withManagedImageId(String managedImageId) { + this.managedImageId = managedImageId; + return this; + } + + /** + * Get the 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the CustomImageInner object itself. + */ + public CustomImageInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImagesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImagesImpl.java new file mode 100644 index 000000000000..6a8145570f80 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.CustomImages; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name) { + CustomImagesInner client = this.inner(); + return client.getAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + CustomImagesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImagesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImagesInner.java new file mode 100644 index 000000000000..862b5fe94d7c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/CustomImagesInner.java @@ -0,0 +1,1006 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.CustomImages get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.CustomImages createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}") + Observable> createOrUpdate(@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.v2016_05_15.CustomImages beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}") + Observable> beginCreateOrUpdate(@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.v2016_05_15.CustomImages delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.CustomImages beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/customimages/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2016_05_15.CustomImages listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given lab. + * + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List custom images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=vm)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=vm)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get custom image. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the custom image. + * @param expand Specify the $expand query. Example: 'properties($select=vm)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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 expand Specify the $expand query. Example: 'properties($select=vm)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($select=vm)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomImageInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($select=vm)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomImageInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 A 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 createOrUpdate(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return createOrUpdateWithServiceResponseAsync(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 A 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 createOrUpdateAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(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 A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return createOrUpdateWithServiceResponseAsync(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 A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 A 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 beginCreateOrUpdate(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A 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 beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(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 A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomImageInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, CustomImageInner customImage) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A custom image. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomImageInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(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 delete(String resourceGroupName, String labName, String name) { + deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(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> deleteWithServiceResponseAsync(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.delete(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 beginDelete(String resourceGroupName, String labName, String name) { + beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteWithServiceResponseAsync(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> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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); + } + + /** + * List custom images in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DevTestLabsClientImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DevTestLabsClientImpl.java new file mode 100644 index 000000000000..3eb87e62be3b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DevTestLabsClientImpl.java @@ -0,0 +1,504 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.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 ProviderOperationsInner object to access its operations. + */ + private ProviderOperationsInner providerOperations; + + /** + * Gets the ProviderOperationsInner object to access its operations. + * @return the ProviderOperationsInner object. + */ + public ProviderOperationsInner providerOperations() { + return this.providerOperations; + } + + /** + * 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 OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The GlobalSchedulesInner object to access its operations. + */ + private GlobalSchedulesInner globalSchedules; + + /** + * Gets the GlobalSchedulesInner object to access its operations. + * @return the GlobalSchedulesInner object. + */ + public GlobalSchedulesInner globalSchedules() { + return this.globalSchedules; + } + + /** + * 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 ArmTemplatesInner object to access its operations. + */ + private ArmTemplatesInner armTemplates; + + /** + * Gets the ArmTemplatesInner object to access its operations. + * @return the ArmTemplatesInner object. + */ + public ArmTemplatesInner armTemplates() { + return this.armTemplates; + } + + /** + * 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 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 NotificationChannelsInner object to access its operations. + */ + private NotificationChannelsInner notificationChannels; + + /** + * Gets the NotificationChannelsInner object to access its operations. + * @return the NotificationChannelsInner object. + */ + public NotificationChannelsInner notificationChannels() { + return this.notificationChannels; + } + + /** + * 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 PoliciesInner object to access its operations. + */ + private PoliciesInner policies; + + /** + * Gets the PoliciesInner object to access its operations. + * @return the PoliciesInner object. + */ + public PoliciesInner policies() { + return this.policies; + } + + /** + * 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 ServiceRunnersInner object to access its operations. + */ + private ServiceRunnersInner serviceRunners; + + /** + * Gets the ServiceRunnersInner object to access its operations. + * @return the ServiceRunnersInner object. + */ + public ServiceRunnersInner serviceRunners() { + return this.serviceRunners; + } + + /** + * The UsersInner object to access its operations. + */ + private UsersInner users; + + /** + * Gets the UsersInner object to access its operations. + * @return the UsersInner object. + */ + public UsersInner users() { + return this.users; + } + + /** + * The DisksInner object to access its operations. + */ + private DisksInner disks; + + /** + * Gets the DisksInner object to access its operations. + * @return the DisksInner object. + */ + public DisksInner disks() { + return this.disks; + } + + /** + * The EnvironmentsInner object to access its operations. + */ + private EnvironmentsInner environments; + + /** + * Gets the EnvironmentsInner object to access its operations. + * @return the EnvironmentsInner object. + */ + public EnvironmentsInner environments() { + return this.environments; + } + + /** + * The SecretsInner object to access its operations. + */ + private SecretsInner secrets; + + /** + * Gets the SecretsInner object to access its operations. + * @return the SecretsInner object. + */ + public SecretsInner secrets() { + return this.secrets; + } + + /** + * 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 VirtualMachineSchedulesInner object to access its operations. + */ + private VirtualMachineSchedulesInner virtualMachineSchedules; + + /** + * Gets the VirtualMachineSchedulesInner object to access its operations. + * @return the VirtualMachineSchedulesInner object. + */ + public VirtualMachineSchedulesInner virtualMachineSchedules() { + return this.virtualMachineSchedules; + } + + /** + * 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 = "2016-05-15"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.providerOperations = new ProviderOperationsInner(restClient().retrofit(), this); + this.labs = new LabsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.globalSchedules = new GlobalSchedulesInner(restClient().retrofit(), this); + this.artifactSources = new ArtifactSourcesInner(restClient().retrofit(), this); + this.armTemplates = new ArmTemplatesInner(restClient().retrofit(), this); + this.artifacts = new ArtifactsInner(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.notificationChannels = new NotificationChannelsInner(restClient().retrofit(), this); + this.policySets = new PolicySetsInner(restClient().retrofit(), this); + this.policies = new PoliciesInner(restClient().retrofit(), this); + this.schedules = new SchedulesInner(restClient().retrofit(), this); + this.serviceRunners = new ServiceRunnersInner(restClient().retrofit(), this); + this.users = new UsersInner(restClient().retrofit(), this); + this.disks = new DisksInner(restClient().retrofit(), this); + this.environments = new EnvironmentsInner(restClient().retrofit(), this); + this.secrets = new SecretsInner(restClient().retrofit(), this); + this.virtualMachines = new VirtualMachinesInner(restClient().retrofit(), this); + this.virtualMachineSchedules = new VirtualMachineSchedulesInner(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", "2016-05-15"); + } +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DevTestLabsManager.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DevTestLabsManager.java new file mode 100644 index 000000000000..8bac91d0a615 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DevTestLabsManager.java @@ -0,0 +1,363 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.ProviderOperations; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Labs; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Operations; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GlobalSchedules; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactSources; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArmTemplates; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Artifacts; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Costs; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.CustomImages; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Formulas; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GalleryImages; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationChannels; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicySets; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Policies; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Schedules; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ServiceRunners; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Users; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Disks; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Environments; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Secrets; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachines; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachineSchedules; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 ProviderOperations providerOperations; + private Labs labs; + private Operations operations; + private GlobalSchedules globalSchedules; + private ArtifactSources artifactSources; + private ArmTemplates armTemplates; + private Artifacts artifacts; + private Costs costs; + private CustomImages customImages; + private Formulas formulas; + private GalleryImages galleryImages; + private NotificationChannels notificationChannels; + private PolicySets policySets; + private Policies policies; + private Schedules schedules; + private ServiceRunners serviceRunners; + private Users users; + private Disks disks; + private Environments environments; + private Secrets secrets; + private VirtualMachines virtualMachines; + private VirtualMachineSchedules virtualMachineSchedules; + 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 ProviderOperations. + */ + public ProviderOperations providerOperations() { + if (this.providerOperations == null) { + this.providerOperations = new ProviderOperationsImpl(this); + } + return this.providerOperations; + } + + /** + * @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 Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage GlobalSchedules. + */ + public GlobalSchedules globalSchedules() { + if (this.globalSchedules == null) { + this.globalSchedules = new GlobalSchedulesImpl(this); + } + return this.globalSchedules; + } + + /** + * @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 ArmTemplates. + */ + public ArmTemplates armTemplates() { + if (this.armTemplates == null) { + this.armTemplates = new ArmTemplatesImpl(this); + } + return this.armTemplates; + } + + /** + * @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 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 NotificationChannels. + */ + public NotificationChannels notificationChannels() { + if (this.notificationChannels == null) { + this.notificationChannels = new NotificationChannelsImpl(this); + } + return this.notificationChannels; + } + + /** + * @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 Policies. + */ + public Policies policies() { + if (this.policies == null) { + this.policies = new PoliciesImpl(this); + } + return this.policies; + } + + /** + * @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 ServiceRunners. + */ + public ServiceRunners serviceRunners() { + if (this.serviceRunners == null) { + this.serviceRunners = new ServiceRunnersImpl(this); + } + return this.serviceRunners; + } + + /** + * @return Entry point to manage Users. + */ + public Users users() { + if (this.users == null) { + this.users = new UsersImpl(this); + } + return this.users; + } + + /** + * @return Entry point to manage Disks. + */ + public Disks disks() { + if (this.disks == null) { + this.disks = new DisksImpl(this); + } + return this.disks; + } + + /** + * @return Entry point to manage Environments. + */ + public Environments environments() { + if (this.environments == null) { + this.environments = new EnvironmentsImpl(this); + } + return this.environments; + } + + /** + * @return Entry point to manage Secrets. + */ + public Secrets secrets() { + if (this.secrets == null) { + this.secrets = new SecretsImpl(this); + } + return this.secrets; + } + + /** + * @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 VirtualMachineSchedules. + */ + public VirtualMachineSchedules virtualMachineSchedules() { + if (this.virtualMachineSchedules == null) { + this.virtualMachineSchedules = new VirtualMachineSchedulesImpl(this); + } + return this.virtualMachineSchedules; + } + + /** + * @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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DiskImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DiskImpl.java new file mode 100644 index 000000000000..3dc078f7653b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DiskImpl.java @@ -0,0 +1,226 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Disk; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.StorageType; +import org.joda.time.DateTime; + +class DiskImpl extends CreatableUpdatableImpl implements Disk, Disk.Definition, Disk.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String userName; + private String name; + + DiskImpl(String name, DevTestLabsManager manager) { + super(name, new DiskInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + DiskImpl(DiskInner 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.userName = IdParsingUtils.getValueFromIdByName(inner.id(), "users"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "disks"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DisksInner client = this.manager().inner().disks(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.userName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DisksInner client = this.manager().inner().disks(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.userName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DisksInner client = this.manager().inner().disks(); + return client.getAsync(this.resourceGroupName, this.labName, this.userName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String diskBlobName() { + return this.inner().diskBlobName(); + } + + @Override + public Integer diskSizeGiB() { + return this.inner().diskSizeGiB(); + } + + @Override + public StorageType diskType() { + return this.inner().diskType(); + } + + @Override + public String diskUri() { + return this.inner().diskUri(); + } + + @Override + public String hostCaching() { + return this.inner().hostCaching(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String leasedByLabVmId() { + return this.inner().leasedByLabVmId(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String managedDiskId() { + return this.inner().managedDiskId(); + } + + @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 String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public DiskImpl withExistingUser(String resourceGroupName, String labName, String userName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.userName = userName; + return this; + } + + @Override + public DiskImpl withDiskBlobName(String diskBlobName) { + this.inner().withDiskBlobName(diskBlobName); + return this; + } + + @Override + public DiskImpl withDiskSizeGiB(Integer diskSizeGiB) { + this.inner().withDiskSizeGiB(diskSizeGiB); + return this; + } + + @Override + public DiskImpl withDiskType(StorageType diskType) { + this.inner().withDiskType(diskType); + return this; + } + + @Override + public DiskImpl withDiskUri(String diskUri) { + this.inner().withDiskUri(diskUri); + return this; + } + + @Override + public DiskImpl withHostCaching(String hostCaching) { + this.inner().withHostCaching(hostCaching); + return this; + } + + @Override + public DiskImpl withLeasedByLabVmId(String leasedByLabVmId) { + this.inner().withLeasedByLabVmId(leasedByLabVmId); + return this; + } + + @Override + public DiskImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DiskImpl withManagedDiskId(String managedDiskId) { + this.inner().withManagedDiskId(managedDiskId); + return this; + } + + @Override + public DiskImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public DiskImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public DiskImpl withUniqueIdentifier(String uniqueIdentifier) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DiskInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DiskInner.java new file mode 100644 index 000000000000..e6e88a98a32d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DiskInner.java @@ -0,0 +1,275 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.StorageType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A Disk. + */ +@JsonFlatten +@SkipParentValidation +public class DiskInner extends Resource { + /** + * The storage type for the disk (i.e. Standard, Premium). Possible values + * include: 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.diskType") + private StorageType diskType; + + /** + * The size of the disk in Gibibytes. + */ + @JsonProperty(value = "properties.diskSizeGiB") + private Integer diskSizeGiB; + + /** + * The resource ID of the VM to which this disk is leased. + */ + @JsonProperty(value = "properties.leasedByLabVmId") + private String leasedByLabVmId; + + /** + * When backed by a blob, the name of the VHD blob without extension. + */ + @JsonProperty(value = "properties.diskBlobName") + private String diskBlobName; + + /** + * When backed by a blob, the URI of underlying blob. + */ + @JsonProperty(value = "properties.diskUri") + private String diskUri; + + /** + * The creation date of the disk. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + */ + @JsonProperty(value = "properties.hostCaching") + private String hostCaching; + + /** + * When backed by managed disk, this is the ID of the compute disk + * resource. + */ + @JsonProperty(value = "properties.managedDiskId") + private String managedDiskId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium'. + * + * @return the diskType value + */ + public StorageType diskType() { + return this.diskType; + } + + /** + * Set the storage type for the disk (i.e. Standard, Premium). Possible values include: 'Standard', 'Premium'. + * + * @param diskType the diskType value to set + * @return the DiskInner object itself. + */ + public DiskInner withDiskType(StorageType diskType) { + this.diskType = diskType; + return this; + } + + /** + * Get the size of the disk in Gibibytes. + * + * @return the diskSizeGiB value + */ + public Integer diskSizeGiB() { + return this.diskSizeGiB; + } + + /** + * Set the size of the disk in Gibibytes. + * + * @param diskSizeGiB the diskSizeGiB value to set + * @return the DiskInner object itself. + */ + public DiskInner withDiskSizeGiB(Integer diskSizeGiB) { + this.diskSizeGiB = diskSizeGiB; + return this; + } + + /** + * Get the resource ID of the VM to which this disk is leased. + * + * @return the leasedByLabVmId value + */ + public String leasedByLabVmId() { + return this.leasedByLabVmId; + } + + /** + * Set the resource ID of the VM to which this disk is leased. + * + * @param leasedByLabVmId the leasedByLabVmId value to set + * @return the DiskInner object itself. + */ + public DiskInner withLeasedByLabVmId(String leasedByLabVmId) { + this.leasedByLabVmId = leasedByLabVmId; + return this; + } + + /** + * Get when backed by a blob, the name of the VHD blob without extension. + * + * @return the diskBlobName value + */ + public String diskBlobName() { + return this.diskBlobName; + } + + /** + * Set when backed by a blob, the name of the VHD blob without extension. + * + * @param diskBlobName the diskBlobName value to set + * @return the DiskInner object itself. + */ + public DiskInner withDiskBlobName(String diskBlobName) { + this.diskBlobName = diskBlobName; + return this; + } + + /** + * Get when backed by a blob, the URI of underlying blob. + * + * @return the diskUri value + */ + public String diskUri() { + return this.diskUri; + } + + /** + * Set when backed by a blob, the URI of underlying blob. + * + * @param diskUri the diskUri value to set + * @return the DiskInner object itself. + */ + public DiskInner withDiskUri(String diskUri) { + this.diskUri = diskUri; + return this; + } + + /** + * Get the creation date of the disk. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Get the host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + * + * @return the hostCaching value + */ + public String hostCaching() { + return this.hostCaching; + } + + /** + * Set the host caching policy of the disk (i.e. None, ReadOnly, ReadWrite). + * + * @param hostCaching the hostCaching value to set + * @return the DiskInner object itself. + */ + public DiskInner withHostCaching(String hostCaching) { + this.hostCaching = hostCaching; + return this; + } + + /** + * Get when backed by managed disk, this is the ID of the compute disk resource. + * + * @return the managedDiskId value + */ + public String managedDiskId() { + return this.managedDiskId; + } + + /** + * Set when backed by managed disk, this is the ID of the compute disk resource. + * + * @param managedDiskId the managedDiskId value to set + * @return the DiskInner object itself. + */ + public DiskInner withManagedDiskId(String managedDiskId) { + this.managedDiskId = managedDiskId; + return this; + } + + /** + * Get the 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 DiskInner object itself. + */ + public DiskInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the DiskInner object itself. + */ + public DiskInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DisksImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DisksImpl.java new file mode 100644 index 000000000000..2fdaa1273a7d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DisksImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Disks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Disk; + +class DisksImpl extends WrapperImpl implements Disks { + private final DevTestLabsManager manager; + + DisksImpl(DevTestLabsManager manager) { + super(manager.inner().disks()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public DiskImpl define(String name) { + return wrapModel(name); + } + + private DiskImpl wrapModel(DiskInner inner) { + return new DiskImpl(inner, manager()); + } + + private DiskImpl wrapModel(String name) { + return new DiskImpl(name, this.manager()); + } + + @Override + public Completable attachAsync(String resourceGroupName, String labName, String userName, String name) { + DisksInner client = this.inner(); + return client.attachAsync(resourceGroupName, labName, userName, name).toCompletable(); + } + + @Override + public Completable detachAsync(String resourceGroupName, String labName, String userName, String name) { + DisksInner client = this.inner(); + return client.detachAsync(resourceGroupName, labName, userName, name).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName, final String userName) { + DisksInner client = this.inner(); + return client.listAsync(resourceGroupName, labName, userName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Disk call(DiskInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String userName, String name) { + DisksInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, userName, name) + .flatMap(new Func1>() { + @Override + public Observable call(DiskInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Disk)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String userName, String name) { + DisksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, userName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DisksInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DisksInner.java new file mode 100644 index 000000000000..556154ad4dfd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DisksInner.java @@ -0,0 +1,1829 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.AttachDiskProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DetachDiskProperties; +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.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 Disks. + */ +public class DisksInner { + /** The Retrofit service to perform REST calls. */ + private DisksService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of DisksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DisksInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(DisksService.class); + this.client = client; + } + + /** + * The interface defining all the services for Disks to be + * used by Retrofit to perform actually REST calls. + */ + interface DisksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Disks list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Query("$expand") String expand, @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.v2016_05_15.Disks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Disks createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Body DiskInner disk, @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.v2016_05_15.Disks beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Body DiskInner disk, @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.v2016_05_15.Disks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @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.v2016_05_15.Disks beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @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.v2016_05_15.Disks attach" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach") + Observable> attach(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AttachDiskProperties attachDiskProperties, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Disks beginAttach" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/attach") + Observable> beginAttach(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body AttachDiskProperties attachDiskProperties, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Disks detach" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach") + Observable> detach(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DetachDiskProperties detachDiskProperties, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Disks beginDetach" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/disks/{name}/detach") + Observable> beginDetach(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DetachDiskProperties detachDiskProperties, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Disks listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<DiskInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String userName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, userName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param 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 userName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, userName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiskInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String userName) { + return listWithServiceResponseAsync(resourceGroupName, labName, userName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiskInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String userName) { + return listSinglePageAsync(resourceGroupName, labName, userName) + .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 disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiskInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String userName) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, userName, expand, 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 disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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<DiskInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, userName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 userName, final String expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, userName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiskInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, userName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List disks in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DiskInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, userName, expand, 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 disks in a given user profile. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param userName The name of the user profile. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiskInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String userName, final String expand, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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, userName, expand, 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 disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DiskInner object if successful. + */ + public DiskInner get(String resourceGroupName, String labName, String userName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param 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 getAsync(String resourceGroupName, String labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiskInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String userName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, DiskInner>() { + @Override + public DiskInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiskInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, userName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DiskInner object if successful. + */ + public DiskInner get(String resourceGroupName, String labName, String userName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand).toBlocking().single().body(); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @param 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 getAsync(String resourceGroupName, String labName, String userName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand), serviceCallback); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiskInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String userName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand).map(new Func1, DiskInner>() { + @Override + public DiskInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get disk. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param expand Specify the $expand query. Example: 'properties($select=diskType)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiskInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, String expand) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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.get(this.client.subscriptionId(), resourceGroupName, labName, userName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DiskInner object if successful. + */ + public DiskInner createOrUpdate(String resourceGroupName, String labName, String userName, String name, DiskInner disk) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, disk).toBlocking().last().body(); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param 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 createOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DiskInner disk, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, disk), serviceCallback); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DiskInner disk) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, disk).map(new Func1, DiskInner>() { + @Override + public DiskInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, DiskInner disk) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (disk == null) { + throw new IllegalArgumentException("Parameter disk 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(disk); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, userName, name, disk, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DiskInner object if successful. + */ + public DiskInner beginCreateOrUpdate(String resourceGroupName, String labName, String userName, String name, DiskInner disk) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, disk).toBlocking().single().body(); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @param 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 beginCreateOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DiskInner disk, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, disk), serviceCallback); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiskInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DiskInner disk) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, disk).map(new Func1, DiskInner>() { + @Override + public DiskInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param disk A Disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DiskInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, DiskInner disk) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (disk == null) { + throw new IllegalArgumentException("Parameter disk 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(disk); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, userName, name, disk, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(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 disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String userName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().last().body(); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param 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 labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String labName, String userName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String userName, String name) { + beginDeleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param 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 labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String labName, String userName, String name) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete disk. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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, labName, userName, 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); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @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 attach(String resourceGroupName, String labName, String userName, String name) { + attachWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().last().body(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param 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 attachAsync(String resourceGroupName, String labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(attachWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable attachAsync(String resourceGroupName, String labName, String userName, String name) { + return attachWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> attachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 leasedByLabVmId = null; + AttachDiskProperties attachDiskProperties = new AttachDiskProperties(); + attachDiskProperties.withLeasedByLabVmId(null); + Observable> observable = service.attach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), attachDiskProperties, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @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 attach(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + attachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).toBlocking().last().body(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @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 attachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(attachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId), serviceCallback); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable attachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + return attachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> attachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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."); + } + AttachDiskProperties attachDiskProperties = new AttachDiskProperties(); + attachDiskProperties.withLeasedByLabVmId(leasedByLabVmId); + Observable> observable = service.attach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), attachDiskProperties, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @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 beginAttach(String resourceGroupName, String labName, String userName, String name) { + beginAttachWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param 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 beginAttachAsync(String resourceGroupName, String labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginAttachWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginAttachAsync(String resourceGroupName, String labName, String userName, String name) { + return beginAttachWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginAttachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 leasedByLabVmId = null; + AttachDiskProperties attachDiskProperties = new AttachDiskProperties(); + attachDiskProperties.withLeasedByLabVmId(null); + return service.beginAttach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), attachDiskProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginAttachDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @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 beginAttach(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + beginAttachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).toBlocking().single().body(); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @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 beginAttachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginAttachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId), serviceCallback); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginAttachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + return beginAttachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Attach and create the lease of the disk to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab virtual machine to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginAttachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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."); + } + AttachDiskProperties attachDiskProperties = new AttachDiskProperties(); + attachDiskProperties.withLeasedByLabVmId(leasedByLabVmId); + return service.beginAttach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), attachDiskProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginAttachDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginAttachDelegate(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); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @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 detach(String resourceGroupName, String labName, String userName, String name) { + detachWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().last().body(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param 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 detachAsync(String resourceGroupName, String labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detachWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable detachAsync(String resourceGroupName, String labName, String userName, String name) { + return detachWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> detachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 leasedByLabVmId = null; + DetachDiskProperties detachDiskProperties = new DetachDiskProperties(); + detachDiskProperties.withLeasedByLabVmId(null); + Observable> observable = service.detach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDiskProperties, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @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 detach(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + detachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).toBlocking().last().body(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @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 detachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId), serviceCallback); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable detachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + return detachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> detachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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."); + } + DetachDiskProperties detachDiskProperties = new DetachDiskProperties(); + detachDiskProperties.withLeasedByLabVmId(leasedByLabVmId); + Observable> observable = service.detach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDiskProperties, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @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 beginDetach(String resourceGroupName, String labName, String userName, String name) { + beginDetachWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param 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 beginDetachAsync(String resourceGroupName, String labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDetachWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDetachAsync(String resourceGroupName, String labName, String userName, String name) { + return beginDetachWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDetachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 leasedByLabVmId = null; + DetachDiskProperties detachDiskProperties = new DetachDiskProperties(); + detachDiskProperties.withLeasedByLabVmId(null); + return service.beginDetach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDiskProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDetachDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @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 beginDetach(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + beginDetachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).toBlocking().single().body(); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @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 beginDetachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDetachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId), serviceCallback); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDetachAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + return beginDetachWithServiceResponseAsync(resourceGroupName, labName, userName, name, leasedByLabVmId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach and break the lease of the disk attached to the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the disk. + * @param leasedByLabVmId The resource ID of the Lab VM to which the disk is attached. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDetachWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, String leasedByLabVmId) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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."); + } + DetachDiskProperties detachDiskProperties = new DetachDiskProperties(); + detachDiskProperties.withLeasedByLabVmId(leasedByLabVmId); + return service.beginDetach(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDiskProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDetachDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDetachDelegate(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 disks in a given user profile. + * + * @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<DiskInner> 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 disks in a given user profile. + * + * @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 disks in a given user profile. + * + * @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<DiskInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List disks in a given user profile. + * + * @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<DiskInner> 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 disks in a given user profile. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DiskInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DtlEnvironmentImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DtlEnvironmentImpl.java new file mode 100644 index 000000000000..dd193f688165 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DtlEnvironmentImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DtlEnvironment; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnvironmentDeploymentProperties; + +class DtlEnvironmentImpl extends CreatableUpdatableImpl implements DtlEnvironment, DtlEnvironment.Definition, DtlEnvironment.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String userName; + private String name; + + DtlEnvironmentImpl(String name, DevTestLabsManager manager) { + super(name, new DtlEnvironmentInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + DtlEnvironmentImpl(DtlEnvironmentInner 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.userName = IdParsingUtils.getValueFromIdByName(inner.id(), "users"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "environments"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + EnvironmentsInner client = this.manager().inner().environments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.userName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + EnvironmentsInner client = this.manager().inner().environments(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.userName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + EnvironmentsInner client = this.manager().inner().environments(); + return client.getAsync(this.resourceGroupName, this.labName, this.userName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String armTemplateDisplayName() { + return this.inner().armTemplateDisplayName(); + } + + @Override + public String createdByUser() { + return this.inner().createdByUser(); + } + + @Override + public EnvironmentDeploymentProperties deploymentProperties() { + return this.inner().deploymentProperties(); + } + + @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 resourceGroupId() { + return this.inner().resourceGroupId(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public DtlEnvironmentImpl withExistingUser(String resourceGroupName, String labName, String userName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.userName = userName; + return this; + } + + @Override + public DtlEnvironmentImpl withArmTemplateDisplayName(String armTemplateDisplayName) { + this.inner().withArmTemplateDisplayName(armTemplateDisplayName); + return this; + } + + @Override + public DtlEnvironmentImpl withDeploymentProperties(EnvironmentDeploymentProperties deploymentProperties) { + this.inner().withDeploymentProperties(deploymentProperties); + return this; + } + + @Override + public DtlEnvironmentImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public DtlEnvironmentImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public DtlEnvironmentImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public DtlEnvironmentImpl withUniqueIdentifier(String uniqueIdentifier) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DtlEnvironmentInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DtlEnvironmentInner.java new file mode 100644 index 000000000000..ffe167d685c7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/DtlEnvironmentInner.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnvironmentDeploymentProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * An environment, which is essentially an ARM template deployment. + */ +@JsonFlatten +@SkipParentValidation +public class DtlEnvironmentInner extends Resource { + /** + * The deployment properties of the environment. + */ + @JsonProperty(value = "properties.deploymentProperties") + private EnvironmentDeploymentProperties deploymentProperties; + + /** + * The display name of the Azure Resource Manager template that produced + * the environment. + */ + @JsonProperty(value = "properties.armTemplateDisplayName") + private String armTemplateDisplayName; + + /** + * The identifier of the resource group containing the environment's + * resources. + */ + @JsonProperty(value = "properties.resourceGroupId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroupId; + + /** + * The creator of the environment. + */ + @JsonProperty(value = "properties.createdByUser", access = JsonProperty.Access.WRITE_ONLY) + private String createdByUser; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the deployment properties of the environment. + * + * @return the deploymentProperties value + */ + public EnvironmentDeploymentProperties deploymentProperties() { + return this.deploymentProperties; + } + + /** + * Set the deployment properties of the environment. + * + * @param deploymentProperties the deploymentProperties value to set + * @return the DtlEnvironmentInner object itself. + */ + public DtlEnvironmentInner withDeploymentProperties(EnvironmentDeploymentProperties deploymentProperties) { + this.deploymentProperties = deploymentProperties; + return this; + } + + /** + * Get the display name of the Azure Resource Manager template that produced the environment. + * + * @return the armTemplateDisplayName value + */ + public String armTemplateDisplayName() { + return this.armTemplateDisplayName; + } + + /** + * Set the display name of the Azure Resource Manager template that produced the environment. + * + * @param armTemplateDisplayName the armTemplateDisplayName value to set + * @return the DtlEnvironmentInner object itself. + */ + public DtlEnvironmentInner withArmTemplateDisplayName(String armTemplateDisplayName) { + this.armTemplateDisplayName = armTemplateDisplayName; + return this; + } + + /** + * Get the identifier of the resource group containing the environment's resources. + * + * @return the resourceGroupId value + */ + public String resourceGroupId() { + return this.resourceGroupId; + } + + /** + * Get the creator of the environment. + * + * @return the createdByUser value + */ + public String createdByUser() { + return this.createdByUser; + } + + /** + * 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 DtlEnvironmentInner object itself. + */ + public DtlEnvironmentInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the DtlEnvironmentInner object itself. + */ + public DtlEnvironmentInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EnvironmentsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EnvironmentsImpl.java new file mode 100644 index 000000000000..1d2f9f959e22 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EnvironmentsImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Environments; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DtlEnvironment; + +class EnvironmentsImpl extends WrapperImpl implements Environments { + private final DevTestLabsManager manager; + + EnvironmentsImpl(DevTestLabsManager manager) { + super(manager.inner().environments()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public DtlEnvironmentImpl define(String name) { + return wrapModel(name); + } + + private DtlEnvironmentImpl wrapModel(DtlEnvironmentInner inner) { + return new DtlEnvironmentImpl(inner, manager()); + } + + private DtlEnvironmentImpl wrapModel(String name) { + return new DtlEnvironmentImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName, final String userName) { + EnvironmentsInner client = this.inner(); + return client.listAsync(resourceGroupName, labName, userName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DtlEnvironment call(DtlEnvironmentInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String userName, String name) { + EnvironmentsInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, userName, name) + .flatMap(new Func1>() { + @Override + public Observable call(DtlEnvironmentInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DtlEnvironment)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String userName, String name) { + EnvironmentsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, userName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EnvironmentsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EnvironmentsInner.java new file mode 100644 index 000000000000..86757e8628d0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EnvironmentsInner.java @@ -0,0 +1,1064 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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 Environments. + */ +public class EnvironmentsInner { + /** The Retrofit service to perform REST calls. */ + private EnvironmentsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of EnvironmentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EnvironmentsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(EnvironmentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Environments to be + * used by Retrofit to perform actually REST calls. + */ + interface EnvironmentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Environments list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Query("$expand") String expand, @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.v2016_05_15.Environments get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Environments createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Body DtlEnvironmentInner dtlEnvironment, @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.v2016_05_15.Environments beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Body DtlEnvironmentInner dtlEnvironment, @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.v2016_05_15.Environments delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @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.v2016_05_15.Environments beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/environments/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @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.v2016_05_15.Environments listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<DtlEnvironmentInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String userName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, userName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param 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 userName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, userName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DtlEnvironmentInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String userName) { + return listWithServiceResponseAsync(resourceGroupName, labName, userName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DtlEnvironmentInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String userName) { + return listSinglePageAsync(resourceGroupName, labName, userName) + .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 environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DtlEnvironmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String userName) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, userName, expand, 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 environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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<DtlEnvironmentInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, userName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 userName, final String expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, userName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DtlEnvironmentInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, userName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List environments in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DtlEnvironmentInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, userName, expand, 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 environments in a given user profile. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param userName The name of the user profile. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DtlEnvironmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String userName, final String expand, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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, userName, expand, 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 environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DtlEnvironmentInner object if successful. + */ + public DtlEnvironmentInner get(String resourceGroupName, String labName, String userName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param 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 getAsync(String resourceGroupName, String labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DtlEnvironmentInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String userName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, DtlEnvironmentInner>() { + @Override + public DtlEnvironmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DtlEnvironmentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, userName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DtlEnvironmentInner object if successful. + */ + public DtlEnvironmentInner get(String resourceGroupName, String labName, String userName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand).toBlocking().single().body(); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @param 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 getAsync(String resourceGroupName, String labName, String userName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand), serviceCallback); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DtlEnvironmentInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String userName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand).map(new Func1, DtlEnvironmentInner>() { + @Override + public DtlEnvironmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get environment. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param expand Specify the $expand query. Example: 'properties($select=deploymentProperties)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DtlEnvironmentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, String expand) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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.get(this.client.subscriptionId(), resourceGroupName, labName, userName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DtlEnvironmentInner object if successful. + */ + public DtlEnvironmentInner createOrUpdate(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, dtlEnvironment).toBlocking().last().body(); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param 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 createOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, dtlEnvironment), serviceCallback); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, dtlEnvironment).map(new Func1, DtlEnvironmentInner>() { + @Override + public DtlEnvironmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (dtlEnvironment == null) { + throw new IllegalArgumentException("Parameter dtlEnvironment 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(dtlEnvironment); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, userName, name, dtlEnvironment, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 DtlEnvironmentInner object if successful. + */ + public DtlEnvironmentInner beginCreateOrUpdate(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, dtlEnvironment).toBlocking().single().body(); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @param 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 beginCreateOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, dtlEnvironment), serviceCallback); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DtlEnvironmentInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, dtlEnvironment).map(new Func1, DtlEnvironmentInner>() { + @Override + public DtlEnvironmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param dtlEnvironment An environment, which is essentially an ARM template deployment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DtlEnvironmentInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, DtlEnvironmentInner dtlEnvironment) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (dtlEnvironment == null) { + throw new IllegalArgumentException("Parameter dtlEnvironment 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(dtlEnvironment); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, userName, name, dtlEnvironment, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(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 environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String userName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().last().body(); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param 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 labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String labName, String userName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String userName, String name) { + beginDeleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @param 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 labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String labName, String userName, String name) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete environment. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the environment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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, labName, userName, 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); + } + + /** + * List environments in a given user profile. + * + * @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<DtlEnvironmentInner> 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 environments in a given user profile. + * + * @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 environments in a given user profile. + * + * @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<DtlEnvironmentInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List environments in a given user profile. + * + * @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<DtlEnvironmentInner> 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 environments in a given user profile. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DtlEnvironmentInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EvaluatePoliciesResponseImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EvaluatePoliciesResponseImpl.java new file mode 100644 index 000000000000..b58da88d3ecf --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EvaluatePoliciesResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EvaluatePoliciesResponseInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/EvaluatePoliciesResponseInner.java new file mode 100644 index 000000000000..c27a58df2d5a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulaImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulaImpl.java new file mode 100644 index 000000000000..ad51ab78fb0f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Formula; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVirtualMachineCreationParameter; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.FormulaPropertiesFromVm; + +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.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + FormulasInner client = this.manager().inner().formulas(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + FormulasInner client = this.manager().inner().formulas(); + return client.getAsync(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 LabVirtualMachineCreationParameter formulaContent() { + return this.inner().formulaContent(); + } + + @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 String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @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 withAuthor(String author) { + this.inner().withAuthor(author); + return this; + } + + @Override + public FormulaImpl withDescription(String description) { + this.inner().withDescription(description); + return this; + } + + @Override + public FormulaImpl withFormulaContent(LabVirtualMachineCreationParameter formulaContent) { + this.inner().withFormulaContent(formulaContent); + return this; + } + + @Override + public FormulaImpl withLocation(String location) { + this.inner().withLocation(location); + 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 withUniqueIdentifier(String uniqueIdentifier) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + return this; + } + + @Override + public FormulaImpl withVm(FormulaPropertiesFromVm vm) { + this.inner().withVm(vm); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulaInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulaInner.java new file mode 100644 index 000000000000..ac5439a72b74 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulaInner.java @@ -0,0 +1,222 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVirtualMachineCreationParameter; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.FormulaPropertiesFromVm; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A formula for creating a VM, specifying an image base and other parameters. + */ +@JsonFlatten +@SkipParentValidation +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", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationDate; + + /** + * The content of the formula. + */ + @JsonProperty(value = "properties.formulaContent") + private LabVirtualMachineCreationParameter formulaContent; + + /** + * Information about a VM from which a formula is to be created. + */ + @JsonProperty(value = "properties.vm") + private FormulaPropertiesFromVm vm; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * 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; + } + + /** + * Get the content of the formula. + * + * @return the formulaContent value + */ + public LabVirtualMachineCreationParameter 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(LabVirtualMachineCreationParameter 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the FormulaInner object itself. + */ + public FormulaInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulasImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulasImpl.java new file mode 100644 index 000000000000..3cecb6a05fad --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Formulas; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name) { + FormulasInner client = this.inner(); + return client.getAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + FormulasInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulasInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulasInner.java new file mode 100644 index 000000000000..f18715994f21 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/FormulasInner.java @@ -0,0 +1,927 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.Formulas get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Formulas createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}") + Observable> createOrUpdate(@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.v2016_05_15.Formulas beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}") + Observable> beginCreateOrUpdate(@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.v2016_05_15.Formulas delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/formulas/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.Formulas listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given lab. + * + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List formulas in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=description)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get formula. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the formula. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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 expand Specify the $expand query. Example: 'properties($select=description)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FormulaInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FormulaInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 A formula for creating a VM, specifying an image base and other parameters + * @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 createOrUpdate(String resourceGroupName, String labName, String name, FormulaInner formula) { + return createOrUpdateWithServiceResponseAsync(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 A formula for creating a VM, specifying an image base and other parameters + * @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 createOrUpdateAsync(String resourceGroupName, String labName, String name, FormulaInner formula, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(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 A formula for creating a VM, specifying an image base and other parameters + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, FormulaInner formula) { + return createOrUpdateWithServiceResponseAsync(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 A formula for creating a VM, specifying an image base and other parameters + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 A formula for creating a VM, specifying an image base and other parameters + * @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 beginCreateOrUpdate(String resourceGroupName, String labName, String name, FormulaInner formula) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A formula for creating a VM, specifying an image base and other parameters + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, FormulaInner formula, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(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 A formula for creating a VM, specifying an image base and other parameters + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FormulaInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, FormulaInner formula) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A formula for creating a VM, specifying an image base and other parameters + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the FormulaInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(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 delete(String resourceGroupName, String labName, String name) { + deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(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> deleteWithServiceResponseAsync(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.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImageImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImageImpl.java new file mode 100644 index 000000000000..6a4d57c02cb8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GalleryImage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImageInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImageInner.java new file mode 100644 index 000000000000..afc23e6688dd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImageInner.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GalleryImageReference; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A gallery image. + */ +@JsonFlatten +@SkipParentValidation +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", access = JsonProperty.Access.WRITE_ONLY) + 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; + } + + /** + * 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImagesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImagesImpl.java new file mode 100644 index 000000000000..6b7aa399409e --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GalleryImages; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImagesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImagesInner.java new file mode 100644 index 000000000000..f5a62ecb412d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GalleryImagesInner.java @@ -0,0 +1,443 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.GalleryImages listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given lab. + * + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List gallery images in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=author)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=author)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GenerateUploadUriResponseImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GenerateUploadUriResponseImpl.java new file mode 100644 index 000000000000..cd8e2a12108c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GenerateUploadUriResponseInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GenerateUploadUriResponseInner.java new file mode 100644 index 000000000000..b4732e946576 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GlobalSchedulesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GlobalSchedulesImpl.java new file mode 100644 index 000000000000..11178e8aefdb --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GlobalSchedulesImpl.java @@ -0,0 +1,151 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * def + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GlobalSchedules; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Schedule; +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.v2016_05_15.RetargetScheduleProperties; + +class GlobalSchedulesImpl extends GroupableResourcesCoreImpl implements GlobalSchedules { + protected GlobalSchedulesImpl(DevTestLabsManager manager) { + super(manager.inner().globalSchedules(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + GlobalSchedulesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + GlobalSchedulesInner 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) { + GlobalSchedulesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + GlobalSchedulesInner 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 Schedule call(ScheduleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + GlobalSchedulesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + GlobalSchedulesInner client = this.inner(); + return client.listAsync() + .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 ScheduleImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable executeAsync(String resourceGroupName, String name) { + GlobalSchedulesInner client = this.inner(); + return client.executeAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Completable retargetAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + GlobalSchedulesInner client = this.inner(); + return client.retargetAsync(resourceGroupName, name, retargetScheduleProperties).toCompletable(); + } + + @Override + protected ScheduleImpl wrapModel(ScheduleInner inner) { + return new ScheduleImpl(inner.name(), inner, manager()); + } + + @Override + protected ScheduleImpl wrapModel(String name) { + return new ScheduleImpl(name, new ScheduleInner(), this.manager()); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GlobalSchedulesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GlobalSchedulesInner.java new file mode 100644 index 000000000000..aa181bcd9646 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/GlobalSchedulesInner.java @@ -0,0 +1,1590 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.RetargetScheduleProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ScheduleFragment; +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 GlobalSchedules. + */ +public class GlobalSchedulesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private GlobalSchedulesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of GlobalSchedulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GlobalSchedulesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(GlobalSchedulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for GlobalSchedules to be + * used by Retrofit to perform actually REST calls. + */ + interface GlobalSchedulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.GlobalSchedules list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/schedules") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @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.v2016_05_15.GlobalSchedules listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("$expand") String expand, @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.v2016_05_15.GlobalSchedules getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.GlobalSchedules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @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.v2016_05_15.GlobalSchedules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{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.v2016_05_15.GlobalSchedules update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body ScheduleFragment 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.v2016_05_15.GlobalSchedules execute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute") + Observable> execute(@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.v2016_05_15.GlobalSchedules beginExecute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/execute") + Observable> beginExecute(@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.v2016_05_15.GlobalSchedules retarget" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget") + Observable> retarget(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body RetargetScheduleProperties retargetScheduleProperties, @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.v2016_05_15.GlobalSchedules beginRetarget" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/schedules/{name}/retarget") + Observable> beginRetarget(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body RetargetScheduleProperties retargetScheduleProperties, @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.v2016_05_15.GlobalSchedules 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.v2016_05_15.GlobalSchedules listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List schedules in a subscription. + * + * @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() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules in a subscription. + * + * @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 schedules in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> 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 schedules in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), expand, 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 in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listAsync(final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(expand, 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 in a subscription. + * + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=status)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand, 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(), expand, 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 schedules in a resource group. + * + * @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<ScheduleInner> 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 schedules in a resource group. + * + * @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 schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> 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 schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, expand, 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 schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 listByResourceGroup(final String resourceGroupName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String expand, final String filter, final Integer top, final String orderby) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String expand, final String filter, final Integer top, final String orderby) { + return listByResourceGroupSinglePageAsync(resourceGroupName, expand, 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 schedules in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=status)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String expand, 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, expand, 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 schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 getByResourceGroup(String resourceGroupName, String name) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @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 getByResourceGroupAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String name) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, 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 name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner 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."); + } + final String expand = null; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, name, expand, 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); + } + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 getByResourceGroup(String resourceGroupName, String name, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand).toBlocking().single().body(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param 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, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand), serviceCallback); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String name, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String name, String expand) { + 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, expand, 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 schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 createOrUpdate(String resourceGroupName, String name, ScheduleInner schedule) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, schedule).toBlocking().single().body(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param 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 createOrUpdateAsync(String resourceGroupName, String name, ScheduleInner schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, schedule), serviceCallback); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String name, ScheduleInner schedule) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, schedule).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, 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 (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.createOrUpdate(this.client.subscriptionId(), resourceGroupName, name, schedule, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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. + * + * @param resourceGroupName The name of the resource group. + * @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 delete(String resourceGroupName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @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 deleteAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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 schedule. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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."); + } + return service.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 schedules. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 update(String resourceGroupName, String name, ScheduleFragment schedule) { + return updateWithServiceResponseAsync(resourceGroupName, name, schedule).toBlocking().single().body(); + } + + /** + * Modify properties of schedules. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A 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 updateAsync(String resourceGroupName, String name, ScheduleFragment schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, name, schedule), serviceCallback); + } + + /** + * Modify properties of schedules. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable updateAsync(String resourceGroupName, String name, ScheduleFragment schedule) { + return updateWithServiceResponseAsync(resourceGroupName, 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 name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String name, ScheduleFragment 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 (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.update(this.client.subscriptionId(), resourceGroupName, name, schedule, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 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 name) { + executeWithServiceResponseAsync(resourceGroupName, name).toBlocking().last().body(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param 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 name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(executeWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable executeAsync(String resourceGroupName, String name) { + return executeWithServiceResponseAsync(resourceGroupName, 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 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 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.execute(this.client.subscriptionId(), resourceGroupName, 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 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 name) { + beginExecuteWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param 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 name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExecuteWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Execute a schedule. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginExecuteAsync(String resourceGroupName, String name) { + return beginExecuteWithServiceResponseAsync(resourceGroupName, 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 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 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.beginExecute(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 = 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); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 retarget(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + retargetWithServiceResponseAsync(resourceGroupName, name, retargetScheduleProperties).toBlocking().last().body(); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param 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 retargetAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(retargetWithServiceResponseAsync(resourceGroupName, name, retargetScheduleProperties), serviceCallback); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable retargetAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + return retargetWithServiceResponseAsync(resourceGroupName, name, retargetScheduleProperties).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> retargetWithServiceResponseAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + 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 (retargetScheduleProperties == null) { + throw new IllegalArgumentException("Parameter retargetScheduleProperties 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(retargetScheduleProperties); + Observable> observable = service.retarget(this.client.subscriptionId(), resourceGroupName, name, retargetScheduleProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 beginRetarget(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + beginRetargetWithServiceResponseAsync(resourceGroupName, name, retargetScheduleProperties).toBlocking().single().body(); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @param 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 beginRetargetAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRetargetWithServiceResponseAsync(resourceGroupName, name, retargetScheduleProperties), serviceCallback); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRetargetAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + return beginRetargetWithServiceResponseAsync(resourceGroupName, name, retargetScheduleProperties).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a schedule's target resource Id. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the schedule. + * @param retargetScheduleProperties Properties for retargeting a virtual machine schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRetargetWithServiceResponseAsync(String resourceGroupName, String name, RetargetScheduleProperties retargetScheduleProperties) { + 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 (retargetScheduleProperties == null) { + throw new IllegalArgumentException("Parameter retargetScheduleProperties 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(retargetScheduleProperties); + return service.beginRetarget(this.client.subscriptionId(), resourceGroupName, name, retargetScheduleProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRetargetDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRetargetDelegate(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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + 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); + } + + /** + * List schedules in a resource group. + * + * @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 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 schedules in a resource group. + * + * @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 schedules in a resource group. + * + * @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> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a resource group. + * + * @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>> 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 schedules in a resource group. + * + 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>> 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); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/IdParsingUtils.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..ba0ecac73749 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabCostImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabCostImpl.java new file mode 100644 index 000000000000..b7f754b531bc --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabCostImpl.java @@ -0,0 +1,215 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabCost; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.TargetCostProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabCostSummaryProperties; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabCostDetailsProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabResourceCostProperties; +import org.joda.time.DateTime; + +class LabCostImpl extends CreatableUpdatableImpl implements LabCost, LabCost.Definition, LabCost.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + LabCostImpl(String name, DevTestLabsManager manager) { + super(name, new LabCostInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + LabCostImpl(LabCostInner 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(), "costs"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + CostsInner client = this.manager().inner().costs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CostsInner client = this.manager().inner().costs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CostsInner client = this.manager().inner().costs(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String currencyCode() { + return this.inner().currencyCode(); + } + + @Override + public DateTime endDateTime() { + return this.inner().endDateTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List labCostDetails() { + return this.inner().labCostDetails(); + } + + @Override + public LabCostSummaryProperties labCostSummary() { + return this.inner().labCostSummary(); + } + + @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 resourceCosts() { + return this.inner().resourceCosts(); + } + + @Override + public DateTime startDateTime() { + return this.inner().startDateTime(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public TargetCostProperties targetCost() { + return this.inner().targetCost(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public LabCostImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public LabCostImpl withCreatedDate(DateTime createdDate) { + this.inner().withCreatedDate(createdDate); + return this; + } + + @Override + public LabCostImpl withCurrencyCode(String currencyCode) { + this.inner().withCurrencyCode(currencyCode); + return this; + } + + @Override + public LabCostImpl withEndDateTime(DateTime endDateTime) { + this.inner().withEndDateTime(endDateTime); + return this; + } + + @Override + public LabCostImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public LabCostImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public LabCostImpl withStartDateTime(DateTime startDateTime) { + this.inner().withStartDateTime(startDateTime); + return this; + } + + @Override + public LabCostImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public LabCostImpl withTargetCost(TargetCostProperties targetCost) { + this.inner().withTargetCost(targetCost); + return this; + } + + @Override + public LabCostImpl withUniqueIdentifier(String uniqueIdentifier) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabCostInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabCostInner.java new file mode 100644 index 000000000000..374c1b0ed41a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabCostInner.java @@ -0,0 +1,255 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.TargetCostProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabCostSummaryProperties; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabCostDetailsProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabResourceCostProperties; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A cost item. + */ +@JsonFlatten +@SkipParentValidation +public class LabCostInner extends Resource { + /** + * The target cost properties. + */ + @JsonProperty(value = "properties.targetCost") + private TargetCostProperties targetCost; + + /** + * The lab cost summary component of the cost data. + */ + @JsonProperty(value = "properties.labCostSummary", access = JsonProperty.Access.WRITE_ONLY) + private LabCostSummaryProperties labCostSummary; + + /** + * The lab cost details component of the cost data. + */ + @JsonProperty(value = "properties.labCostDetails", access = JsonProperty.Access.WRITE_ONLY) + private List labCostDetails; + + /** + * The resource cost component of the cost data. + */ + @JsonProperty(value = "properties.resourceCosts", access = JsonProperty.Access.WRITE_ONLY) + private List resourceCosts; + + /** + * The currency code of the cost. + */ + @JsonProperty(value = "properties.currencyCode") + private String currencyCode; + + /** + * The start time of the cost data. + */ + @JsonProperty(value = "properties.startDateTime") + private DateTime startDateTime; + + /** + * The end time of the cost data. + */ + @JsonProperty(value = "properties.endDateTime") + private DateTime endDateTime; + + /** + * The creation date of the cost. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the target cost properties. + * + * @return the targetCost value + */ + public TargetCostProperties targetCost() { + return this.targetCost; + } + + /** + * Set the target cost properties. + * + * @param targetCost the targetCost value to set + * @return the LabCostInner object itself. + */ + public LabCostInner withTargetCost(TargetCostProperties targetCost) { + this.targetCost = targetCost; + return this; + } + + /** + * Get the lab cost summary component of the cost data. + * + * @return the labCostSummary value + */ + public LabCostSummaryProperties labCostSummary() { + return this.labCostSummary; + } + + /** + * Get the lab cost details component of the cost data. + * + * @return the labCostDetails value + */ + public List labCostDetails() { + return this.labCostDetails; + } + + /** + * Get the resource cost component of the cost data. + * + * @return the resourceCosts value + */ + public List resourceCosts() { + return this.resourceCosts; + } + + /** + * 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 LabCostInner object itself. + */ + public LabCostInner withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the start time of the cost data. + * + * @return the startDateTime value + */ + public DateTime startDateTime() { + return this.startDateTime; + } + + /** + * Set the start time of the cost data. + * + * @param startDateTime the startDateTime value to set + * @return the LabCostInner object itself. + */ + public LabCostInner withStartDateTime(DateTime startDateTime) { + this.startDateTime = startDateTime; + return this; + } + + /** + * Get the end time of the cost data. + * + * @return the endDateTime value + */ + public DateTime endDateTime() { + return this.endDateTime; + } + + /** + * Set the end time of the cost data. + * + * @param endDateTime the endDateTime value to set + * @return the LabCostInner object itself. + */ + public LabCostInner withEndDateTime(DateTime endDateTime) { + this.endDateTime = endDateTime; + return this; + } + + /** + * Get the creation date of the cost. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set the creation date of the cost. + * + * @param createdDate the createdDate value to set + * @return the LabCostInner object itself. + */ + public LabCostInner 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 LabCostInner object itself. + */ + public LabCostInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the LabCostInner object itself. + */ + public LabCostInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabImpl.java new file mode 100644 index 000000000000..a2abbf0c0ab2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabImpl.java @@ -0,0 +1,160 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Lab; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.StorageType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PremiumDataDisk; +import rx.functions.Func1; + +class LabImpl extends GroupableResourceCoreImpl implements Lab, Lab.Definition, Lab.Update { + private LabFragment updateParameter; + LabImpl(String name, LabInner inner, DevTestLabsManager manager) { + super(name, inner, manager); + this.updateParameter = new LabFragment(); + } + + @Override + public Observable createResourceAsync() { + LabsInner client = this.manager().inner().labs(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public LabInner call(LabInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LabsInner client = this.manager().inner().labs(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public LabInner call(LabInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .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; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new LabFragment(); + } + + @Override + public String artifactsStorageAccount() { + return this.inner().artifactsStorageAccount(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String defaultPremiumStorageAccount() { + return this.inner().defaultPremiumStorageAccount(); + } + + @Override + public String defaultStorageAccount() { + return this.inner().defaultStorageAccount(); + } + + @Override + public StorageType labStorageType() { + return this.inner().labStorageType(); + } + + @Override + public PremiumDataDisk premiumDataDisks() { + return this.inner().premiumDataDisks(); + } + + @Override + public String premiumDataDiskStorageAccount() { + return this.inner().premiumDataDiskStorageAccount(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public String vaultName() { + return this.inner().vaultName(); + } + + @Override + public LabImpl withLabStorageType(StorageType labStorageType) { + if (isInCreateMode()) { + this.inner().withLabStorageType(labStorageType); + } else { + this.updateParameter.withLabStorageType(labStorageType); + } + return this; + } + + @Override + public LabImpl withPremiumDataDisks(PremiumDataDisk premiumDataDisks) { + if (isInCreateMode()) { + this.inner().withPremiumDataDisks(premiumDataDisks); + } else { + this.updateParameter.withPremiumDataDisks(premiumDataDisks); + } + return this; + } + + @Override + public LabImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public LabImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabInner.java new file mode 100644 index 000000000000..5e373a199f29 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabInner.java @@ -0,0 +1,228 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.StorageType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PremiumDataDisk; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A lab. + */ +@JsonFlatten +@SkipParentValidation +public class LabInner extends Resource { + /** + * The lab's default storage account. + */ + @JsonProperty(value = "properties.defaultStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String defaultStorageAccount; + + /** + * The lab's default premium storage account. + */ + @JsonProperty(value = "properties.defaultPremiumStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String defaultPremiumStorageAccount; + + /** + * The lab's artifact storage account. + */ + @JsonProperty(value = "properties.artifactsStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String artifactsStorageAccount; + + /** + * The lab's premium data disk storage account. + */ + @JsonProperty(value = "properties.premiumDataDiskStorageAccount", access = JsonProperty.Access.WRITE_ONLY) + private String premiumDataDiskStorageAccount; + + /** + * The lab's Key vault. + */ + @JsonProperty(value = "properties.vaultName", access = JsonProperty.Access.WRITE_ONLY) + private String vaultName; + + /** + * Type of storage used by the lab. It can be either Premium or Standard. + * Default is Premium. Possible values include: 'Standard', 'Premium'. + */ + @JsonProperty(value = "properties.labStorageType") + private StorageType labStorageType; + + /** + * The creation date of the lab. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The setting to enable usage of premium data disks. + * When its value is 'Enabled', creation of standard or premium data disks + * is allowed. + * When its value is 'Disabled', only creation of standard data disks is + * allowed. Possible values include: 'Disabled', 'Enabled'. + */ + @JsonProperty(value = "properties.premiumDataDisks") + private PremiumDataDisk premiumDataDisks; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the lab's default storage account. + * + * @return the defaultStorageAccount value + */ + public String defaultStorageAccount() { + return this.defaultStorageAccount; + } + + /** + * Get the lab's default premium storage account. + * + * @return the defaultPremiumStorageAccount value + */ + public String defaultPremiumStorageAccount() { + return this.defaultPremiumStorageAccount; + } + + /** + * Get the lab's artifact storage account. + * + * @return the artifactsStorageAccount value + */ + public String artifactsStorageAccount() { + return this.artifactsStorageAccount; + } + + /** + * Get the lab's premium data disk storage account. + * + * @return the premiumDataDiskStorageAccount value + */ + public String premiumDataDiskStorageAccount() { + return this.premiumDataDiskStorageAccount; + } + + /** + * Get the lab's Key vault. + * + * @return the vaultName value + */ + public String vaultName() { + return this.vaultName; + } + + /** + * Get type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium'. + * + * @return the labStorageType value + */ + public StorageType labStorageType() { + return this.labStorageType; + } + + /** + * Set type of storage used by the lab. It can be either Premium or Standard. Default is Premium. Possible values include: 'Standard', 'Premium'. + * + * @param labStorageType the labStorageType value to set + * @return the LabInner object itself. + */ + public LabInner withLabStorageType(StorageType labStorageType) { + this.labStorageType = labStorageType; + return this; + } + + /** + * Get the creation date of the lab. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Get the setting to enable usage of premium data disks. + When its value is 'Enabled', creation of standard or premium data disks is allowed. + When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'Disabled', 'Enabled'. + * + * @return the premiumDataDisks value + */ + public PremiumDataDisk premiumDataDisks() { + return this.premiumDataDisks; + } + + /** + * Set the setting to enable usage of premium data disks. + When its value is 'Enabled', creation of standard or premium data disks is allowed. + When its value is 'Disabled', only creation of standard data disks is allowed. Possible values include: 'Disabled', 'Enabled'. + * + * @param premiumDataDisks the premiumDataDisks value to set + * @return the LabInner object itself. + */ + public LabInner withPremiumDataDisks(PremiumDataDisk premiumDataDisks) { + this.premiumDataDisks = premiumDataDisks; + 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the LabInner object itself. + */ + public LabInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabScheduleImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabScheduleImpl.java new file mode 100644 index 000000000000..fc071dcbe347 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabScheduleImpl.java @@ -0,0 +1,320 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabSchedule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ScheduleFragment; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnableStatus; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.WeekDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DayDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HourDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationSettings; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DayDetailsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HourDetailsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationSettingsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.WeekDetailsFragment; +import rx.functions.Func1; + +class LabScheduleImpl extends CreatableUpdatableImpl implements LabSchedule, LabSchedule.Definition, LabSchedule.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + private ScheduleFragment updateParameter; + + LabScheduleImpl(String name, DevTestLabsManager manager) { + super(name, new ScheduleInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new ScheduleFragment(); + } + + LabScheduleImpl(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"); + // + this.updateParameter = new ScheduleFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SchedulesInner client = this.manager().inner().schedules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(new Func1() { + @Override + public ScheduleInner call(ScheduleInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SchedulesInner client = this.manager().inner().schedules(); + return client.updateAsync(this.resourceGroupName, this.labName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public ScheduleInner call(ScheduleInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SchedulesInner client = this.manager().inner().schedules(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ScheduleFragment(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @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 NotificationSettings notificationSettings() { + return this.inner().notificationSettings(); + } + + @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 String targetResourceId() { + return this.inner().targetResourceId(); + } + + @Override + public String taskType() { + return this.inner().taskType(); + } + + @Override + public String timeZoneId() { + return this.inner().timeZoneId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public WeekDetails weeklyRecurrence() { + return this.inner().weeklyRecurrence(); + } + + @Override + public LabScheduleImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public LabScheduleImpl withDailyRecurrence(DayDetails dailyRecurrence) { + this.inner().withDailyRecurrence(dailyRecurrence); + return this; + } + + @Override + public LabScheduleImpl withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.inner().withHourlyRecurrence(hourlyRecurrence); + return this; + } + + @Override + public LabScheduleImpl withNotificationSettings(NotificationSettings notificationSettings) { + this.inner().withNotificationSettings(notificationSettings); + return this; + } + + @Override + public LabScheduleImpl withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.inner().withWeeklyRecurrence(weeklyRecurrence); + return this; + } + + @Override + public LabScheduleImpl withDailyRecurrence(DayDetailsFragment dailyRecurrence) { + this.updateParameter.withDailyRecurrence(dailyRecurrence); + return this; + } + + @Override + public LabScheduleImpl withHourlyRecurrence(HourDetailsFragment hourlyRecurrence) { + this.updateParameter.withHourlyRecurrence(hourlyRecurrence); + return this; + } + + @Override + public LabScheduleImpl withNotificationSettings(NotificationSettingsFragment notificationSettings) { + this.updateParameter.withNotificationSettings(notificationSettings); + return this; + } + + @Override + public LabScheduleImpl withWeeklyRecurrence(WeekDetailsFragment weeklyRecurrence) { + this.updateParameter.withWeeklyRecurrence(weeklyRecurrence); + return this; + } + + @Override + public LabScheduleImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public LabScheduleImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public LabScheduleImpl withStatus(EnableStatus status) { + if (isInCreateMode()) { + this.inner().withStatus(status); + } else { + this.updateParameter.withStatus(status); + } + return this; + } + + @Override + public LabScheduleImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public LabScheduleImpl withTargetResourceId(String targetResourceId) { + if (isInCreateMode()) { + this.inner().withTargetResourceId(targetResourceId); + } else { + this.updateParameter.withTargetResourceId(targetResourceId); + } + return this; + } + + @Override + public LabScheduleImpl withTaskType(String taskType) { + if (isInCreateMode()) { + this.inner().withTaskType(taskType); + } else { + this.updateParameter.withTaskType(taskType); + } + return this; + } + + @Override + public LabScheduleImpl withTimeZoneId(String timeZoneId) { + if (isInCreateMode()) { + this.inner().withTimeZoneId(timeZoneId); + } else { + this.updateParameter.withTimeZoneId(timeZoneId); + } + return this; + } + + @Override + public LabScheduleImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVhdImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVhdImpl.java new file mode 100644 index 000000000000..c07b2974b86d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVhdInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVhdInner.java new file mode 100644 index 000000000000..9a815a73c94a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of a VHD in the lab. + */ +public class LabVhdInner { + /** + * The URI to the VHD. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the URI to the VHD. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the URI to the VHD. + * + * @param id the id value to set + * @return the LabVhdInner object itself. + */ + public LabVhdInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVirtualMachineImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVirtualMachineImpl.java new file mode 100644 index 000000000000..b2287ad8fc41 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVirtualMachineImpl.java @@ -0,0 +1,634 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVirtualMachine; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVirtualMachineFragment; +import java.util.Map; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactInstallProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactDeploymentStatusProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GalleryImageReference; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ComputeVmProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NetworkInterfaceProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachineCreationSource; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ApplicableSchedule; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ApplicableScheduleFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactDeploymentStatusPropertiesFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactInstallPropertiesFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ComputeVmPropertiesFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GalleryImageReferenceFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NetworkInterfacePropertiesFragment; +import rx.functions.Func1; + +class LabVirtualMachineImpl extends CreatableUpdatableImpl implements LabVirtualMachine, LabVirtualMachine.Definition, LabVirtualMachine.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + private LabVirtualMachineFragment updateParameter; + + LabVirtualMachineImpl(String name, DevTestLabsManager manager) { + super(name, new LabVirtualMachineInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new LabVirtualMachineFragment(); + } + + 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"); + // + this.updateParameter = new LabVirtualMachineFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualMachinesInner client = this.manager().inner().virtualMachines(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(new Func1() { + @Override + public LabVirtualMachineInner call(LabVirtualMachineInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualMachinesInner client = this.manager().inner().virtualMachines(); + return client.updateAsync(this.resourceGroupName, this.labName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public LabVirtualMachineInner call(LabVirtualMachineInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualMachinesInner client = this.manager().inner().virtualMachines(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new LabVirtualMachineFragment(); + } + + @Override + public Boolean allowClaim() { + return this.inner().allowClaim(); + } + + @Override + public ApplicableSchedule applicableSchedule() { + ApplicableScheduleInner inner = this.inner().applicableSchedule(); + if (inner != null) { + return new ApplicableScheduleImpl(inner, manager()); + } else { + return 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 ComputeVmProperties computeVm() { + return this.inner().computeVm(); + } + + @Override + public String createdByUser() { + return this.inner().createdByUser(); + } + + @Override + public String createdByUserId() { + return this.inner().createdByUserId(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String customImageId() { + return this.inner().customImageId(); + } + + @Override + public Boolean disallowPublicIpAddress() { + return this.inner().disallowPublicIpAddress(); + } + + @Override + public String environmentId() { + return this.inner().environmentId(); + } + + @Override + public DateTime expirationDate() { + return this.inner().expirationDate(); + } + + @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 NetworkInterfaceProperties networkInterface() { + return this.inner().networkInterface(); + } + + @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 ownerUserPrincipalName() { + return this.inner().ownerUserPrincipalName(); + } + + @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 String storageType() { + return this.inner().storageType(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public String userName() { + return this.inner().userName(); + } + + @Override + public VirtualMachineCreationSource virtualMachineCreationSource() { + return this.inner().virtualMachineCreationSource(); + } + + @Override + public LabVirtualMachineImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public LabVirtualMachineImpl withApplicableSchedule(ApplicableScheduleInner applicableSchedule) { + this.inner().withApplicableSchedule(applicableSchedule); + 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 withComputeVm(ComputeVmProperties computeVm) { + this.inner().withComputeVm(computeVm); + return this; + } + + @Override + public LabVirtualMachineImpl withGalleryImageReference(GalleryImageReference galleryImageReference) { + this.inner().withGalleryImageReference(galleryImageReference); + return this; + } + + @Override + public LabVirtualMachineImpl withNetworkInterface(NetworkInterfaceProperties networkInterface) { + this.inner().withNetworkInterface(networkInterface); + return this; + } + + @Override + public LabVirtualMachineImpl withApplicableSchedule(ApplicableScheduleFragment applicableSchedule) { + this.updateParameter.withApplicableSchedule(applicableSchedule); + return this; + } + + @Override + public LabVirtualMachineImpl withArtifactDeploymentStatus(ArtifactDeploymentStatusPropertiesFragment artifactDeploymentStatus) { + this.updateParameter.withArtifactDeploymentStatus(artifactDeploymentStatus); + return this; + } + + @Override + public LabVirtualMachineImpl withArtifacts(List artifacts) { + this.updateParameter.withArtifacts(artifacts); + return this; + } + + @Override + public LabVirtualMachineImpl withComputeVm(ComputeVmPropertiesFragment computeVm) { + this.updateParameter.withComputeVm(computeVm); + return this; + } + + @Override + public LabVirtualMachineImpl withGalleryImageReference(GalleryImageReferenceFragment galleryImageReference) { + this.updateParameter.withGalleryImageReference(galleryImageReference); + return this; + } + + @Override + public LabVirtualMachineImpl withNetworkInterface(NetworkInterfacePropertiesFragment networkInterface) { + this.updateParameter.withNetworkInterface(networkInterface); + return this; + } + + @Override + public LabVirtualMachineImpl withAllowClaim(Boolean allowClaim) { + if (isInCreateMode()) { + this.inner().withAllowClaim(allowClaim); + } else { + this.updateParameter.withAllowClaim(allowClaim); + } + return this; + } + + @Override + public LabVirtualMachineImpl withCreatedByUser(String createdByUser) { + if (isInCreateMode()) { + this.inner().withCreatedByUser(createdByUser); + } else { + this.updateParameter.withCreatedByUser(createdByUser); + } + return this; + } + + @Override + public LabVirtualMachineImpl withCreatedByUserId(String createdByUserId) { + if (isInCreateMode()) { + this.inner().withCreatedByUserId(createdByUserId); + } else { + this.updateParameter.withCreatedByUserId(createdByUserId); + } + return this; + } + + @Override + public LabVirtualMachineImpl withCreatedDate(DateTime createdDate) { + if (isInCreateMode()) { + this.inner().withCreatedDate(createdDate); + } else { + this.updateParameter.withCreatedDate(createdDate); + } + return this; + } + + @Override + public LabVirtualMachineImpl withCustomImageId(String customImageId) { + if (isInCreateMode()) { + this.inner().withCustomImageId(customImageId); + } else { + this.updateParameter.withCustomImageId(customImageId); + } + return this; + } + + @Override + public LabVirtualMachineImpl withDisallowPublicIpAddress(Boolean disallowPublicIpAddress) { + if (isInCreateMode()) { + this.inner().withDisallowPublicIpAddress(disallowPublicIpAddress); + } else { + this.updateParameter.withDisallowPublicIpAddress(disallowPublicIpAddress); + } + return this; + } + + @Override + public LabVirtualMachineImpl withEnvironmentId(String environmentId) { + if (isInCreateMode()) { + this.inner().withEnvironmentId(environmentId); + } else { + this.updateParameter.withEnvironmentId(environmentId); + } + return this; + } + + @Override + public LabVirtualMachineImpl withExpirationDate(DateTime expirationDate) { + if (isInCreateMode()) { + this.inner().withExpirationDate(expirationDate); + } else { + this.updateParameter.withExpirationDate(expirationDate); + } + return this; + } + + @Override + public LabVirtualMachineImpl withFqdn(String fqdn) { + if (isInCreateMode()) { + this.inner().withFqdn(fqdn); + } else { + this.updateParameter.withFqdn(fqdn); + } + return this; + } + + @Override + public LabVirtualMachineImpl withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey) { + if (isInCreateMode()) { + this.inner().withIsAuthenticationWithSshKey(isAuthenticationWithSshKey); + } else { + this.updateParameter.withIsAuthenticationWithSshKey(isAuthenticationWithSshKey); + } + return this; + } + + @Override + public LabVirtualMachineImpl withLabSubnetName(String labSubnetName) { + if (isInCreateMode()) { + this.inner().withLabSubnetName(labSubnetName); + } else { + this.updateParameter.withLabSubnetName(labSubnetName); + } + return this; + } + + @Override + public LabVirtualMachineImpl withLabVirtualNetworkId(String labVirtualNetworkId) { + if (isInCreateMode()) { + this.inner().withLabVirtualNetworkId(labVirtualNetworkId); + } else { + this.updateParameter.withLabVirtualNetworkId(labVirtualNetworkId); + } + return this; + } + + @Override + public LabVirtualMachineImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public LabVirtualMachineImpl withNotes(String notes) { + if (isInCreateMode()) { + this.inner().withNotes(notes); + } else { + this.updateParameter.withNotes(notes); + } + return this; + } + + @Override + public LabVirtualMachineImpl withOsType(String osType) { + if (isInCreateMode()) { + this.inner().withOsType(osType); + } else { + this.updateParameter.withOsType(osType); + } + return this; + } + + @Override + public LabVirtualMachineImpl withOwnerObjectId(String ownerObjectId) { + if (isInCreateMode()) { + this.inner().withOwnerObjectId(ownerObjectId); + } else { + this.updateParameter.withOwnerObjectId(ownerObjectId); + } + return this; + } + + @Override + public LabVirtualMachineImpl withOwnerUserPrincipalName(String ownerUserPrincipalName) { + if (isInCreateMode()) { + this.inner().withOwnerUserPrincipalName(ownerUserPrincipalName); + } else { + this.updateParameter.withOwnerUserPrincipalName(ownerUserPrincipalName); + } + return this; + } + + @Override + public LabVirtualMachineImpl withPassword(String password) { + if (isInCreateMode()) { + this.inner().withPassword(password); + } else { + this.updateParameter.withPassword(password); + } + return this; + } + + @Override + public LabVirtualMachineImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public LabVirtualMachineImpl withSize(String size) { + if (isInCreateMode()) { + this.inner().withSize(size); + } else { + this.updateParameter.withSize(size); + } + return this; + } + + @Override + public LabVirtualMachineImpl withSshKey(String sshKey) { + if (isInCreateMode()) { + this.inner().withSshKey(sshKey); + } else { + this.updateParameter.withSshKey(sshKey); + } + return this; + } + + @Override + public LabVirtualMachineImpl withStorageType(String storageType) { + if (isInCreateMode()) { + this.inner().withStorageType(storageType); + } else { + this.updateParameter.withStorageType(storageType); + } + return this; + } + + @Override + public LabVirtualMachineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public LabVirtualMachineImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + + @Override + public LabVirtualMachineImpl withUserName(String userName) { + if (isInCreateMode()) { + this.inner().withUserName(userName); + } else { + this.updateParameter.withUserName(userName); + } + return this; + } + + @Override + public LabVirtualMachineImpl withVirtualMachineCreationSource(VirtualMachineCreationSource virtualMachineCreationSource) { + if (isInCreateMode()) { + this.inner().withVirtualMachineCreationSource(virtualMachineCreationSource); + } else { + this.updateParameter.withVirtualMachineCreationSource(virtualMachineCreationSource); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVirtualMachineInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVirtualMachineInner.java new file mode 100644 index 000000000000..42351ded3ec7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabVirtualMachineInner.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.v2016_05_15.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactInstallProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactDeploymentStatusProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GalleryImageReference; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ComputeVmProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NetworkInterfaceProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachineCreationSource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A virtual machine. + */ +@JsonFlatten +@SkipParentValidation +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 user principal name of the virtual machine owner. + */ + @JsonProperty(value = "properties.ownerUserPrincipalName") + private String ownerUserPrincipalName; + + /** + * The object identifier of the creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUserId") + private String createdByUserId; + + /** + * The email address of creator of the virtual machine. + */ + @JsonProperty(value = "properties.createdByUser") + private String createdByUser; + + /** + * The creation date of the virtual machine. + */ + @JsonProperty(value = "properties.createdDate") + private DateTime createdDate; + + /** + * The resource identifier (Microsoft.Compute) of the virtual machine. + */ + @JsonProperty(value = "properties.computeId", access = JsonProperty.Access.WRITE_ONLY) + private String computeId; + + /** + * The custom image identifier of the virtual machine. + */ + @JsonProperty(value = "properties.customImageId") + private String customImageId; + + /** + * The OS type of the virtual machine. + */ + @JsonProperty(value = "properties.osType") + private String osType; + + /** + * The size of the virtual machine. + */ + @JsonProperty(value = "properties.size") + private String size; + + /** + * The user name of the virtual machine. + */ + @JsonProperty(value = "properties.userName") + private String userName; + + /** + * The password of the virtual machine administrator. + */ + @JsonProperty(value = "properties.password") + private String password; + + /** + * The SSH key of the virtual machine administrator. + */ + @JsonProperty(value = "properties.sshKey") + private String sshKey; + + /** + * Indicates whether this virtual machine uses an SSH key for + * authentication. + */ + @JsonProperty(value = "properties.isAuthenticationWithSshKey") + private Boolean isAuthenticationWithSshKey; + + /** + * The fully-qualified domain name of the virtual machine. + */ + @JsonProperty(value = "properties.fqdn") + 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 compute virtual machine properties. + */ + @JsonProperty(value = "properties.computeVm") + private ComputeVmProperties computeVm; + + /** + * The network interface properties. + */ + @JsonProperty(value = "properties.networkInterface") + private NetworkInterfaceProperties networkInterface; + + /** + * The applicable schedule for the virtual machine. + */ + @JsonProperty(value = "properties.applicableSchedule") + private ApplicableScheduleInner applicableSchedule; + + /** + * The expiration date for VM. + */ + @JsonProperty(value = "properties.expirationDate") + private DateTime expirationDate; + + /** + * Indicates whether another user can take ownership of the virtual + * machine. + */ + @JsonProperty(value = "properties.allowClaim") + private Boolean allowClaim; + + /** + * Storage type to use for virtual machine (i.e. Standard, Premium). + */ + @JsonProperty(value = "properties.storageType") + private String storageType; + + /** + * Tells source of creation of lab virtual machine. Output property only. + * Possible values include: 'FromCustomImage', 'FromGalleryImage'. + */ + @JsonProperty(value = "properties.virtualMachineCreationSource") + private VirtualMachineCreationSource virtualMachineCreationSource; + + /** + * The resource ID of the environment that contains this virtual machine, + * if any. + */ + @JsonProperty(value = "properties.environmentId") + private String environmentId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * 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 user principal name of the virtual machine owner. + * + * @return the ownerUserPrincipalName value + */ + public String ownerUserPrincipalName() { + return this.ownerUserPrincipalName; + } + + /** + * Set the user principal name of the virtual machine owner. + * + * @param ownerUserPrincipalName the ownerUserPrincipalName value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withOwnerUserPrincipalName(String ownerUserPrincipalName) { + this.ownerUserPrincipalName = ownerUserPrincipalName; + return this; + } + + /** + * Get the 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 creation date of the virtual machine. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Set the creation date of the virtual machine. + * + * @param createdDate the createdDate value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withCreatedDate(DateTime createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the resource identifier (Microsoft.Compute) of the virtual machine. + * + * @return the computeId value + */ + public String computeId() { + return this.computeId; + } + + /** + * 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 indicates whether this virtual machine uses an SSH key for authentication. + * + * @return the isAuthenticationWithSshKey value + */ + public Boolean isAuthenticationWithSshKey() { + return this.isAuthenticationWithSshKey; + } + + /** + * Set indicates whether this virtual machine uses an SSH key for authentication. + * + * @param isAuthenticationWithSshKey the isAuthenticationWithSshKey value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withIsAuthenticationWithSshKey(Boolean isAuthenticationWithSshKey) { + this.isAuthenticationWithSshKey = isAuthenticationWithSshKey; + return this; + } + + /** + * Get the 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 compute virtual machine properties. + * + * @return the computeVm value + */ + public ComputeVmProperties computeVm() { + return this.computeVm; + } + + /** + * Set the compute virtual machine properties. + * + * @param computeVm the computeVm value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withComputeVm(ComputeVmProperties computeVm) { + this.computeVm = computeVm; + return this; + } + + /** + * Get the network interface properties. + * + * @return the networkInterface value + */ + public NetworkInterfaceProperties networkInterface() { + return this.networkInterface; + } + + /** + * Set the network interface properties. + * + * @param networkInterface the networkInterface value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withNetworkInterface(NetworkInterfaceProperties networkInterface) { + this.networkInterface = networkInterface; + return this; + } + + /** + * Get the applicable schedule for the virtual machine. + * + * @return the applicableSchedule value + */ + public ApplicableScheduleInner applicableSchedule() { + return this.applicableSchedule; + } + + /** + * Set the applicable schedule for the virtual machine. + * + * @param applicableSchedule the applicableSchedule value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withApplicableSchedule(ApplicableScheduleInner applicableSchedule) { + this.applicableSchedule = applicableSchedule; + return this; + } + + /** + * Get the expiration date for VM. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Set the expiration date for VM. + * + * @param expirationDate the expirationDate value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withExpirationDate(DateTime expirationDate) { + this.expirationDate = expirationDate; + return this; + } + + /** + * Get indicates whether another user can take ownership of the virtual machine. + * + * @return the allowClaim value + */ + public Boolean allowClaim() { + return this.allowClaim; + } + + /** + * Set indicates whether another user can take ownership of the virtual machine. + * + * @param allowClaim the allowClaim value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withAllowClaim(Boolean allowClaim) { + this.allowClaim = allowClaim; + return this; + } + + /** + * Get storage type to use for virtual machine (i.e. Standard, Premium). + * + * @return the storageType value + */ + public String storageType() { + return this.storageType; + } + + /** + * Set storage type to use for virtual machine (i.e. Standard, Premium). + * + * @param storageType the storageType value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withStorageType(String storageType) { + this.storageType = storageType; + return this; + } + + /** + * Get tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage'. + * + * @return the virtualMachineCreationSource value + */ + public VirtualMachineCreationSource virtualMachineCreationSource() { + return this.virtualMachineCreationSource; + } + + /** + * Set tells source of creation of lab virtual machine. Output property only. Possible values include: 'FromCustomImage', 'FromGalleryImage'. + * + * @param virtualMachineCreationSource the virtualMachineCreationSource value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withVirtualMachineCreationSource(VirtualMachineCreationSource virtualMachineCreationSource) { + this.virtualMachineCreationSource = virtualMachineCreationSource; + return this; + } + + /** + * Get the resource ID of the environment that contains this virtual machine, if any. + * + * @return the environmentId value + */ + public String environmentId() { + return this.environmentId; + } + + /** + * Set the resource ID of the environment that contains this virtual machine, if any. + * + * @param environmentId the environmentId value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withEnvironmentId(String environmentId) { + this.environmentId = environmentId; + return this; + } + + /** + * Get the 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the LabVirtualMachineInner object itself. + */ + public LabVirtualMachineInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabsImpl.java new file mode 100644 index 000000000000..abd0b4fa2f50 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabsImpl.java @@ -0,0 +1,190 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Labs; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.GenerateUploadUriResponse; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVhd; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVirtualMachineCreationParameter; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ExportResourceUsageParameters; + +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 claimAnyVmAsync(String resourceGroupName, String name) { + LabsInner client = this.inner(); + return client.claimAnyVmAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Completable createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + LabsInner client = this.inner(); + return client.createEnvironmentAsync(resourceGroupName, name, labVirtualMachineCreationParameter).toCompletable(); + } + + @Override + public Completable exportResourceUsageAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + LabsInner client = this.inner(); + return client.exportResourceUsageAsync(resourceGroupName, name, exportResourceUsageParameters).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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabsInner.java new file mode 100644 index 000000000000..01c49dac9c1b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/LabsInner.java @@ -0,0 +1,2343 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.ExportResourceUsageParameters; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.GenerateUploadUriParameter; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVirtualMachineCreationParameter; +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.v2016_05_15.Labs list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/labs") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @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.v2016_05_15.Labs listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs") + Observable> listByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Query("$expand") String expand, @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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.Labs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}") + Observable> createOrUpdate(@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.v2016_05_15.Labs beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}") + Observable> beginCreateOrUpdate(@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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.Labs update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body LabFragment 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.v2016_05_15.Labs claimAnyVm" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm") + Observable> claimAnyVm(@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.v2016_05_15.Labs beginClaimAnyVm" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/claimAnyVm") + Observable> beginClaimAnyVm(@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.v2016_05_15.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 LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, @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.v2016_05_15.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 LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, @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.v2016_05_15.Labs exportResourceUsage" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage") + Observable> exportResourceUsage(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body ExportResourceUsageParameters exportResourceUsageParameters, @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.v2016_05_15.Labs beginExportResourceUsage" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{name}/exportResourceUsage") + Observable> beginExportResourceUsage(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Body ExportResourceUsageParameters exportResourceUsageParameters, @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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.Labs listVhdsNext" }) + @GET + Observable> listVhdsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List labs in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), expand, 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 in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listAsync(final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs in a subscription. + * + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(expand, 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 in a subscription. + * + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<LabInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand, 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(), expand, 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 in a resource group. + * + * @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 in a resource group. + * + * @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 in a resource group. + * + * @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 in a resource group. + * + * @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 in a resource group. + * + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, expand, 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 in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName, final String expand, final String filter, final Integer top, final String orderby) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List labs in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<LabInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String expand, final String filter, final Integer top, final String orderby) { + return listByResourceGroupSinglePageAsync(resourceGroupName, expand, 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 in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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."); + } + final String expand = null; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, name, expand, 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); + } + } + }); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand).toBlocking().single().body(); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @param 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, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand), serviceCallback); + } + + /** + * Get lab. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String name, String expand) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($select=defaultStorageAccount)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String name, String expand) { + 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, expand, 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 A 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 createOrUpdate(String resourceGroupName, String name, LabInner lab) { + return createOrUpdateWithServiceResponseAsync(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 A 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 createOrUpdateAsync(String resourceGroupName, String name, LabInner lab, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(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 A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String name, LabInner lab) { + return createOrUpdateWithServiceResponseAsync(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 A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 A 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 beginCreateOrUpdate(String resourceGroupName, String name, LabInner lab) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A 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 beginCreateOrUpdateAsync(String resourceGroupName, String name, LabInner lab, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(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 A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String name, LabInner lab) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(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 A 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 update(String resourceGroupName, String name, LabFragment lab) { + return updateWithServiceResponseAsync(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 A 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 updateAsync(String resourceGroupName, String name, LabFragment lab, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(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 A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable updateAsync(String resourceGroupName, String name, LabFragment lab) { + return updateWithServiceResponseAsync(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 A lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String name, LabFragment 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.update(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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 claimAnyVm(String resourceGroupName, String name) { + claimAnyVmWithServiceResponseAsync(resourceGroupName, name).toBlocking().last().body(); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param 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 claimAnyVmAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(claimAnyVmWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable claimAnyVmAsync(String resourceGroupName, String name) { + return claimAnyVmWithServiceResponseAsync(resourceGroupName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> claimAnyVmWithServiceResponseAsync(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.claimAnyVm(this.client.subscriptionId(), resourceGroupName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 beginClaimAnyVm(String resourceGroupName, String name) { + beginClaimAnyVmWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param 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 beginClaimAnyVmAsync(String resourceGroupName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginClaimAnyVmWithServiceResponseAsync(resourceGroupName, name), serviceCallback); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginClaimAnyVmAsync(String resourceGroupName, String name) { + return beginClaimAnyVmWithServiceResponseAsync(resourceGroupName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Claim a random claimable virtual machine in the lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginClaimAnyVmWithServiceResponseAsync(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.beginClaimAnyVm(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 = beginClaimAnyVmDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginClaimAnyVmDelegate(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); + } + + /** + * Create virtual machines in a lab. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + createEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter).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 labVirtualMachineCreationParameter Properties for creating a 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 createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter), 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 labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + return createEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter).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 labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createEnvironmentWithServiceResponseAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + 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 (labVirtualMachineCreationParameter == null) { + throw new IllegalArgumentException("Parameter labVirtualMachineCreationParameter 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(labVirtualMachineCreationParameter); + Observable> observable = service.createEnvironment(this.client.subscriptionId(), resourceGroupName, name, labVirtualMachineCreationParameter, 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 labVirtualMachineCreationParameter Properties for creating a 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 beginCreateEnvironment(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + beginCreateEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter).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 labVirtualMachineCreationParameter Properties for creating a 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 beginCreateEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter), 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 labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginCreateEnvironmentAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + return beginCreateEnvironmentWithServiceResponseAsync(resourceGroupName, name, labVirtualMachineCreationParameter).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 labVirtualMachineCreationParameter Properties for creating a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateEnvironmentWithServiceResponseAsync(String resourceGroupName, String name, LabVirtualMachineCreationParameter labVirtualMachineCreationParameter) { + 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 (labVirtualMachineCreationParameter == null) { + throw new IllegalArgumentException("Parameter labVirtualMachineCreationParameter 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(labVirtualMachineCreationParameter); + return service.beginCreateEnvironment(this.client.subscriptionId(), resourceGroupName, name, labVirtualMachineCreationParameter, 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); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 exportResourceUsage(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + exportResourceUsageWithServiceResponseAsync(resourceGroupName, name, exportResourceUsageParameters).toBlocking().last().body(); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param 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 exportResourceUsageAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(exportResourceUsageWithServiceResponseAsync(resourceGroupName, name, exportResourceUsageParameters), serviceCallback); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable exportResourceUsageAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + return exportResourceUsageWithServiceResponseAsync(resourceGroupName, name, exportResourceUsageParameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> exportResourceUsageWithServiceResponseAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + 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 (exportResourceUsageParameters == null) { + throw new IllegalArgumentException("Parameter exportResourceUsageParameters 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(exportResourceUsageParameters); + Observable> observable = service.exportResourceUsage(this.client.subscriptionId(), resourceGroupName, name, exportResourceUsageParameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 beginExportResourceUsage(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + beginExportResourceUsageWithServiceResponseAsync(resourceGroupName, name, exportResourceUsageParameters).toBlocking().single().body(); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @param 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 beginExportResourceUsageAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExportResourceUsageWithServiceResponseAsync(resourceGroupName, name, exportResourceUsageParameters), serviceCallback); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginExportResourceUsageAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + return beginExportResourceUsageWithServiceResponseAsync(resourceGroupName, name, exportResourceUsageParameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Exports the lab resource usage into a storage account This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the lab. + * @param exportResourceUsageParameters The parameters of the export operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginExportResourceUsageWithServiceResponseAsync(String resourceGroupName, String name, ExportResourceUsageParameters exportResourceUsageParameters) { + 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 (exportResourceUsageParameters == null) { + throw new IllegalArgumentException("Parameter exportResourceUsageParameters 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(exportResourceUsageParameters); + return service.beginExportResourceUsage(this.client.subscriptionId(), resourceGroupName, name, exportResourceUsageParameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginExportResourceUsageDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginExportResourceUsageDelegate(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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + * @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 in a subscription. + * + 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 in a resource group. + * + * @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 in a resource group. + * + * @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 in a resource group. + * + * @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 in a resource group. + * + * @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 in a resource group. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelImpl.java new file mode 100644 index 000000000000..8f20f5873b15 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelImpl.java @@ -0,0 +1,233 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationChannel; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationChannelFragment; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Event; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EventFragment; +import rx.functions.Func1; + +class NotificationChannelImpl extends CreatableUpdatableImpl implements NotificationChannel, NotificationChannel.Definition, NotificationChannel.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + private NotificationChannelFragment updateParameter; + + NotificationChannelImpl(String name, DevTestLabsManager manager) { + super(name, new NotificationChannelInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new NotificationChannelFragment(); + } + + NotificationChannelImpl(NotificationChannelInner 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(), "notificationchannels"); + // + this.updateParameter = new NotificationChannelFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NotificationChannelsInner client = this.manager().inner().notificationChannels(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(new Func1() { + @Override + public NotificationChannelInner call(NotificationChannelInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + NotificationChannelsInner client = this.manager().inner().notificationChannels(); + return client.updateAsync(this.resourceGroupName, this.labName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public NotificationChannelInner call(NotificationChannelInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NotificationChannelsInner client = this.manager().inner().notificationChannels(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new NotificationChannelFragment(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public List events() { + return this.inner().events(); + } + + @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 String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public String webHookUrl() { + return this.inner().webHookUrl(); + } + + @Override + public NotificationChannelImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public NotificationChannelImpl withEvents(List events) { + this.inner().withEvents(events); + return this; + } + + @Override + public NotificationChannelImpl withEvents(List events) { + this.updateParameter.withEvents(events); + return this; + } + + @Override + public NotificationChannelImpl withDescription(String description) { + if (isInCreateMode()) { + this.inner().withDescription(description); + } else { + this.updateParameter.withDescription(description); + } + return this; + } + + @Override + public NotificationChannelImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public NotificationChannelImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public NotificationChannelImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public NotificationChannelImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + + @Override + public NotificationChannelImpl withWebHookUrl(String webHookUrl) { + if (isInCreateMode()) { + this.inner().withWebHookUrl(webHookUrl); + } else { + this.updateParameter.withWebHookUrl(webHookUrl); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelInner.java new file mode 100644 index 000000000000..87e81b9b4510 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelInner.java @@ -0,0 +1,170 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Event; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A notification. + */ +@JsonFlatten +@SkipParentValidation +public class NotificationChannelInner extends Resource { + /** + * The webhook URL to send notifications to. + */ + @JsonProperty(value = "properties.webHookUrl") + private String webHookUrl; + + /** + * Description of notification. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * The list of event for which this notification is enabled. + */ + @JsonProperty(value = "properties.events") + private List events; + + /** + * The creation date of the notification channel. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the webhook URL to send notifications to. + * + * @return the webHookUrl value + */ + public String webHookUrl() { + return this.webHookUrl; + } + + /** + * Set the webhook URL to send notifications to. + * + * @param webHookUrl the webHookUrl value to set + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withWebHookUrl(String webHookUrl) { + this.webHookUrl = webHookUrl; + return this; + } + + /** + * Get description of notification. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of notification. + * + * @param description the description value to set + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the list of event for which this notification is enabled. + * + * @return the events value + */ + public List events() { + return this.events; + } + + /** + * Set the list of event for which this notification is enabled. + * + * @param events the events value to set + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withEvents(List events) { + this.events = events; + return this; + } + + /** + * Get the creation date of the notification channel. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * 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 NotificationChannelInner object itself. + */ + public NotificationChannelInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the NotificationChannelInner object itself. + */ + public NotificationChannelInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelsImpl.java new file mode 100644 index 000000000000..50d8d6418925 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelsImpl.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationChannels; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotifyParameters; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationChannel; + +class NotificationChannelsImpl extends WrapperImpl implements NotificationChannels { + private final DevTestLabsManager manager; + + NotificationChannelsImpl(DevTestLabsManager manager) { + super(manager.inner().notificationChannels()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public NotificationChannelImpl define(String name) { + return wrapModel(name); + } + + private NotificationChannelImpl wrapModel(NotificationChannelInner inner) { + return new NotificationChannelImpl(inner, manager()); + } + + private NotificationChannelImpl wrapModel(String name) { + return new NotificationChannelImpl(name, this.manager()); + } + + @Override + public Completable notifyAsync(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + NotificationChannelsInner client = this.inner(); + return client.notifyAsync(resourceGroupName, labName, name, notifyParameters).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + NotificationChannelsInner 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 NotificationChannel call(NotificationChannelInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String name) { + NotificationChannelsInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(NotificationChannelInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((NotificationChannel)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String name) { + NotificationChannelsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelsInner.java new file mode 100644 index 000000000000..11595f7a99e8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/NotificationChannelsInner.java @@ -0,0 +1,1052 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.NotificationChannelFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotifyParameters; +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 NotificationChannels. + */ +public class NotificationChannelsInner { + /** The Retrofit service to perform REST calls. */ + private NotificationChannelsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of NotificationChannelsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NotificationChannelsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(NotificationChannelsService.class); + this.client = client; + } + + /** + * The interface defining all the services for NotificationChannels to be + * used by Retrofit to perform actually REST calls. + */ + interface NotificationChannelsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationChannels list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$expand") String expand, @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.v2016_05_15.NotificationChannels get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.NotificationChannels createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body NotificationChannelInner notificationChannel, @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.v2016_05_15.NotificationChannels delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.NotificationChannels update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body NotificationChannelFragment notificationChannel, @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.v2016_05_15.NotificationChannels notify" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/notificationchannels/{name}/notify") + Observable> notify(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body NotifyParameters notifyParameters, @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.v2016_05_15.NotificationChannels listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<NotificationChannelInner> 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 notification channels in a given lab. + * + * @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 notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationChannelInner> 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 notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationChannelInner> 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 notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationChannelInner> 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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<NotificationChannelInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationChannelInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List notification channels in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationChannelInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 notification channels in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationChannelInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String expand, 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, expand, 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 notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @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 NotificationChannelInner object if successful. + */ + public NotificationChannelInner get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, NotificationChannelInner>() { + @Override + public NotificationChannelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @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 NotificationChannelInner object if successful. + */ + public NotificationChannelInner get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).toBlocking().single().body(); + } + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), serviceCallback); + } + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).map(new Func1, NotificationChannelInner>() { + @Override + public NotificationChannelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param expand Specify the $expand query. Example: 'properties($select=webHookUrl)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 notificationChannel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @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 NotificationChannelInner object if successful. + */ + public NotificationChannelInner createOrUpdate(String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, notificationChannel).toBlocking().single().body(); + } + + /** + * Create or replace an existing notificationChannel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @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 createOrUpdateAsync(String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, notificationChannel), serviceCallback); + } + + /** + * Create or replace an existing notificationChannel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, notificationChannel).map(new Func1, NotificationChannelInner>() { + @Override + public NotificationChannelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing notificationChannel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String name, NotificationChannelInner notificationChannel) { + 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 (notificationChannel == null) { + throw new IllegalArgumentException("Parameter notificationChannel 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(notificationChannel); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, name, notificationChannel, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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 notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @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 labName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @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 labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete notification channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @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 NotificationChannelInner object if successful. + */ + public NotificationChannelInner update(String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel) { + return updateWithServiceResponseAsync(resourceGroupName, labName, name, notificationChannel).toBlocking().single().body(); + } + + /** + * Modify properties of notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @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 updateAsync(String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, labName, name, notificationChannel), serviceCallback); + } + + /** + * Modify properties of notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel) { + return updateWithServiceResponseAsync(resourceGroupName, labName, name, notificationChannel).map(new Func1, NotificationChannelInner>() { + @Override + public NotificationChannelInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of notification channels. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notificationChannel A notification. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationChannelInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String name, NotificationChannelFragment notificationChannel) { + 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 (notificationChannel == null) { + throw new IllegalArgumentException("Parameter notificationChannel 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(notificationChannel); + return service.update(this.client.subscriptionId(), resourceGroupName, labName, name, notificationChannel, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notifyParameters Properties for generating a Notification. + * @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 notify(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + notifyWithServiceResponseAsync(resourceGroupName, labName, name, notifyParameters).toBlocking().single().body(); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notifyParameters Properties for generating a Notification. + * @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 notifyAsync(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(notifyWithServiceResponseAsync(resourceGroupName, labName, name, notifyParameters), serviceCallback); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable notifyAsync(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + return notifyWithServiceResponseAsync(resourceGroupName, labName, name, notifyParameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Send notification to provided channel. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the notificationChannel. + * @param notifyParameters Properties for generating a Notification. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> notifyWithServiceResponseAsync(String resourceGroupName, String labName, String name, NotifyParameters notifyParameters) { + 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 (notifyParameters == null) { + throw new IllegalArgumentException("Parameter notifyParameters 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(notifyParameters); + return service.notify(this.client.subscriptionId(), resourceGroupName, labName, name, notifyParameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = notifyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse notifyDelegate(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 notification channels in a given lab. + * + * @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<NotificationChannelInner> 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 notification channels in a given lab. + * + * @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 notification channels in a given lab. + * + * @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<NotificationChannelInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List notification channels in a given lab. + * + * @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<NotificationChannelInner> 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 notification channels in a given lab. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationChannelInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationMetadataImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationMetadataImpl.java new file mode 100644 index 000000000000..b3101d1557a1 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationMetadataImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationMetadata; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationMetadataDisplay; + +class OperationMetadataImpl extends WrapperImpl implements OperationMetadata { + private final DevTestLabsManager manager; + OperationMetadataImpl(OperationMetadataInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public OperationMetadataDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationMetadataInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationMetadataInner.java new file mode 100644 index 000000000000..7a76a535f357 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationMetadataInner.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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationMetadataDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The REST API operation supported by DevTestLab ResourceProvider. + */ +public class OperationMetadataInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that describes the operations. + */ + @JsonProperty(value = "display") + private OperationMetadataDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationMetadataInner object itself. + */ + public OperationMetadataInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the object that describes the operations. + * + * @return the display value + */ + public OperationMetadataDisplay display() { + return this.display; + } + + /** + * Set the object that describes the operations. + * + * @param display the display value to set + * @return the OperationMetadataInner object itself. + */ + public OperationMetadataInner withDisplay(OperationMetadataDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationResultImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationResultImpl.java new file mode 100644 index 000000000000..27842debe269 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationResultImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationError; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HttpStatusCode; + +class OperationResultImpl extends WrapperImpl implements OperationResult { + private final DevTestLabsManager manager; + private String locationName; + private String name; + + OperationResultImpl(OperationResultInner inner, DevTestLabsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + + + @Override + public OperationError error() { + return this.inner().error(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public HttpStatusCode statusCode() { + return this.inner().statusCode(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationResultInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationResultInner.java new file mode 100644 index 000000000000..987a8e6044ed --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationResultInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HttpStatusCode; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An Operation Result. + */ +public class OperationResultInner { + /** + * The operation status. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The status code for the operation. Possible values include: 'Continue', + * 'SwitchingProtocols', 'OK', 'Created', 'Accepted', + * 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', + * 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', + * 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', + * 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', + * 'NotFound', 'MethodNotAllowed', 'NotAcceptable', + * 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', + * 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', + * 'RequestUriTooLong', 'UnsupportedMediaType', + * 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', + * 'InternalServerError', 'NotImplemented', 'BadGateway', + * 'ServiceUnavailable', 'GatewayTimeout', 'HttpVersionNotSupported'. + */ + @JsonProperty(value = "statusCode") + private HttpStatusCode statusCode; + + /** + * Error details for the operation in case of a failure. + */ + @JsonProperty(value = "error") + private OperationError error; + + /** + * Get the operation status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the operation status. + * + * @param status the status value to set + * @return the OperationResultInner object itself. + */ + public OperationResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the status code for the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HttpVersionNotSupported'. + * + * @return the statusCode value + */ + public HttpStatusCode statusCode() { + return this.statusCode; + } + + /** + * Set the status code for the operation. Possible values include: 'Continue', 'SwitchingProtocols', 'OK', 'Created', 'Accepted', 'NonAuthoritativeInformation', 'NoContent', 'ResetContent', 'PartialContent', 'MultipleChoices', 'MovedPermanently', 'Redirect', 'SeeOther', 'NotModified', 'UseProxy', 'Unused', 'TemporaryRedirect', 'BadRequest', 'Unauthorized', 'PaymentRequired', 'Forbidden', 'NotFound', 'MethodNotAllowed', 'NotAcceptable', 'ProxyAuthenticationRequired', 'RequestTimeout', 'Conflict', 'Gone', 'LengthRequired', 'PreconditionFailed', 'RequestEntityTooLarge', 'RequestUriTooLong', 'UnsupportedMediaType', 'RequestedRangeNotSatisfiable', 'ExpectationFailed', 'UpgradeRequired', 'InternalServerError', 'NotImplemented', 'BadGateway', 'ServiceUnavailable', 'GatewayTimeout', 'HttpVersionNotSupported'. + * + * @param statusCode the statusCode value to set + * @return the OperationResultInner object itself. + */ + public OperationResultInner withStatusCode(HttpStatusCode statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * Get error details for the operation in case of a failure. + * + * @return the error value + */ + public OperationError error() { + return this.error; + } + + /** + * Set error details for the operation in case of a failure. + * + * @param error the error value to set + * @return the OperationResultInner object itself. + */ + public OperationResultInner withError(OperationError error) { + this.error = error; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationsImpl.java new file mode 100644 index 000000000000..1a4be014192d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationsImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Operations; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationResult; + +class OperationsImpl extends WrapperImpl implements Operations { + private final DevTestLabsManager manager; + + OperationsImpl(DevTestLabsManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + private OperationResultImpl wrapModel(OperationResultInner inner) { + return new OperationResultImpl(inner, manager()); + } + + @Override + public Observable getAsync(String locationName, String name) { + OperationsInner client = this.inner(); + return client.getAsync(locationName, name) + .flatMap(new Func1>() { + @Override + public Observable call(OperationResultInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((OperationResult)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationsInner.java new file mode 100644 index 000000000000..d4bedb170f2a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/OperationsInner.java @@ -0,0 +1,146 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Operations get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DevTestLab/locations/{locationName}/operations/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("locationName") String locationName, @Path("name") String name, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 OperationResultInner object if successful. + */ + public OperationResultInner get(String locationName, String name) { + return getWithServiceResponseAsync(locationName, name).toBlocking().single().body(); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @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 getAsync(String locationName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(locationName, name), serviceCallback); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultInner object + */ + public Observable getAsync(String locationName, String name) { + return getWithServiceResponseAsync(locationName, name).map(new Func1, OperationResultInner>() { + @Override + public OperationResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get operation. + * + * @param locationName The name of the location. + * @param name The name of the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationResultInner object + */ + public Observable> getWithServiceResponseAsync(String locationName, String name) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (locationName == null) { + throw new IllegalArgumentException("Parameter locationName 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.get(this.client.subscriptionId(), locationName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PageImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PageImpl.java new file mode 100644 index 000000000000..c53f84db6534 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PoliciesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PoliciesImpl.java new file mode 100644 index 000000000000..b619b77598a0 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PoliciesImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Policies; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Policy; + +class PoliciesImpl extends WrapperImpl implements Policies { + private final DevTestLabsManager manager; + + PoliciesImpl(DevTestLabsManager manager) { + super(manager.inner().policies()); + 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) { + PoliciesInner 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 getAsync(String resourceGroupName, String labName, String policySetName, String name) { + PoliciesInner client = this.inner(); + return client.getAsync(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 deleteAsync(String resourceGroupName, String labName, String policySetName, String name) { + PoliciesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, policySetName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PoliciesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PoliciesInner.java new file mode 100644 index 000000000000..895ff700e330 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PoliciesInner.java @@ -0,0 +1,997 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.PolicyFragment; +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 Policies. + */ +public class PoliciesInner { + /** The Retrofit service to perform REST calls. */ + private PoliciesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of PoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PoliciesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(PoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Policies to be + * used by Retrofit to perform actually REST calls. + */ + interface PoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Policies 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("$expand") String expand, @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.v2016_05_15.Policies get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("policySetName") String policySetName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Policies createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}") + Observable> createOrUpdate(@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.v2016_05_15.Policies delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.Policies update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/policysets/{policySetName}/policies/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("policySetName") String policySetName, @Path("name") String name, @Body PolicyFragment 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.v2016_05_15.Policies listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param 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 in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, policySetName, expand, 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 in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, policySetName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List policies in a given policy set. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, policySetName, expand, 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 in a given policy set. + * + 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 expand Specify the $expand query. Example: 'properties($select=description)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String policySetName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String policySetName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String policySetName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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."); + } + final String expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, policySetName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get policy. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param policySetName The name of the policy set. + * @param name The name of the policy. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String policySetName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, expand).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 expand Specify the $expand query. Example: 'properties($select=description)' + * @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 getAsync(String resourceGroupName, String labName, String policySetName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String policySetName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, policySetName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($select=description)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String policySetName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, policySetName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 A 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 createOrUpdate(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return createOrUpdateWithServiceResponseAsync(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 A 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 createOrUpdateAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(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 A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyInner policy) { + return createOrUpdateWithServiceResponseAsync(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 A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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 delete(String resourceGroupName, String labName, String policySetName, String name) { + deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String policySetName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String policySetName, String name) { + return deleteWithServiceResponseAsync(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> deleteWithServiceResponseAsync(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.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 A 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 update(String resourceGroupName, String labName, String policySetName, String name, PolicyFragment policy) { + return updateWithServiceResponseAsync(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 A 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 updateAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyFragment policy, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(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 A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyFragment policy) { + return updateWithServiceResponseAsync(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 A Policy. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String policySetName, String name, PolicyFragment 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.update(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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 in a given policy set. + * + * @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 in a given policy set. + * + * @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 in a given policy set. + * + * @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 in a given policy set. + * + * @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 in a given policy set. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicyImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicyImpl.java new file mode 100644 index 000000000000..e49bcf896992 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicyImpl.java @@ -0,0 +1,279 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Policy; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicyFragment; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicyStatus; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicyFactName; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicyEvaluatorType; +import org.joda.time.DateTime; +import rx.functions.Func1; + +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; + private PolicyFragment updateParameter; + + PolicyImpl(String name, DevTestLabsManager manager) { + super(name, new PolicyInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new PolicyFragment(); + } + + 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"); + // + this.updateParameter = new PolicyFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PoliciesInner client = this.manager().inner().policies(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.policySetName, this.name, this.inner()) + .map(new Func1() { + @Override + public PolicyInner call(PolicyInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PoliciesInner client = this.manager().inner().policies(); + return client.updateAsync(this.resourceGroupName, this.labName, this.policySetName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public PolicyInner call(PolicyInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PoliciesInner client = this.manager().inner().policies(); + return client.getAsync(this.resourceGroupName, this.labName, this.policySetName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new PolicyFragment(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @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 String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public PolicyImpl withExistingPolicyset(String resourceGroupName, String labName, String policySetName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.policySetName = policySetName; + return this; + } + + @Override + public PolicyImpl withDescription(String description) { + if (isInCreateMode()) { + this.inner().withDescription(description); + } else { + this.updateParameter.withDescription(description); + } + return this; + } + + @Override + public PolicyImpl withEvaluatorType(PolicyEvaluatorType evaluatorType) { + if (isInCreateMode()) { + this.inner().withEvaluatorType(evaluatorType); + } else { + this.updateParameter.withEvaluatorType(evaluatorType); + } + return this; + } + + @Override + public PolicyImpl withFactData(String factData) { + if (isInCreateMode()) { + this.inner().withFactData(factData); + } else { + this.updateParameter.withFactData(factData); + } + return this; + } + + @Override + public PolicyImpl withFactName(PolicyFactName factName) { + if (isInCreateMode()) { + this.inner().withFactName(factName); + } else { + this.updateParameter.withFactName(factName); + } + return this; + } + + @Override + public PolicyImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public PolicyImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public PolicyImpl withStatus(PolicyStatus status) { + if (isInCreateMode()) { + this.inner().withStatus(status); + } else { + this.updateParameter.withStatus(status); + } + return this; + } + + @Override + public PolicyImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public PolicyImpl withThreshold(String threshold) { + if (isInCreateMode()) { + this.inner().withThreshold(threshold); + } else { + this.updateParameter.withThreshold(threshold); + } + return this; + } + + @Override + public PolicyImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicyInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicyInner.java new file mode 100644 index 000000000000..d943d01d88b7 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicyInner.java @@ -0,0 +1,257 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicyStatus; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicyFactName; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicyEvaluatorType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A Policy. + */ +@JsonFlatten +@SkipParentValidation +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 (e.g. LabVmCount, LabVmSize, + * MaxVmsAllowedPerLab, etc. Possible values include: + * 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', + * 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', + * 'UserOwnedLabVmCountInSubnet', 'LabTargetCost'. + */ + @JsonProperty(value = "properties.factName") + private PolicyFactName factName; + + /** + * The fact data of the policy. + */ + @JsonProperty(value = "properties.factData") + private String factData; + + /** + * The threshold of the policy (i.e. a number for MaxValuePolicy, and a + * JSON array of values for AllowedValuesPolicy). + */ + @JsonProperty(value = "properties.threshold") + private String threshold; + + /** + * The evaluator type of the policy (i.e. AllowedValuesPolicy, + * MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', + * 'MaxValuePolicy'. + */ + @JsonProperty(value = "properties.evaluatorType") + private PolicyEvaluatorType evaluatorType; + + /** + * The creation date of the policy. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * 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 (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost'. + * + * @return the factName value + */ + public PolicyFactName factName() { + return this.factName; + } + + /** + * Set the fact name of the policy (e.g. LabVmCount, LabVmSize, MaxVmsAllowedPerLab, etc. Possible values include: 'UserOwnedLabVmCount', 'UserOwnedLabPremiumVmCount', 'LabVmCount', 'LabPremiumVmCount', 'LabVmSize', 'GalleryImage', 'UserOwnedLabVmCountInSubnet', 'LabTargetCost'. + * + * @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 (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + * + * @return the threshold value + */ + public String threshold() { + return this.threshold; + } + + /** + * Set the threshold of the policy (i.e. a number for MaxValuePolicy, and a JSON array of values for AllowedValuesPolicy). + * + * @param threshold the threshold value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withThreshold(String threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). Possible values include: 'AllowedValuesPolicy', 'MaxValuePolicy'. + * + * @return the evaluatorType value + */ + public PolicyEvaluatorType evaluatorType() { + return this.evaluatorType; + } + + /** + * Set the evaluator type of the policy (i.e. AllowedValuesPolicy, MaxValuePolicy). 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 creation date of the policy. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicySetsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicySetsImpl.java new file mode 100644 index 000000000000..15971e2c7fbc --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.PolicySets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicySetsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/PolicySetsInner.java new file mode 100644 index 000000000000..b7c936060db8 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EvaluatePoliciesProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ProviderOperationsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ProviderOperationsImpl.java new file mode 100644 index 000000000000..96bfe3ce9ee2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ProviderOperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ProviderOperations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.OperationMetadata; + +class ProviderOperationsImpl extends WrapperImpl implements ProviderOperations { + private final DevTestLabsManager manager; + + ProviderOperationsImpl(DevTestLabsManager manager) { + super(manager.inner().providerOperations()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + ProviderOperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public OperationMetadata call(OperationMetadataInner inner) { + return new OperationMetadataImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ProviderOperationsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ProviderOperationsInner.java new file mode 100644 index 000000000000..518445cd40a9 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ProviderOperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.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 ProviderOperations. + */ +public class ProviderOperationsInner { + /** The Retrofit service to perform REST calls. */ + private ProviderOperationsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of ProviderOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ProviderOperationsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(ProviderOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ProviderOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface ProviderOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.ProviderOperations list" }) + @GET("providers/Microsoft.DevTestLab/operations") + Observable> list(@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.v2016_05_15.ProviderOperations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Result of the request to list REST API operations. + * + * @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<OperationMetadataInner> 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(); + } + }; + } + + /** + * Result of the request to list REST API operations. + * + * @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); + } + + /** + * Result of the request to list REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationMetadataInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Result of the request to list REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationMetadataInner> 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)); + } + }); + } + + /** + * Result of the request to list REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationMetadataInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(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); + } + + /** + * Result of the request to list REST API operations. + * + * @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<OperationMetadataInner> 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(); + } + }; + } + + /** + * Result of the request to list REST API operations. + * + * @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); + } + + /** + * Result of the request to list REST API operations. + * + * @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<OperationMetadataInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Result of the request to list REST API operations. + * + * @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<OperationMetadataInner> 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)); + } + }); + } + + /** + * Result of the request to list REST API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationMetadataInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ScheduleImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ScheduleImpl.java new file mode 100644 index 000000000000..f1ebcd400a6d --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ScheduleImpl.java @@ -0,0 +1,240 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Schedule; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ScheduleFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnableStatus; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.WeekDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DayDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HourDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationSettings; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DayDetailsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HourDetailsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationSettingsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.WeekDetailsFragment; +import rx.functions.Func1; + +class ScheduleImpl extends GroupableResourceCoreImpl implements Schedule, Schedule.Definition, Schedule.Update { + private ScheduleFragment updateParameter; + ScheduleImpl(String name, ScheduleInner inner, DevTestLabsManager manager) { + super(name, inner, manager); + this.updateParameter = new ScheduleFragment(); + } + + @Override + public Observable createResourceAsync() { + GlobalSchedulesInner client = this.manager().inner().globalSchedules(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ScheduleInner call(ScheduleInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + GlobalSchedulesInner client = this.manager().inner().globalSchedules(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ScheduleInner call(ScheduleInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + GlobalSchedulesInner client = this.manager().inner().globalSchedules(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ScheduleFragment(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public DayDetails dailyRecurrence() { + return this.inner().dailyRecurrence(); + } + + @Override + public HourDetails hourlyRecurrence() { + return this.inner().hourlyRecurrence(); + } + + @Override + public NotificationSettings notificationSettings() { + return this.inner().notificationSettings(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public EnableStatus status() { + return this.inner().status(); + } + + @Override + public String targetResourceId() { + return this.inner().targetResourceId(); + } + + @Override + public String taskType() { + return this.inner().taskType(); + } + + @Override + public String timeZoneId() { + return this.inner().timeZoneId(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public WeekDetails weeklyRecurrence() { + return this.inner().weeklyRecurrence(); + } + + @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 withNotificationSettings(NotificationSettings notificationSettings) { + this.inner().withNotificationSettings(notificationSettings); + return this; + } + + @Override + public ScheduleImpl withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.inner().withWeeklyRecurrence(weeklyRecurrence); + return this; + } + + @Override + public ScheduleImpl withDailyRecurrence(DayDetailsFragment dailyRecurrence) { + this.updateParameter.withDailyRecurrence(dailyRecurrence); + return this; + } + + @Override + public ScheduleImpl withHourlyRecurrence(HourDetailsFragment hourlyRecurrence) { + this.updateParameter.withHourlyRecurrence(hourlyRecurrence); + return this; + } + + @Override + public ScheduleImpl withNotificationSettings(NotificationSettingsFragment notificationSettings) { + this.updateParameter.withNotificationSettings(notificationSettings); + return this; + } + + @Override + public ScheduleImpl withWeeklyRecurrence(WeekDetailsFragment weeklyRecurrence) { + this.updateParameter.withWeeklyRecurrence(weeklyRecurrence); + return this; + } + + @Override + public ScheduleImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public ScheduleImpl withStatus(EnableStatus status) { + if (isInCreateMode()) { + this.inner().withStatus(status); + } else { + this.updateParameter.withStatus(status); + } + return this; + } + + @Override + public ScheduleImpl withTargetResourceId(String targetResourceId) { + if (isInCreateMode()) { + this.inner().withTargetResourceId(targetResourceId); + } else { + this.updateParameter.withTargetResourceId(targetResourceId); + } + return this; + } + + @Override + public ScheduleImpl withTaskType(String taskType) { + if (isInCreateMode()) { + this.inner().withTaskType(taskType); + } else { + this.updateParameter.withTaskType(taskType); + } + return this; + } + + @Override + public ScheduleImpl withTimeZoneId(String timeZoneId) { + if (isInCreateMode()) { + this.inner().withTimeZoneId(timeZoneId); + } else { + this.updateParameter.withTimeZoneId(timeZoneId); + } + return this; + } + + @Override + public ScheduleImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ScheduleInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ScheduleInner.java new file mode 100644 index 000000000000..95a03aa058ea --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ScheduleInner.java @@ -0,0 +1,307 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnableStatus; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.WeekDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DayDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HourDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationSettings; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A schedule. + */ +@JsonFlatten +@SkipParentValidation +public class ScheduleInner extends Resource { + /** + * The status of the schedule (i.e. Enabled, Disabled). Possible values + * include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.status") + private EnableStatus status; + + /** + * The task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + */ + @JsonProperty(value = "properties.taskType") + private String taskType; + + /** + * If the schedule will occur only some days of the week, specify the + * weekly recurrence. + */ + @JsonProperty(value = "properties.weeklyRecurrence") + private WeekDetails weeklyRecurrence; + + /** + * If the schedule will occur once each day of the week, specify the daily + * recurrence. + */ + @JsonProperty(value = "properties.dailyRecurrence") + private DayDetails dailyRecurrence; + + /** + * If the schedule will occur multiple times a day, specify the hourly + * recurrence. + */ + @JsonProperty(value = "properties.hourlyRecurrence") + private HourDetails hourlyRecurrence; + + /** + * The time zone ID (e.g. Pacific Standard time). + */ + @JsonProperty(value = "properties.timeZoneId") + private String timeZoneId; + + /** + * Notification settings. + */ + @JsonProperty(value = "properties.notificationSettings") + private NotificationSettings notificationSettings; + + /** + * The creation date of the schedule. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The resource ID to which the schedule belongs. + */ + @JsonProperty(value = "properties.targetResourceId") + private String targetResourceId; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the status of the schedule (i.e. Enabled, Disabled). Possible values include: 'Enabled', 'Disabled'. + * + * @return the status value + */ + public EnableStatus status() { + return this.status; + } + + /** + * Set the status of the schedule (i.e. Enabled, Disabled). 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 (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @return the taskType value + */ + public String taskType() { + return this.taskType; + } + + /** + * Set the task type of the schedule (e.g. LabVmsShutdownTask, LabVmAutoStart). + * + * @param taskType the taskType value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTaskType(String taskType) { + this.taskType = taskType; + return this; + } + + /** + * Get if the schedule will occur only some days of the week, specify the weekly recurrence. + * + * @return the weeklyRecurrence value + */ + public WeekDetails weeklyRecurrence() { + return this.weeklyRecurrence; + } + + /** + * Set if the schedule will occur only some days of the week, specify the weekly recurrence. + * + * @param weeklyRecurrence the weeklyRecurrence value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.weeklyRecurrence = weeklyRecurrence; + return this; + } + + /** + * Get if the schedule will occur once each day of the week, specify the daily recurrence. + * + * @return the dailyRecurrence value + */ + public DayDetails dailyRecurrence() { + return this.dailyRecurrence; + } + + /** + * Set if the schedule will occur once each day of the week, specify the daily recurrence. + * + * @param dailyRecurrence the dailyRecurrence value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withDailyRecurrence(DayDetails dailyRecurrence) { + this.dailyRecurrence = dailyRecurrence; + return this; + } + + /** + * Get if the schedule will occur multiple times a day, specify the hourly recurrence. + * + * @return the hourlyRecurrence value + */ + public HourDetails hourlyRecurrence() { + return this.hourlyRecurrence; + } + + /** + * Set if the schedule will occur multiple times a day, specify the hourly recurrence. + * + * @param hourlyRecurrence the hourlyRecurrence value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.hourlyRecurrence = hourlyRecurrence; + return this; + } + + /** + * Get the time zone ID (e.g. Pacific Standard time). + * + * @return the timeZoneId value + */ + public String timeZoneId() { + return this.timeZoneId; + } + + /** + * Set the time zone ID (e.g. Pacific Standard time). + * + * @param timeZoneId the timeZoneId value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTimeZoneId(String timeZoneId) { + this.timeZoneId = timeZoneId; + return this; + } + + /** + * Get notification settings. + * + * @return the notificationSettings value + */ + public NotificationSettings notificationSettings() { + return this.notificationSettings; + } + + /** + * Set notification settings. + * + * @param notificationSettings the notificationSettings value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withNotificationSettings(NotificationSettings notificationSettings) { + this.notificationSettings = notificationSettings; + return this; + } + + /** + * Get the creation date of the schedule. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * Get the resource ID to which the schedule belongs. + * + * @return the targetResourceId value + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the resource ID to which the schedule belongs. + * + * @param targetResourceId the targetResourceId value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * Get the 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the ScheduleInner object itself. + */ + public ScheduleInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SchedulesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SchedulesImpl.java new file mode 100644 index 000000000000..6c2f0327674a --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SchedulesImpl.java @@ -0,0 +1,110 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Schedules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Schedule; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabSchedule; + +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 LabScheduleImpl define(String name) { + return wrapModel(name); + } + + private LabScheduleImpl wrapModel(ScheduleInner inner) { + return new LabScheduleImpl(inner, manager()); + } + + private LabScheduleImpl wrapModel(String name) { + return new LabScheduleImpl(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 listApplicableAsync(final String resourceGroupName, final String labName, final String name) { + SchedulesInner client = this.inner(); + return client.listApplicableAsync(resourceGroupName, labName, name) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Schedule call(ScheduleInner inner) { + return new ScheduleImpl(inner.name(), inner, manager()); + } + }); + } + + @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 LabSchedule call(ScheduleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String name) { + SchedulesInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(ScheduleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((LabSchedule)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String name) { + SchedulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SchedulesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SchedulesInner.java new file mode 100644 index 000000000000..55f81f668ca5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SchedulesInner.java @@ -0,0 +1,1373 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.ScheduleFragment; +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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.Schedules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Schedules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}") + Observable> createOrUpdate(@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.v2016_05_15.Schedules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.Schedules update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ScheduleFragment 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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.Schedules listApplicable" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/schedules/{name}/listApplicable") + Observable> listApplicable(@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.v2016_05_15.Schedules 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.v2016_05_15.Schedules listApplicableNext" }) + @GET + Observable> listApplicableNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given lab. + * + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=status)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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 expand Specify the $expand query. Example: 'properties($select=status)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 createOrUpdate(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, schedule).toBlocking().single().body(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param 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 createOrUpdateAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, schedule), serviceCallback); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, ScheduleInner schedule) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, schedule).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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. + * + * @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 delete(String resourceGroupName, String labName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param 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 labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 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 A 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 update(String resourceGroupName, String labName, String name, ScheduleFragment schedule) { + return updateWithServiceResponseAsync(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 A 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 updateAsync(String resourceGroupName, String labName, String name, ScheduleFragment schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(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 A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String name, ScheduleFragment schedule) { + return updateWithServiceResponseAsync(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 A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String name, ScheduleFragment 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.update(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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 listApplicable(final String resourceGroupName, final String labName, final String name) { + ServiceResponse> response = listApplicableSinglePageAsync(resourceGroupName, labName, name).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listApplicableNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @param 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> listApplicableAsync(final String resourceGroupName, final String labName, final String name, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listApplicableSinglePageAsync(resourceGroupName, labName, name), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listApplicableNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listApplicableAsync(final String resourceGroupName, final String labName, final String name) { + return listApplicableWithServiceResponseAsync(resourceGroupName, labName, name) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable>> listApplicableWithServiceResponseAsync(final String resourceGroupName, final String labName, final String name) { + return listApplicableSinglePageAsync(resourceGroupName, labName, 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(listApplicableNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all applicable schedules. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listApplicableSinglePageAsync(final String resourceGroupName, final String labName, 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 (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.listApplicable(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> result = listApplicableDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listApplicableDelegate(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 schedules in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + 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); + } + + /** + * Lists all applicable 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 listApplicableNext(final String nextPageLink) { + ServiceResponse> response = listApplicableNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listApplicableNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all applicable 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> listApplicableNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listApplicableNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listApplicableNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all applicable 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> listApplicableNextAsync(final String nextPageLink) { + return listApplicableNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all applicable 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>> listApplicableNextWithServiceResponseAsync(final String nextPageLink) { + return listApplicableNextSinglePageAsync(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(listApplicableNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all applicable 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>> listApplicableNextSinglePageAsync(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.listApplicableNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listApplicableNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listApplicableNextDelegate(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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretImpl.java new file mode 100644 index 000000000000..c48219a7a619 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Secret; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; + +class SecretImpl extends CreatableUpdatableImpl implements Secret, Secret.Definition, Secret.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String userName; + private String name; + + SecretImpl(String name, DevTestLabsManager manager) { + super(name, new SecretInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + SecretImpl(SecretInner 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.userName = IdParsingUtils.getValueFromIdByName(inner.id(), "users"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "secrets"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SecretsInner client = this.manager().inner().secrets(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.userName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SecretsInner client = this.manager().inner().secrets(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.userName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SecretsInner client = this.manager().inner().secrets(); + return client.getAsync(this.resourceGroupName, this.labName, this.userName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == 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 provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public String value() { + return this.inner().value(); + } + + @Override + public SecretImpl withExistingUser(String resourceGroupName, String labName, String userName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.userName = userName; + return this; + } + + @Override + public SecretImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public SecretImpl withProvisioningState(String provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public SecretImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public SecretImpl withUniqueIdentifier(String uniqueIdentifier) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + return this; + } + + @Override + public SecretImpl withValue(String value) { + this.inner().withValue(value); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretInner.java new file mode 100644 index 000000000000..87628d68124c --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretInner.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.v2016_05_15.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A secret. + */ +@JsonFlatten +@SkipParentValidation +public class SecretInner extends Resource { + /** + * The value of the secret for secret creation. + */ + @JsonProperty(value = "properties.value") + private String value; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the value of the secret for secret creation. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value of the secret for secret creation. + * + * @param value the value value to set + * @return the SecretInner object itself. + */ + public SecretInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the 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 SecretInner object itself. + */ + public SecretInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the SecretInner object itself. + */ + public SecretInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretsImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretsImpl.java new file mode 100644 index 000000000000..92860286f840 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretsImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Secrets; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Secret; + +class SecretsImpl extends WrapperImpl implements Secrets { + private final DevTestLabsManager manager; + + SecretsImpl(DevTestLabsManager manager) { + super(manager.inner().secrets()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public SecretImpl define(String name) { + return wrapModel(name); + } + + private SecretImpl wrapModel(SecretInner inner) { + return new SecretImpl(inner, manager()); + } + + private SecretImpl wrapModel(String name) { + return new SecretImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName, final String userName) { + SecretsInner client = this.inner(); + return client.listAsync(resourceGroupName, labName, userName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Secret call(SecretInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String userName, String name) { + SecretsInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, userName, name) + .flatMap(new Func1>() { + @Override + public Observable call(SecretInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Secret)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String userName, String name) { + SecretsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, userName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretsInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretsInner.java new file mode 100644 index 000000000000..ad78f9726150 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/SecretsInner.java @@ -0,0 +1,883 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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 Secrets. + */ +public class SecretsInner { + /** The Retrofit service to perform REST calls. */ + private SecretsService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of SecretsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SecretsInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(SecretsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Secrets to be + * used by Retrofit to perform actually REST calls. + */ + interface SecretsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Secrets list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Query("$expand") String expand, @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.v2016_05_15.Secrets get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Secrets createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @Path("name") String name, @Body SecretInner secret, @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.v2016_05_15.Secrets delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{userName}/secrets/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("userName") String userName, @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.v2016_05_15.Secrets listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<SecretInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String userName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, userName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param 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 userName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, userName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String userName) { + return listWithServiceResponseAsync(resourceGroupName, labName, userName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String userName) { + return listSinglePageAsync(resourceGroupName, labName, userName) + .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 secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SecretInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String userName) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, userName, expand, 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 secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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<SecretInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, userName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 userName, final String expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, userName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, userName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List secrets in a given user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SecretInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String userName, final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, userName, expand, 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 secrets in a given user profile. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param userName The name of the user profile. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=value)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SecretInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String userName, final String expand, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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, userName, expand, 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 secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 SecretInner object if successful. + */ + public SecretInner get(String resourceGroupName, String labName, String userName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param 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 getAsync(String resourceGroupName, String labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String userName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, SecretInner>() { + @Override + public SecretInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, userName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 SecretInner object if successful. + */ + public SecretInner get(String resourceGroupName, String labName, String userName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand).toBlocking().single().body(); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @param 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 getAsync(String resourceGroupName, String labName, String userName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand), serviceCallback); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String userName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, userName, name, expand).map(new Func1, SecretInner>() { + @Override + public SecretInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param expand Specify the $expand query. Example: 'properties($select=value)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, String expand) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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.get(this.client.subscriptionId(), resourceGroupName, labName, userName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @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 SecretInner object if successful. + */ + public SecretInner createOrUpdate(String resourceGroupName, String labName, String userName, String name, SecretInner secret) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, secret).toBlocking().single().body(); + } + + /** + * Create or replace an existing secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @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 createOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, SecretInner secret, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, secret), serviceCallback); + } + + /** + * Create or replace an existing secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String userName, String name, SecretInner secret) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, userName, name, secret).map(new Func1, SecretInner>() { + @Override + public SecretInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param secret A secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SecretInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String userName, String name, SecretInner secret) { + 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (secret == null) { + throw new IllegalArgumentException("Parameter secret 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(secret); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, userName, name, secret, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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 secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String userName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).toBlocking().single().body(); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @param 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 labName, String userName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name), serviceCallback); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String labName, String userName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, userName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete secret. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param userName The name of the user profile. + * @param name The name of the secret. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String labName, String userName, 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 (userName == null) { + throw new IllegalArgumentException("Parameter userName 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.delete(this.client.subscriptionId(), resourceGroupName, labName, userName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 secrets in a given user profile. + * + * @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<SecretInner> 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 secrets in a given user profile. + * + * @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 secrets in a given user profile. + * + * @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<SecretInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List secrets in a given user profile. + * + * @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<SecretInner> 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 secrets in a given user profile. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SecretInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnerImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnerImpl.java new file mode 100644 index 000000000000..291566deaa46 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnerImpl.java @@ -0,0 +1,129 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ServiceRunner; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.IdentityProperties; + +class ServiceRunnerImpl extends CreatableUpdatableImpl implements ServiceRunner, ServiceRunner.Definition, ServiceRunner.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + + ServiceRunnerImpl(String name, DevTestLabsManager manager) { + super(name, new ServiceRunnerInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + } + + ServiceRunnerImpl(ServiceRunnerInner 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(), "servicerunners"); + // + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + ServiceRunnersInner client = this.manager().inner().serviceRunners(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ServiceRunnersInner client = this.manager().inner().serviceRunners(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ServiceRunnersInner client = this.manager().inner().serviceRunners(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public IdentityProperties identity() { + return this.inner().identity(); + } + + @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(); + } + + @Override + public ServiceRunnerImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public ServiceRunnerImpl withIdentity(IdentityProperties identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public ServiceRunnerImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public ServiceRunnerImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnerInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnerInner.java new file mode 100644 index 000000000000..11c9b0cf9cca --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnerInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.IdentityProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A container for a managed identity to execute DevTest lab services. + */ +@SkipParentValidation +public class ServiceRunnerInner extends Resource { + /** + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private IdentityProperties identity; + + /** + * Get the identity of the resource. + * + * @return the identity value + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity of the resource. + * + * @param identity the identity value to set + * @return the ServiceRunnerInner object itself. + */ + public ServiceRunnerInner withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnersImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnersImpl.java new file mode 100644 index 000000000000..4b91a2841e15 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnersImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ServiceRunners; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ServiceRunner; + +class ServiceRunnersImpl extends WrapperImpl implements ServiceRunners { + private final DevTestLabsManager manager; + + ServiceRunnersImpl(DevTestLabsManager manager) { + super(manager.inner().serviceRunners()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public ServiceRunnerImpl define(String name) { + return wrapModel(name); + } + + private ServiceRunnerImpl wrapModel(ServiceRunnerInner inner) { + return new ServiceRunnerImpl(inner, manager()); + } + + private ServiceRunnerImpl wrapModel(String name) { + return new ServiceRunnerImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + ServiceRunnersInner 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 ServiceRunner call(ServiceRunnerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String name) { + ServiceRunnersInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(ServiceRunnerInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ServiceRunner)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String name) { + ServiceRunnersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnersInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnersInner.java new file mode 100644 index 000000000000..604930ca77c4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/ServiceRunnersInner.java @@ -0,0 +1,742 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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 ServiceRunners. + */ +public class ServiceRunnersInner { + /** The Retrofit service to perform REST calls. */ + private ServiceRunnersService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of ServiceRunnersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ServiceRunnersInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(ServiceRunnersService.class); + this.client = client; + } + + /** + * The interface defining all the services for ServiceRunners to be + * used by Retrofit to perform actually REST calls. + */ + interface ServiceRunnersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.ServiceRunners list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners") + 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.v2016_05_15.ServiceRunners get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}") + Observable> get(@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.v2016_05_15.ServiceRunners createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body ServiceRunnerInner serviceRunner, @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.v2016_05_15.ServiceRunners delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/servicerunners/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.ServiceRunners listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<ServiceRunnerInner> 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 service runners in a given lab. + * + * @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 service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServiceRunnerInner> 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 service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServiceRunnerInner> 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 service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServiceRunnerInner> 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 service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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<ServiceRunnerInner> 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 service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServiceRunnerInner> 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 service runners in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ServiceRunnerInner> 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 service runners in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServiceRunnerInner> 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 service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ServiceRunnerInner object if successful. + */ + public ServiceRunnerInner get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param 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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceRunnerInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, ServiceRunnerInner>() { + @Override + public ServiceRunnerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceRunnerInner object + */ + public Observable> getWithServiceResponseAsync(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.get(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 = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 Service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 ServiceRunnerInner object if successful. + */ + public ServiceRunnerInner createOrUpdate(String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, serviceRunner).toBlocking().single().body(); + } + + /** + * Create or replace an existing Service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @param 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 createOrUpdateAsync(String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, serviceRunner), serviceCallback); + } + + /** + * Create or replace an existing Service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceRunnerInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, serviceRunner).map(new Func1, ServiceRunnerInner>() { + @Override + public ServiceRunnerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing Service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param serviceRunner A container for a managed identity to execute DevTest lab services. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServiceRunnerInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String name, ServiceRunnerInner serviceRunner) { + 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 (serviceRunner == null) { + throw new IllegalArgumentException("Parameter serviceRunner 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(serviceRunner); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, name, serviceRunner, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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 service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @param 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 labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete service runner. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the service runner. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(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.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 service runners in a given lab. + * + * @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<ServiceRunnerInner> 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 service runners in a given lab. + * + * @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 service runners in a given lab. + * + * @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<ServiceRunnerInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List service runners in a given lab. + * + * @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<ServiceRunnerInner> 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 service runners in a given lab. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ServiceRunnerInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UserImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UserImpl.java new file mode 100644 index 000000000000..c78b58460acb --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UserImpl.java @@ -0,0 +1,221 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.User; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.UserFragment; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.UserIdentity; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.UserSecretStore; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.UserIdentityFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.UserSecretStoreFragment; +import rx.functions.Func1; + +class UserImpl extends CreatableUpdatableImpl implements User, User.Definition, User.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + private UserFragment updateParameter; + + UserImpl(String name, DevTestLabsManager manager) { + super(name, new UserInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new UserFragment(); + } + + UserImpl(UserInner 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(), "users"); + // + this.updateParameter = new UserFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + UsersInner client = this.manager().inner().users(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(new Func1() { + @Override + public UserInner call(UserInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + UsersInner client = this.manager().inner().users(); + return client.updateAsync(this.resourceGroupName, this.labName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public UserInner call(UserInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + UsersInner client = this.manager().inner().users(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new UserFragment(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public UserIdentity identity() { + return this.inner().identity(); + } + + @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 UserSecretStore secretStore() { + return this.inner().secretStore(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public UserImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public UserImpl withIdentity(UserIdentity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public UserImpl withSecretStore(UserSecretStore secretStore) { + this.inner().withSecretStore(secretStore); + return this; + } + + @Override + public UserImpl withIdentity(UserIdentityFragment identity) { + this.updateParameter.withIdentity(identity); + return this; + } + + @Override + public UserImpl withSecretStore(UserSecretStoreFragment secretStore) { + this.updateParameter.withSecretStore(secretStore); + return this; + } + + @Override + public UserImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public UserImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public UserImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public UserImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UserInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UserInner.java new file mode 100644 index 000000000000..6f46df8a73d2 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UserInner.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.UserIdentity; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.UserSecretStore; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * Profile of a lab user. + */ +@JsonFlatten +@SkipParentValidation +public class UserInner extends Resource { + /** + * The identity of the user. + */ + @JsonProperty(value = "properties.identity") + private UserIdentity identity; + + /** + * The secret store of the user. + */ + @JsonProperty(value = "properties.secretStore") + private UserSecretStore secretStore; + + /** + * The creation date of the user profile. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * Get the identity of the user. + * + * @return the identity value + */ + public UserIdentity identity() { + return this.identity; + } + + /** + * Set the identity of the user. + * + * @param identity the identity value to set + * @return the UserInner object itself. + */ + public UserInner withIdentity(UserIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the secret store of the user. + * + * @return the secretStore value + */ + public UserSecretStore secretStore() { + return this.secretStore; + } + + /** + * Set the secret store of the user. + * + * @param secretStore the secretStore value to set + * @return the UserInner object itself. + */ + public UserInner withSecretStore(UserSecretStore secretStore) { + this.secretStore = secretStore; + return this; + } + + /** + * Get the creation date of the user profile. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * 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 UserInner object itself. + */ + public UserInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the UserInner object itself. + */ + public UserInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UsersImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UsersImpl.java new file mode 100644 index 000000000000..e8745ec1a5ca --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UsersImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Users; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.User; + +class UsersImpl extends WrapperImpl implements Users { + private final DevTestLabsManager manager; + + UsersImpl(DevTestLabsManager manager) { + super(manager.inner().users()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public UserImpl define(String name) { + return wrapModel(name); + } + + private UserImpl wrapModel(UserInner inner) { + return new UserImpl(inner, manager()); + } + + private UserImpl wrapModel(String name) { + return new UserImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName) { + UsersInner 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 User call(UserInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String name) { + UsersInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, name) + .flatMap(new Func1>() { + @Override + public Observable call(UserInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((User)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String name) { + UsersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UsersInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UsersInner.java new file mode 100644 index 000000000000..c70573a85de4 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/UsersInner.java @@ -0,0 +1,1025 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.UserFragment; +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 Users. + */ +public class UsersInner { + /** The Retrofit service to perform REST calls. */ + private UsersService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of UsersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsersInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(UsersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Users to be + * used by Retrofit to perform actually REST calls. + */ + interface UsersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.Users list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Query("$expand") String expand, @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.v2016_05_15.Users get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.Users createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body UserInner user, @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.v2016_05_15.Users delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.Users beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2016_05_15.Users update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/users/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body UserFragment user, @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.v2016_05_15.Users listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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<UserInner> 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 user profiles in a given lab. + * + * @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 user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> 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 user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> 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 user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserInner> 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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<UserInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List user profiles in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<UserInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 user profiles in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=identity)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String expand, 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, expand, 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 user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 UserInner object if successful. + */ + public UserInner get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param 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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, UserInner>() { + @Override + public UserInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 UserInner object if successful. + */ + public UserInner get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).toBlocking().single().body(); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @param 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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), serviceCallback); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).map(new Func1, UserInner>() { + @Override + public UserInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param expand Specify the $expand query. Example: 'properties($select=identity)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @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 UserInner object if successful. + */ + public UserInner createOrUpdate(String resourceGroupName, String labName, String name, UserInner user) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, user).toBlocking().single().body(); + } + + /** + * Create or replace an existing user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @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 createOrUpdateAsync(String resourceGroupName, String labName, String name, UserInner user, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, user), serviceCallback); + } + + /** + * Create or replace an existing user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, UserInner user) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, name, user).map(new Func1, UserInner>() { + @Override + public UserInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing user profile. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String name, UserInner user) { + 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 (user == null) { + throw new IllegalArgumentException("Parameter user 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(user); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, name, user, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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 user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param 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 labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(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.delete(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String name) { + beginDeleteWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param 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 labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete user profile. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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 user profiles. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 UserInner object if successful. + */ + public UserInner update(String resourceGroupName, String labName, String name, UserFragment user) { + return updateWithServiceResponseAsync(resourceGroupName, labName, name, user).toBlocking().single().body(); + } + + /** + * Modify properties of user profiles. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @param 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 updateAsync(String resourceGroupName, String labName, String name, UserFragment user, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, labName, name, user), serviceCallback); + } + + /** + * Modify properties of user profiles. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String name, UserFragment user) { + return updateWithServiceResponseAsync(resourceGroupName, labName, name, user).map(new Func1, UserInner>() { + @Override + public UserInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Modify properties of user profiles. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the user profile. + * @param user Profile of a lab user. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String name, UserFragment user) { + 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 (user == null) { + throw new IllegalArgumentException("Parameter user 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(user); + return service.update(this.client.subscriptionId(), resourceGroupName, labName, name, user, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 user profiles in a given lab. + * + * @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<UserInner> 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 user profiles in a given lab. + * + * @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 user profiles in a given lab. + * + * @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<UserInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List user profiles in a given lab. + * + * @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<UserInner> 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 user profiles in a given lab. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<UserInner> 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachineSchedulesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachineSchedulesImpl.java new file mode 100644 index 000000000000..63522e9eaf4b --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachineSchedulesImpl.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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachineSchedules; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualmachineLabSchedule; + +class VirtualMachineSchedulesImpl extends WrapperImpl implements VirtualMachineSchedules { + private final DevTestLabsManager manager; + + VirtualMachineSchedulesImpl(DevTestLabsManager manager) { + super(manager.inner().virtualMachineSchedules()); + this.manager = manager; + } + + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public VirtualmachineLabScheduleImpl define(String name) { + return wrapModel(name); + } + + private VirtualmachineLabScheduleImpl wrapModel(ScheduleInner inner) { + return new VirtualmachineLabScheduleImpl(inner, manager()); + } + + private VirtualmachineLabScheduleImpl wrapModel(String name) { + return new VirtualmachineLabScheduleImpl(name, this.manager()); + } + + @Override + public Completable executeAsync(String resourceGroupName, String labName, String virtualMachineName, String name) { + VirtualMachineSchedulesInner client = this.inner(); + return client.executeAsync(resourceGroupName, labName, virtualMachineName, name).toCompletable(); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String labName, final String virtualMachineName) { + VirtualMachineSchedulesInner client = this.inner(); + return client.listAsync(resourceGroupName, labName, virtualMachineName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualmachineLabSchedule call(ScheduleInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String labName, String virtualMachineName, String name) { + VirtualMachineSchedulesInner client = this.inner(); + return client.getAsync(resourceGroupName, labName, virtualMachineName, name) + .flatMap(new Func1>() { + @Override + public Observable call(ScheduleInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((VirtualmachineLabSchedule)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String labName, String virtualMachineName, String name) { + VirtualMachineSchedulesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, virtualMachineName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachineSchedulesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachineSchedulesInner.java new file mode 100644 index 000000000000..5597b2cf5713 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachineSchedulesInner.java @@ -0,0 +1,1188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.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.v2016_05_15.ScheduleFragment; +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 VirtualMachineSchedules. + */ +public class VirtualMachineSchedulesInner { + /** The Retrofit service to perform REST calls. */ + private VirtualMachineSchedulesService service; + /** The service client containing this operation class. */ + private DevTestLabsClientImpl client; + + /** + * Initializes an instance of VirtualMachineSchedulesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualMachineSchedulesInner(Retrofit retrofit, DevTestLabsClientImpl client) { + this.service = retrofit.create(VirtualMachineSchedulesService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualMachineSchedules to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualMachineSchedulesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachineSchedules list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("virtualMachineName") String virtualMachineName, @Query("$expand") String expand, @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.v2016_05_15.VirtualMachineSchedules get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("virtualMachineName") String virtualMachineName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.VirtualMachineSchedules createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("virtualMachineName") String virtualMachineName, @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.v2016_05_15.VirtualMachineSchedules delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("virtualMachineName") String virtualMachineName, @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.v2016_05_15.VirtualMachineSchedules update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("virtualMachineName") String virtualMachineName, @Path("name") String name, @Body ScheduleFragment 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.v2016_05_15.VirtualMachineSchedules execute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute") + Observable> execute(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("virtualMachineName") String virtualMachineName, @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.v2016_05_15.VirtualMachineSchedules beginExecute" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{virtualMachineName}/schedules/{name}/execute") + Observable> beginExecute(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("virtualMachineName") String virtualMachineName, @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.v2016_05_15.VirtualMachineSchedules listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 virtualMachineName) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, virtualMachineName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param 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 virtualMachineName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, virtualMachineName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String labName, final String virtualMachineName) { + return listWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ScheduleInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String labName, final String virtualMachineName) { + return listSinglePageAsync(resourceGroupName, labName, virtualMachineName) + .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 in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ScheduleInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String labName, final String virtualMachineName) { + 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, virtualMachineName, expand, 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 in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 virtualMachineName, final String expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 virtualMachineName, final String expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 virtualMachineName, final String expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List schedules in a given virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 virtualMachineName, final String expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, virtualMachineName, expand, 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 in a given virtual machine. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param virtualMachineName The name of the virtual machine. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($select=status)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 virtualMachineName, final String expand, 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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, virtualMachineName, expand, 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 virtualMachineName The name of the virtual machine. + * @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 get(String resourceGroupName, String labName, String virtualMachineName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name).toBlocking().single().body(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param 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 getAsync(String resourceGroupName, String labName, String virtualMachineName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name), serviceCallback); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String virtualMachineName, String name) { + return getWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String virtualMachineName, 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, virtualMachineName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String virtualMachineName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name, expand).toBlocking().single().body(); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @param 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 getAsync(String resourceGroupName, String labName, String virtualMachineName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name, expand), serviceCallback); + } + + /** + * Get schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String virtualMachineName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name, expand).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 virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param expand Specify the $expand query. Example: 'properties($select=status)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String virtualMachineName, String name, String expand) { + 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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.get(this.client.subscriptionId(), resourceGroupName, labName, virtualMachineName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 createOrUpdate(String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule).toBlocking().single().body(); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @param 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 createOrUpdateAsync(String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule), serviceCallback); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleInner schedule) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule).map(new Func1, ScheduleInner>() { + @Override + public ScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or replace an existing schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String labName, String virtualMachineName, 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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.createOrUpdate(this.client.subscriptionId(), resourceGroupName, labName, virtualMachineName, name, schedule, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(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. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 labName, String virtualMachineName, String name) { + deleteWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name).toBlocking().single().body(); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param 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 labName, String virtualMachineName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name), serviceCallback); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String labName, String virtualMachineName, String name) { + return deleteWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete schedule. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String labName, String virtualMachineName, 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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.delete(this.client.subscriptionId(), resourceGroupName, labName, virtualMachineName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(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 schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 update(String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule) { + return updateWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A 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 updateAsync(String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, name, schedule), serviceCallback); + } + + /** + * Modify properties of schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment schedule) { + return updateWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @param name The name of the schedule. + * @param schedule A schedule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ScheduleInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String virtualMachineName, String name, ScheduleFragment 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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.update(this.client.subscriptionId(), resourceGroupName, labName, virtualMachineName, name, schedule, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, String name) { + executeWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(executeWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, String name) { + return executeWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, String name) { + beginExecuteWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginExecuteWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, String name) { + return beginExecuteWithServiceResponseAsync(resourceGroupName, labName, virtualMachineName, 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 virtualMachineName The name of the virtual machine. + * @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 virtualMachineName, 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 (virtualMachineName == null) { + throw new IllegalArgumentException("Parameter virtualMachineName 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, virtualMachineName, 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 in a given virtual machine. + * + * @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 in a given virtual machine. + * + * @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 in a given virtual machine. + * + * @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 in a given virtual machine. + * + * @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 in a given virtual machine. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachinesImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachinesImpl.java new file mode 100644 index 000000000000..584c2533233f --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachinesImpl.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachines; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ApplicableSchedule; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DataDiskProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 addDataDiskAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + VirtualMachinesInner client = this.inner(); + return client.addDataDiskAsync(resourceGroupName, labName, name, dataDiskProperties).toCompletable(); + } + + @Override + public Completable applyArtifactsAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.applyArtifactsAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Completable claimAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.claimAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Completable detachDataDiskAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.detachDataDiskAsync(resourceGroupName, labName, name).toCompletable(); + } + + @Override + public Observable listApplicableSchedulesAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.listApplicableSchedulesAsync(resourceGroupName, labName, name) + .map(new Func1() { + @Override + public ApplicableSchedule call(ApplicableScheduleInner inner) { + return new ApplicableScheduleImpl(inner, manager()); + } + }); + } + + @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 getAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.getAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + VirtualMachinesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachinesInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachinesInner.java new file mode 100644 index 000000000000..fd620debb274 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualMachinesInner.java @@ -0,0 +1,2643 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.ApplyArtifactsRequest; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ArtifactInstallProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DataDiskProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DetachDataDiskProperties; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.LabVirtualMachineFragment; +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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.VirtualMachines get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.VirtualMachines createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> createOrUpdate(@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.v2016_05_15.VirtualMachines beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> beginCreateOrUpdate(@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.v2016_05_15.VirtualMachines delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.VirtualMachines beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2016_05_15.VirtualMachines update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body LabVirtualMachineFragment 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.v2016_05_15.VirtualMachines addDataDisk" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk") + Observable> addDataDisk(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body DataDiskProperties dataDiskProperties, @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.v2016_05_15.VirtualMachines beginAddDataDisk" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/addDataDisk") + Observable> beginAddDataDisk(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body DataDiskProperties dataDiskProperties, @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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.VirtualMachines claim" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim") + Observable> claim(@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.v2016_05_15.VirtualMachines beginClaim" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/claim") + Observable> beginClaim(@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.v2016_05_15.VirtualMachines detachDataDisk" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk") + Observable> detachDataDisk(@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 DetachDataDiskProperties detachDataDiskProperties, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachines beginDetachDataDisk" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/detachDataDisk") + Observable> beginDetachDataDisk(@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 DetachDataDiskProperties detachDataDiskProperties, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualMachines listApplicableSchedules" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/listApplicableSchedules") + Observable> listApplicableSchedules(@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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.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.v2016_05_15.VirtualMachines listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given lab. + * + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual machines in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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 expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 A 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 createOrUpdate(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return createOrUpdateWithServiceResponseAsync(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 A 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 createOrUpdateAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(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 A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return createOrUpdateWithServiceResponseAsync(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 A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 A 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 beginCreateOrUpdate(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A 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 beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(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 A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, LabVirtualMachineInner labVirtualMachine) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(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 delete(String resourceGroupName, String labName, String name) { + deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(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> deleteWithServiceResponseAsync(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.delete(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 beginDelete(String resourceGroupName, String labName, String name) { + beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteWithServiceResponseAsync(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> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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 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 A 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 update(String resourceGroupName, String labName, String name, LabVirtualMachineFragment labVirtualMachine) { + return updateWithServiceResponseAsync(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 A 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 updateAsync(String resourceGroupName, String labName, String name, LabVirtualMachineFragment labVirtualMachine, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(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 A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String name, LabVirtualMachineFragment labVirtualMachine) { + return updateWithServiceResponseAsync(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 A virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LabVirtualMachineInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String name, LabVirtualMachineFragment 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.update(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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 addDataDisk(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + addDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, dataDiskProperties).toBlocking().last().body(); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param 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 addDataDiskAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, dataDiskProperties), serviceCallback); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable addDataDiskAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + return addDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, dataDiskProperties).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> addDataDiskWithServiceResponseAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + 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 (dataDiskProperties == null) { + throw new IllegalArgumentException("Parameter dataDiskProperties 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(dataDiskProperties); + Observable> observable = service.addDataDisk(this.client.subscriptionId(), resourceGroupName, labName, name, dataDiskProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 beginAddDataDisk(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + beginAddDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, dataDiskProperties).toBlocking().single().body(); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @param 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 beginAddDataDiskAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginAddDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, dataDiskProperties), serviceCallback); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginAddDataDiskAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + return beginAddDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, dataDiskProperties).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Attach a new or existing data disk to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param dataDiskProperties Request body for adding a new or existing data disk to a virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginAddDataDiskWithServiceResponseAsync(String resourceGroupName, String labName, String name, DataDiskProperties dataDiskProperties) { + 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 (dataDiskProperties == null) { + throw new IllegalArgumentException("Parameter dataDiskProperties 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(dataDiskProperties); + return service.beginAddDataDisk(this.client.subscriptionId(), resourceGroupName, labName, name, dataDiskProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginAddDataDiskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginAddDataDiskDelegate(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); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @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 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 applyArtifactsAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(applyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @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 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> 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 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 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 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 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 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 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 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 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 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 beginApplyArtifacts(String resourceGroupName, String labName, String name) { + beginApplyArtifactsWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Apply artifacts to virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 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 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 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> 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 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 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 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 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 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 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 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 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); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 claim(String resourceGroupName, String labName, String name) { + claimWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 claimAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(claimWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable claimAsync(String resourceGroupName, String labName, String name) { + return claimWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> claimWithServiceResponseAsync(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.claim(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 beginClaim(String resourceGroupName, String labName, String name) { + beginClaimWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 beginClaimAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginClaimWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginClaimAsync(String resourceGroupName, String labName, String name) { + return beginClaimWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Take ownership of an existing virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginClaimWithServiceResponseAsync(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.beginClaim(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 = beginClaimDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginClaimDelegate(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); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @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 detachDataDisk(String resourceGroupName, String labName, String name) { + detachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 detachDataDiskAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable detachDataDiskAsync(String resourceGroupName, String labName, String name) { + return detachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> detachDataDiskWithServiceResponseAsync(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 existingLabDiskId = null; + DetachDataDiskProperties detachDataDiskProperties = new DetachDataDiskProperties(); + detachDataDiskProperties.withExistingLabDiskId(null); + Observable> observable = service.detachDataDisk(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDataDiskProperties, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from 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 detachDataDisk(String resourceGroupName, String labName, String name, String existingLabDiskId) { + detachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, existingLabDiskId).toBlocking().last().body(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from 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 detachDataDiskAsync(String resourceGroupName, String labName, String name, String existingLabDiskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(detachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, existingLabDiskId), serviceCallback); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable detachDataDiskAsync(String resourceGroupName, String labName, String name, String existingLabDiskId) { + return detachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, existingLabDiskId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> detachDataDiskWithServiceResponseAsync(String resourceGroupName, String labName, String name, String existingLabDiskId) { + 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."); + } + DetachDataDiskProperties detachDataDiskProperties = new DetachDataDiskProperties(); + detachDataDiskProperties.withExistingLabDiskId(existingLabDiskId); + Observable> observable = service.detachDataDisk(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDataDiskProperties, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @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 beginDetachDataDisk(String resourceGroupName, String labName, String name) { + beginDetachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 beginDetachDataDiskAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDetachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDetachDataDiskAsync(String resourceGroupName, String labName, String name) { + return beginDetachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDetachDataDiskWithServiceResponseAsync(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 existingLabDiskId = null; + DetachDataDiskProperties detachDataDiskProperties = new DetachDataDiskProperties(); + detachDataDiskProperties.withExistingLabDiskId(null); + return service.beginDetachDataDisk(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDataDiskProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDetachDataDiskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from 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 beginDetachDataDisk(String resourceGroupName, String labName, String name, String existingLabDiskId) { + beginDetachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, existingLabDiskId).toBlocking().single().body(); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from 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 beginDetachDataDiskAsync(String resourceGroupName, String labName, String name, String existingLabDiskId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDetachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, existingLabDiskId), serviceCallback); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDetachDataDiskAsync(String resourceGroupName, String labName, String name, String existingLabDiskId) { + return beginDetachDataDiskWithServiceResponseAsync(resourceGroupName, labName, name, existingLabDiskId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Detach the specified disk from the virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param existingLabDiskId Specifies the disk resource ID to detach from virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDetachDataDiskWithServiceResponseAsync(String resourceGroupName, String labName, String name, String existingLabDiskId) { + 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."); + } + DetachDataDiskProperties detachDataDiskProperties = new DetachDataDiskProperties(); + detachDataDiskProperties.withExistingLabDiskId(existingLabDiskId); + return service.beginDetachDataDisk(this.client.subscriptionId(), resourceGroupName, labName, name, this.client.apiVersion(), this.client.acceptLanguage(), detachDataDiskProperties, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDetachDataDiskDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDetachDataDiskDelegate(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); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the 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 ApplicableScheduleInner object if successful. + */ + public ApplicableScheduleInner listApplicableSchedules(String resourceGroupName, String labName, String name) { + return listApplicableSchedulesWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the 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 listApplicableSchedulesAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listApplicableSchedulesWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicableScheduleInner object + */ + public Observable listApplicableSchedulesAsync(String resourceGroupName, String labName, String name) { + return listApplicableSchedulesWithServiceResponseAsync(resourceGroupName, labName, name).map(new Func1, ApplicableScheduleInner>() { + @Override + public ApplicableScheduleInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all applicable schedules. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicableScheduleInner object + */ + public Observable> listApplicableSchedulesWithServiceResponseAsync(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.listApplicableSchedules(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 = listApplicableSchedulesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listApplicableSchedulesDelegate(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); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 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 startAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, labName, name), serviceCallback); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 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> 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 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 beginStart(String resourceGroupName, String labName, String name) { + beginStartWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Start a virtual machine. This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 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 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 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> 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 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 stop(String resourceGroupName, String labName, String name) { + stopWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().last().body(); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 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 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 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> 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 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 beginStop(String resourceGroupName, String labName, String name) { + beginStopWithServiceResponseAsync(resourceGroupName, labName, name).toBlocking().single().body(); + } + + /** + * Stop a virtual machine This operation can take a while to complete. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual machine. + * @param 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 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 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 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> 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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworkImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworkImpl.java new file mode 100644 index 000000000000..b65116171402 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworkImpl.java @@ -0,0 +1,271 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualNetwork; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualNetworkFragment; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Subnet; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ExternalSubnet; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.SubnetOverride; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.SubnetFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ExternalSubnetFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.SubnetOverrideFragment; +import rx.functions.Func1; + +class VirtualNetworkImpl extends CreatableUpdatableImpl implements VirtualNetwork, VirtualNetwork.Definition, VirtualNetwork.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String name; + private VirtualNetworkFragment updateParameter; + + VirtualNetworkImpl(String name, DevTestLabsManager manager) { + super(name, new VirtualNetworkInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new VirtualNetworkFragment(); + } + + 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"); + // + this.updateParameter = new VirtualNetworkFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualNetworksInner client = this.manager().inner().virtualNetworks(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.name, this.inner()) + .map(new Func1() { + @Override + public VirtualNetworkInner call(VirtualNetworkInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualNetworksInner client = this.manager().inner().virtualNetworks(); + return client.updateAsync(this.resourceGroupName, this.labName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public VirtualNetworkInner call(VirtualNetworkInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualNetworksInner client = this.manager().inner().virtualNetworks(); + return client.getAsync(this.resourceGroupName, this.labName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new VirtualNetworkFragment(); + } + + @Override + public List allowedSubnets() { + return this.inner().allowedSubnets(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String externalProviderResourceId() { + return this.inner().externalProviderResourceId(); + } + + @Override + public List externalSubnets() { + return this.inner().externalSubnets(); + } + + @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 String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public VirtualNetworkImpl withExistingLab(String resourceGroupName, String labName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + return this; + } + + @Override + public VirtualNetworkImpl withAllowedSubnets(List allowedSubnets) { + this.inner().withAllowedSubnets(allowedSubnets); + return this; + } + + @Override + public VirtualNetworkImpl withExternalSubnets(List externalSubnets) { + this.inner().withExternalSubnets(externalSubnets); + return this; + } + + @Override + public VirtualNetworkImpl withSubnetOverrides(List subnetOverrides) { + this.inner().withSubnetOverrides(subnetOverrides); + return this; + } + + @Override + public VirtualNetworkImpl withAllowedSubnets(List allowedSubnets) { + this.updateParameter.withAllowedSubnets(allowedSubnets); + return this; + } + + @Override + public VirtualNetworkImpl withExternalSubnets(List externalSubnets) { + this.updateParameter.withExternalSubnets(externalSubnets); + return this; + } + + @Override + public VirtualNetworkImpl withSubnetOverrides(List subnetOverrides) { + this.updateParameter.withSubnetOverrides(subnetOverrides); + return this; + } + + @Override + public VirtualNetworkImpl withDescription(String description) { + if (isInCreateMode()) { + this.inner().withDescription(description); + } else { + this.updateParameter.withDescription(description); + } + return this; + } + + @Override + public VirtualNetworkImpl withExternalProviderResourceId(String externalProviderResourceId) { + if (isInCreateMode()) { + this.inner().withExternalProviderResourceId(externalProviderResourceId); + } else { + this.updateParameter.withExternalProviderResourceId(externalProviderResourceId); + } + return this; + } + + @Override + public VirtualNetworkImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public VirtualNetworkImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public VirtualNetworkImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public VirtualNetworkImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworkInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworkInner.java new file mode 100644 index 000000000000..719e1da366aa --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworkInner.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import java.util.List; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.Subnet; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ExternalSubnet; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.SubnetOverride; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A virtual network. + */ +@JsonFlatten +@SkipParentValidation +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 external subnet properties. + */ + @JsonProperty(value = "properties.externalSubnets") + private List externalSubnets; + + /** + * The subnet overrides of the virtual network. + */ + @JsonProperty(value = "properties.subnetOverrides") + private List subnetOverrides; + + /** + * The creation date of the virtual network. + */ + @JsonProperty(value = "properties.createdDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime createdDate; + + /** + * The provisioning status of the resource. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The unique immutable identifier of a resource (Guid). + */ + @JsonProperty(value = "properties.uniqueIdentifier") + private String uniqueIdentifier; + + /** + * 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 external subnet properties. + * + * @return the externalSubnets value + */ + public List externalSubnets() { + return this.externalSubnets; + } + + /** + * Set the external subnet properties. + * + * @param externalSubnets the externalSubnets value to set + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withExternalSubnets(List externalSubnets) { + this.externalSubnets = externalSubnets; + 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 creation date of the virtual network. + * + * @return the createdDate value + */ + public DateTime createdDate() { + return this.createdDate; + } + + /** + * 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; + } + + /** + * Get the unique immutable identifier of a resource (Guid). + * + * @return the uniqueIdentifier value + */ + public String uniqueIdentifier() { + return this.uniqueIdentifier; + } + + /** + * Set the unique immutable identifier of a resource (Guid). + * + * @param uniqueIdentifier the uniqueIdentifier value to set + * @return the VirtualNetworkInner object itself. + */ + public VirtualNetworkInner withUniqueIdentifier(String uniqueIdentifier) { + this.uniqueIdentifier = uniqueIdentifier; + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworksImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworksImpl.java new file mode 100644 index 000000000000..ef97c9f676dd --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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.v2016_05_15.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualNetworks; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.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 getAsync(String resourceGroupName, String labName, String name) { + VirtualNetworksInner client = this.inner(); + return client.getAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + VirtualNetworksInner client = this.inner(); + return client.deleteAsync(resourceGroupName, labName, name).toCompletable(); + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworksInner.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworksInner.java new file mode 100644 index 000000000000..2ba5e64a0ee5 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualNetworksInner.java @@ -0,0 +1,1113 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.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.v2016_05_15.VirtualNetworkFragment; +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.v2016_05_15.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("$expand") String expand, @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.v2016_05_15.VirtualNetworks get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Query("$expand") String expand, @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.v2016_05_15.VirtualNetworks createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> createOrUpdate(@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.v2016_05_15.VirtualNetworks beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> beginCreateOrUpdate(@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.v2016_05_15.VirtualNetworks delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", method = "DELETE", hasBody = true) + Observable> delete(@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.v2016_05_15.VirtualNetworks beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}", method = "DELETE", hasBody = true) + Observable> beginDelete(@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.v2016_05_15.VirtualNetworks update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualnetworks/{name}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("labName") String labName, @Path("name") String name, @Body VirtualNetworkFragment 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.v2016_05_15.VirtualNetworks listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 in a given lab. + * + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 expand = null; + final String filter = null; + final Integer top = null; + final String orderby = null; + return service.list(this.client.subscriptionId(), resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, labName, expand, filter, top, orderby), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listWithServiceResponseAsync(resourceGroupName, labName, expand, filter, top, orderby) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List virtual networks in a given lab. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @param filter The filter to apply to the operation. + * @param top The maximum number of resources to return from the operation. + * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, final String filter, final Integer top, final String orderby) { + return listSinglePageAsync(resourceGroupName, labName, expand, 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 in a given lab. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param labName The name of the lab. + ServiceResponse> * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + ServiceResponse> * @param filter The filter to apply to the operation. + ServiceResponse> * @param top The maximum number of resources to return from the operation. + ServiceResponse> * @param orderby The ordering expression for the results, using OData notation. + * @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 expand, 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, expand, 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 get(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(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 getAsync(String resourceGroupName, String labName, String name) { + return getWithServiceResponseAsync(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> getWithServiceResponseAsync(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 expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get virtual network. + * + * @param resourceGroupName The name of the resource group. + * @param labName The name of the lab. + * @param name The name of the virtual network. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws 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 get(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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 expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @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 getAsync(String resourceGroupName, String labName, String name, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, labName, name, expand), 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. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable getAsync(String resourceGroupName, String labName, String name, String expand) { + return getWithServiceResponseAsync(resourceGroupName, labName, name, expand).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. + * @param expand Specify the $expand query. Example: 'properties($expand=externalSubnets)' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String labName, String name, String expand) { + 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.get(this.client.subscriptionId(), resourceGroupName, labName, name, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(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 A 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 createOrUpdate(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return createOrUpdateWithServiceResponseAsync(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 A 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 createOrUpdateAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(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 A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return createOrUpdateWithServiceResponseAsync(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 A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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.createOrUpdate(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 A 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 beginCreateOrUpdate(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A 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 beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(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 A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String labName, String name, VirtualNetworkInner virtualNetwork) { + return beginCreateOrUpdateWithServiceResponseAsync(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 A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(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 delete(String resourceGroupName, String labName, String name) { + deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(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 deleteAsync(String resourceGroupName, String labName, String name) { + return deleteWithServiceResponseAsync(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> deleteWithServiceResponseAsync(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.delete(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 beginDelete(String resourceGroupName, String labName, String name) { + beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String resourceGroupName, String labName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(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 beginDeleteAsync(String resourceGroupName, String labName, String name) { + return beginDeleteWithServiceResponseAsync(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> beginDeleteWithServiceResponseAsync(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.beginDelete(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 = 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 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 A 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 update(String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork) { + return updateWithServiceResponseAsync(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 A 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 updateAsync(String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(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 A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable updateAsync(String resourceGroupName, String labName, String name, VirtualNetworkFragment virtualNetwork) { + return updateWithServiceResponseAsync(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 A virtual network. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualNetworkInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String labName, String name, VirtualNetworkFragment 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.update(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 = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + * @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 in a given lab. + * + 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-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualmachineLabScheduleImpl.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualmachineLabScheduleImpl.java new file mode 100644 index 000000000000..e080b069c013 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/VirtualmachineLabScheduleImpl.java @@ -0,0 +1,323 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2016_05_15.implementation; + +import com.microsoft.azure.management.devtestlabs.v2016_05_15.VirtualmachineLabSchedule; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.ScheduleFragment; +import java.util.Map; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.EnableStatus; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.WeekDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DayDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HourDetails; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationSettings; +import org.joda.time.DateTime; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.DayDetailsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.HourDetailsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.NotificationSettingsFragment; +import com.microsoft.azure.management.devtestlabs.v2016_05_15.WeekDetailsFragment; +import rx.functions.Func1; + +class VirtualmachineLabScheduleImpl extends CreatableUpdatableImpl implements VirtualmachineLabSchedule, VirtualmachineLabSchedule.Definition, VirtualmachineLabSchedule.Update { + private final DevTestLabsManager manager; + private String resourceGroupName; + private String labName; + private String virtualMachineName; + private String name; + private ScheduleFragment updateParameter; + + VirtualmachineLabScheduleImpl(String name, DevTestLabsManager manager) { + super(name, new ScheduleInner()); + this.manager = manager; + // Set resource name + this.name = name; + // + this.updateParameter = new ScheduleFragment(); + } + + VirtualmachineLabScheduleImpl(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.virtualMachineName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualmachines"); + this.name = IdParsingUtils.getValueFromIdByName(inner.id(), "schedules"); + // + this.updateParameter = new ScheduleFragment(); + } + + @Override + public DevTestLabsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualMachineSchedulesInner client = this.manager().inner().virtualMachineSchedules(); + return client.createOrUpdateAsync(this.resourceGroupName, this.labName, this.virtualMachineName, this.name, this.inner()) + .map(new Func1() { + @Override + public ScheduleInner call(ScheduleInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualMachineSchedulesInner client = this.manager().inner().virtualMachineSchedules(); + return client.updateAsync(this.resourceGroupName, this.labName, this.virtualMachineName, this.name, this.updateParameter) + .map(new Func1() { + @Override + public ScheduleInner call(ScheduleInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualMachineSchedulesInner client = this.manager().inner().virtualMachineSchedules(); + return client.getAsync(this.resourceGroupName, this.labName, this.virtualMachineName, this.name); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ScheduleFragment(); + } + + @Override + public DateTime createdDate() { + return this.inner().createdDate(); + } + + @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 NotificationSettings notificationSettings() { + return this.inner().notificationSettings(); + } + + @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 String targetResourceId() { + return this.inner().targetResourceId(); + } + + @Override + public String taskType() { + return this.inner().taskType(); + } + + @Override + public String timeZoneId() { + return this.inner().timeZoneId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String uniqueIdentifier() { + return this.inner().uniqueIdentifier(); + } + + @Override + public WeekDetails weeklyRecurrence() { + return this.inner().weeklyRecurrence(); + } + + @Override + public VirtualmachineLabScheduleImpl withExistingVirtualmachine(String resourceGroupName, String labName, String virtualMachineName) { + this.resourceGroupName = resourceGroupName; + this.labName = labName; + this.virtualMachineName = virtualMachineName; + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withDailyRecurrence(DayDetails dailyRecurrence) { + this.inner().withDailyRecurrence(dailyRecurrence); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withHourlyRecurrence(HourDetails hourlyRecurrence) { + this.inner().withHourlyRecurrence(hourlyRecurrence); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withNotificationSettings(NotificationSettings notificationSettings) { + this.inner().withNotificationSettings(notificationSettings); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withWeeklyRecurrence(WeekDetails weeklyRecurrence) { + this.inner().withWeeklyRecurrence(weeklyRecurrence); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withDailyRecurrence(DayDetailsFragment dailyRecurrence) { + this.updateParameter.withDailyRecurrence(dailyRecurrence); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withHourlyRecurrence(HourDetailsFragment hourlyRecurrence) { + this.updateParameter.withHourlyRecurrence(hourlyRecurrence); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withNotificationSettings(NotificationSettingsFragment notificationSettings) { + this.updateParameter.withNotificationSettings(notificationSettings); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withWeeklyRecurrence(WeekDetailsFragment weeklyRecurrence) { + this.updateParameter.withWeeklyRecurrence(weeklyRecurrence); + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withLocation(String location) { + if (isInCreateMode()) { + this.inner().withLocation(location); + } else { + this.updateParameter.withLocation(location); + } + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withStatus(EnableStatus status) { + if (isInCreateMode()) { + this.inner().withStatus(status); + } else { + this.updateParameter.withStatus(status); + } + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withTargetResourceId(String targetResourceId) { + if (isInCreateMode()) { + this.inner().withTargetResourceId(targetResourceId); + } else { + this.updateParameter.withTargetResourceId(targetResourceId); + } + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withTaskType(String taskType) { + if (isInCreateMode()) { + this.inner().withTaskType(taskType); + } else { + this.updateParameter.withTaskType(taskType); + } + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withTimeZoneId(String timeZoneId) { + if (isInCreateMode()) { + this.inner().withTimeZoneId(timeZoneId); + } else { + this.updateParameter.withTimeZoneId(timeZoneId); + } + return this; + } + + @Override + public VirtualmachineLabScheduleImpl withUniqueIdentifier(String uniqueIdentifier) { + if (isInCreateMode()) { + this.inner().withUniqueIdentifier(uniqueIdentifier); + } else { + this.updateParameter.withUniqueIdentifier(uniqueIdentifier); + } + return this; + } + +} diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/package-info.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/implementation/package-info.java new file mode 100644 index 000000000000..5b9f76645ef1 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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. + * The DevTest Labs Client. + */ +package com.microsoft.azure.management.devtestlabs.v2016_05_15.implementation; diff --git a/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/package-info.java b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/package-info.java new file mode 100644 index 000000000000..2b45f38d1130 --- /dev/null +++ b/sdk/devtestlabs/mgmt-v2016_05_15/src/main/java/com/microsoft/azure/management/devtestlabs/v2016_05_15/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. + * The DevTest Labs Client. + */ +package com.microsoft.azure.management.devtestlabs.v2016_05_15;