diff --git a/sdk/compute/mgmt-v2020_06_01/pom.xml b/sdk/compute/mgmt-v2020_06_01/pom.xml index 6c70a47e1d3f9..1049bb9b55730 100644 --- a/sdk/compute/mgmt-v2020_06_01/pom.xml +++ b/sdk/compute/mgmt-v2020_06_01/pom.xml @@ -11,8 +11,8 @@ com.microsoft.azure azure-arm-parent - 1.3.2 - ../../parents/azure-arm-parent/pom.xml + 1.1.0 + ../../../pom.management.xml azure-mgmt-compute 1.0.0-beta diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/ExecutionState.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/ExecutionState.java new file mode 100644 index 0000000000000..fb54b9c4d9d2d --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/ExecutionState.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.compute.v2020_06_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ExecutionState. + */ +public final class ExecutionState extends ExpandableStringEnum { + /** Static value Unknown for ExecutionState. */ + public static final ExecutionState UNKNOWN = fromString("Unknown"); + + /** Static value Pending for ExecutionState. */ + public static final ExecutionState PENDING = fromString("Pending"); + + /** Static value Running for ExecutionState. */ + public static final ExecutionState RUNNING = fromString("Running"); + + /** Static value Failed for ExecutionState. */ + public static final ExecutionState FAILED = fromString("Failed"); + + /** Static value Succeeded for ExecutionState. */ + public static final ExecutionState SUCCEEDED = fromString("Succeeded"); + + /** Static value TimedOut for ExecutionState. */ + public static final ExecutionState TIMED_OUT = fromString("TimedOut"); + + /** Static value Canceled for ExecutionState. */ + public static final ExecutionState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ExecutionState from its string representation. + * @param name a name to look for + * @return the corresponding ExecutionState + */ + @JsonCreator + public static ExecutionState fromString(String name) { + return fromString(name, ExecutionState.class); + } + + /** + * @return known ExecutionState values + */ + public static Collection values() { + return values(ExecutionState.class); + } +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/LocationVirtualMachineRunCommand.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/LocationVirtualMachineRunCommand.java new file mode 100644 index 0000000000000..48ebc471439b7 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/LocationVirtualMachineRunCommand.java @@ -0,0 +1,406 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.v2020_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.compute.v2020_06_01.implementation.VirtualMachineRunCommandInner; +import com.microsoft.azure.arm.model.Indexable; +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.compute.v2020_06_01.implementation.ComputeManager; +import java.util.Map; +import java.util.List; + +/** + * Type representing LocationVirtualMachineRunCommand. + */ +public interface LocationVirtualMachineRunCommand extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the asyncExecution value. + */ + Boolean asyncExecution(); + + /** + * @return the errorBlobUri value. + */ + String errorBlobUri(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceView value. + */ + VirtualMachineRunCommandInstanceView instanceView(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the outputBlobUri value. + */ + String outputBlobUri(); + + /** + * @return the parameters value. + */ + List parameters(); + + /** + * @return the protectedParameters value. + */ + List protectedParameters(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the runAsPassword value. + */ + String runAsPassword(); + + /** + * @return the runAsUser value. + */ + String runAsUser(); + + /** + * @return the source value. + */ + VirtualMachineRunCommandScriptSource source(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the timeoutInSeconds value. + */ + Integer timeoutInSeconds(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the LocationVirtualMachineRunCommand definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of LocationVirtualMachineRunCommand definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LocationVirtualMachineRunCommand definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies resourceGroupName, vmName. + * @param resourceGroupName The name of the resource group + * @param vmName The name of the virtual machine where the run command should be created or updated + * @return the next definition stage + */ + WithLocation withExistingLocation(String resourceGroupName, String vmName); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify AsyncExecution. + */ + interface WithAsyncExecution { + /** + * Specifies asyncExecution. + * @param asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete + * @return the next definition stage + */ + WithCreate withAsyncExecution(Boolean asyncExecution); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify ErrorBlobUri. + */ + interface WithErrorBlobUri { + /** + * Specifies errorBlobUri. + * @param errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded + * @return the next definition stage + */ + WithCreate withErrorBlobUri(String errorBlobUri); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify OutputBlobUri. + */ + interface WithOutputBlobUri { + /** + * Specifies outputBlobUri. + * @param outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded + * @return the next definition stage + */ + WithCreate withOutputBlobUri(String outputBlobUri); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameters used by the script + * @return the next definition stage + */ + WithCreate withParameters(List parameters); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify ProtectedParameters. + */ + interface WithProtectedParameters { + /** + * Specifies protectedParameters. + * @param protectedParameters The parameters used by the script + * @return the next definition stage + */ + WithCreate withProtectedParameters(List protectedParameters); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify RunAsPassword. + */ + interface WithRunAsPassword { + /** + * Specifies runAsPassword. + * @param runAsPassword Specifies the user account password on the VM when executing the run command + * @return the next definition stage + */ + WithCreate withRunAsPassword(String runAsPassword); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify RunAsUser. + */ + interface WithRunAsUser { + /** + * Specifies runAsUser. + * @param runAsUser Specifies the user account on the VM when executing the run command + * @return the next definition stage + */ + WithCreate withRunAsUser(String runAsUser); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify Source. + */ + interface WithSource { + /** + * Specifies source. + * @param source The source of the run command script + * @return the next definition stage + */ + WithCreate withSource(VirtualMachineRunCommandScriptSource source); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the locationvirtualmachineruncommand definition allowing to specify TimeoutInSeconds. + */ + interface WithTimeoutInSeconds { + /** + * Specifies timeoutInSeconds. + * @param timeoutInSeconds The timeout in seconds to execute the run command + * @return the next definition stage + */ + WithCreate withTimeoutInSeconds(Integer timeoutInSeconds); + } + + /** + * 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.WithAsyncExecution, DefinitionStages.WithErrorBlobUri, DefinitionStages.WithOutputBlobUri, DefinitionStages.WithParameters, DefinitionStages.WithProtectedParameters, DefinitionStages.WithRunAsPassword, DefinitionStages.WithRunAsUser, DefinitionStages.WithSource, DefinitionStages.WithTags, DefinitionStages.WithTimeoutInSeconds { + } + } + /** + * The template for a LocationVirtualMachineRunCommand update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAsyncExecution, UpdateStages.WithErrorBlobUri, UpdateStages.WithOutputBlobUri, UpdateStages.WithParameters, UpdateStages.WithProtectedParameters, UpdateStages.WithRunAsPassword, UpdateStages.WithRunAsUser, UpdateStages.WithSource, UpdateStages.WithTags, UpdateStages.WithTimeoutInSeconds { + } + + /** + * Grouping of LocationVirtualMachineRunCommand update stages. + */ + interface UpdateStages { + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify AsyncExecution. + */ + interface WithAsyncExecution { + /** + * Specifies asyncExecution. + * @param asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete + * @return the next update stage + */ + Update withAsyncExecution(Boolean asyncExecution); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify ErrorBlobUri. + */ + interface WithErrorBlobUri { + /** + * Specifies errorBlobUri. + * @param errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded + * @return the next update stage + */ + Update withErrorBlobUri(String errorBlobUri); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify OutputBlobUri. + */ + interface WithOutputBlobUri { + /** + * Specifies outputBlobUri. + * @param outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded + * @return the next update stage + */ + Update withOutputBlobUri(String outputBlobUri); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameters used by the script + * @return the next update stage + */ + Update withParameters(List parameters); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify ProtectedParameters. + */ + interface WithProtectedParameters { + /** + * Specifies protectedParameters. + * @param protectedParameters The parameters used by the script + * @return the next update stage + */ + Update withProtectedParameters(List protectedParameters); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify RunAsPassword. + */ + interface WithRunAsPassword { + /** + * Specifies runAsPassword. + * @param runAsPassword Specifies the user account password on the VM when executing the run command + * @return the next update stage + */ + Update withRunAsPassword(String runAsPassword); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify RunAsUser. + */ + interface WithRunAsUser { + /** + * Specifies runAsUser. + * @param runAsUser Specifies the user account on the VM when executing the run command + * @return the next update stage + */ + Update withRunAsUser(String runAsUser); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify Source. + */ + interface WithSource { + /** + * Specifies source. + * @param source The source of the run command script + * @return the next update stage + */ + Update withSource(VirtualMachineRunCommandScriptSource source); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the locationvirtualmachineruncommand update allowing to specify TimeoutInSeconds. + */ + interface WithTimeoutInSeconds { + /** + * Specifies timeoutInSeconds. + * @param timeoutInSeconds The timeout in seconds to execute the run command + * @return the next update stage + */ + Update withTimeoutInSeconds(Integer timeoutInSeconds); + } + + } +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachine.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachine.java index a1e723dd39d62..65f3d0da18194 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachine.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachine.java @@ -173,7 +173,7 @@ public interface VirtualMachine extends HasInner, Indexable /** * The entirety of the VirtualMachine definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithLocation, DefinitionStages.WithCreate { } /** @@ -183,19 +183,19 @@ interface DefinitionStages { /** * The first stage of a VirtualMachine definition. */ - interface Blank extends WithResourceGroup { + interface Blank extends WithLocation { } /** * The stage of the virtualmachine definition allowing to specify Location. */ - interface WithResourceGroup { + interface WithLocation { /** * Specifies resourceGroupName. * @param resourceGroupName The name of the resource group * @return the next definition stage */ - WithLocation withExistingResourceGroup(String resourceGroupName); + WithLocation withExistingLocation(String resourceGroupName); } /** diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandInstanceView.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandInstanceView.java new file mode 100644 index 0000000000000..530c0cbe57ec7 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandInstanceView.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.compute.v2020_06_01; + +import org.joda.time.DateTime; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The instance view of a virtual machine run command. + */ +public class VirtualMachineRunCommandInstanceView { + /** + * Script execution status. Possible values include: 'Unknown', 'Pending', + * 'Running', 'Failed', 'Succeeded', 'TimedOut', 'Canceled'. + */ + @JsonProperty(value = "executionState") + private ExecutionState executionState; + + /** + * Communicate script configuration errors or execution messages. + */ + @JsonProperty(value = "executionMessage") + private String executionMessage; + + /** + * Exit code returned from script execution. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /** + * Script output stream. + */ + @JsonProperty(value = "output") + private String output; + + /** + * Script error stream. + */ + @JsonProperty(value = "error") + private String error; + + /** + * Script start time. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * Script end time. + */ + @JsonProperty(value = "endTime") + private DateTime endTime; + + /** + * The resource status information. + */ + @JsonProperty(value = "statuses") + private List statuses; + + /** + * Get script execution status. Possible values include: 'Unknown', 'Pending', 'Running', 'Failed', 'Succeeded', 'TimedOut', 'Canceled'. + * + * @return the executionState value + */ + public ExecutionState executionState() { + return this.executionState; + } + + /** + * Set script execution status. Possible values include: 'Unknown', 'Pending', 'Running', 'Failed', 'Succeeded', 'TimedOut', 'Canceled'. + * + * @param executionState the executionState value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withExecutionState(ExecutionState executionState) { + this.executionState = executionState; + return this; + } + + /** + * Get communicate script configuration errors or execution messages. + * + * @return the executionMessage value + */ + public String executionMessage() { + return this.executionMessage; + } + + /** + * Set communicate script configuration errors or execution messages. + * + * @param executionMessage the executionMessage value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withExecutionMessage(String executionMessage) { + this.executionMessage = executionMessage; + return this; + } + + /** + * Get exit code returned from script execution. + * + * @return the exitCode value + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set exit code returned from script execution. + * + * @param exitCode the exitCode value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get script output stream. + * + * @return the output value + */ + public String output() { + return this.output; + } + + /** + * Set script output stream. + * + * @param output the output value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withOutput(String output) { + this.output = output; + return this; + } + + /** + * Get script error stream. + * + * @return the error value + */ + public String error() { + return this.error; + } + + /** + * Set script error stream. + * + * @param error the error value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withError(String error) { + this.error = error; + return this; + } + + /** + * Get script start time. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set script start time. + * + * @param startTime the startTime value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get script end time. + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Set script end time. + * + * @param endTime the endTime value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withEndTime(DateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the resource status information. + * + * @return the statuses value + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the resource status information. + * + * @param statuses the statuses value to set + * @return the VirtualMachineRunCommandInstanceView object itself. + */ + public VirtualMachineRunCommandInstanceView withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandScriptSource.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandScriptSource.java new file mode 100644 index 0000000000000..441596bd122a9 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandScriptSource.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.compute.v2020_06_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the script sources for run command. + */ +public class VirtualMachineRunCommandScriptSource { + /** + * Specifies the script content to be executed on the VM. + */ + @JsonProperty(value = "script") + private String script; + + /** + * Specifies the script download location. + */ + @JsonProperty(value = "scriptUri") + private String scriptUri; + + /** + * Specifies a commandId of predefined built-in script. + */ + @JsonProperty(value = "commandId") + private String commandId; + + /** + * Get specifies the script content to be executed on the VM. + * + * @return the script value + */ + public String script() { + return this.script; + } + + /** + * Set specifies the script content to be executed on the VM. + * + * @param script the script value to set + * @return the VirtualMachineRunCommandScriptSource object itself. + */ + public VirtualMachineRunCommandScriptSource withScript(String script) { + this.script = script; + return this; + } + + /** + * Get specifies the script download location. + * + * @return the scriptUri value + */ + public String scriptUri() { + return this.scriptUri; + } + + /** + * Set specifies the script download location. + * + * @param scriptUri the scriptUri value to set + * @return the VirtualMachineRunCommandScriptSource object itself. + */ + public VirtualMachineRunCommandScriptSource withScriptUri(String scriptUri) { + this.scriptUri = scriptUri; + return this; + } + + /** + * Get specifies a commandId of predefined built-in script. + * + * @return the commandId value + */ + public String commandId() { + return this.commandId; + } + + /** + * Set specifies a commandId of predefined built-in script. + * + * @param commandId the commandId value to set + * @return the VirtualMachineRunCommandScriptSource object itself. + */ + public VirtualMachineRunCommandScriptSource withCommandId(String commandId) { + this.commandId = commandId; + return this; + } + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandUpdate.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandUpdate.java new file mode 100644 index 0000000000000..518e6af5e9c58 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommandUpdate.java @@ -0,0 +1,288 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.v2020_06_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Describes a Virtual Machine run command. + */ +@JsonFlatten +public class VirtualMachineRunCommandUpdate extends UpdateResource { + /** + * The source of the run command script. + */ + @JsonProperty(value = "properties.source") + private VirtualMachineRunCommandScriptSource source; + + /** + * The parameters used by the script. + */ + @JsonProperty(value = "properties.parameters") + private List parameters; + + /** + * The parameters used by the script. + */ + @JsonProperty(value = "properties.protectedParameters") + private List protectedParameters; + + /** + * Optional. If set to true, provisioning will complete as soon as the + * script starts and will not wait for script to complete. + */ + @JsonProperty(value = "properties.asyncExecution") + private Boolean asyncExecution; + + /** + * Specifies the user account on the VM when executing the run command. + */ + @JsonProperty(value = "properties.runAsUser") + private String runAsUser; + + /** + * Specifies the user account password on the VM when executing the run + * command. + */ + @JsonProperty(value = "properties.runAsPassword") + private String runAsPassword; + + /** + * The timeout in seconds to execute the run command. + */ + @JsonProperty(value = "properties.timeoutInSeconds") + private Integer timeoutInSeconds; + + /** + * Specifies the Azure storage blob where script output stream will be + * uploaded. + */ + @JsonProperty(value = "properties.outputBlobUri") + private String outputBlobUri; + + /** + * Specifies the Azure storage blob where script error stream will be + * uploaded. + */ + @JsonProperty(value = "properties.errorBlobUri") + private String errorBlobUri; + + /** + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The virtual machine run command instance view. + */ + @JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineRunCommandInstanceView instanceView; + + /** + * Get the source of the run command script. + * + * @return the source value + */ + public VirtualMachineRunCommandScriptSource source() { + return this.source; + } + + /** + * Set the source of the run command script. + * + * @param source the source value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withSource(VirtualMachineRunCommandScriptSource source) { + this.source = source; + return this; + } + + /** + * Get the parameters used by the script. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters used by the script. + * + * @param parameters the parameters value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the parameters used by the script. + * + * @return the protectedParameters value + */ + public List protectedParameters() { + return this.protectedParameters; + } + + /** + * Set the parameters used by the script. + * + * @param protectedParameters the protectedParameters value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withProtectedParameters(List protectedParameters) { + this.protectedParameters = protectedParameters; + return this; + } + + /** + * Get optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. + * + * @return the asyncExecution value + */ + public Boolean asyncExecution() { + return this.asyncExecution; + } + + /** + * Set optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. + * + * @param asyncExecution the asyncExecution value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withAsyncExecution(Boolean asyncExecution) { + this.asyncExecution = asyncExecution; + return this; + } + + /** + * Get specifies the user account on the VM when executing the run command. + * + * @return the runAsUser value + */ + public String runAsUser() { + return this.runAsUser; + } + + /** + * Set specifies the user account on the VM when executing the run command. + * + * @param runAsUser the runAsUser value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + return this; + } + + /** + * Get specifies the user account password on the VM when executing the run command. + * + * @return the runAsPassword value + */ + public String runAsPassword() { + return this.runAsPassword; + } + + /** + * Set specifies the user account password on the VM when executing the run command. + * + * @param runAsPassword the runAsPassword value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withRunAsPassword(String runAsPassword) { + this.runAsPassword = runAsPassword; + return this; + } + + /** + * Get the timeout in seconds to execute the run command. + * + * @return the timeoutInSeconds value + */ + public Integer timeoutInSeconds() { + return this.timeoutInSeconds; + } + + /** + * Set the timeout in seconds to execute the run command. + * + * @param timeoutInSeconds the timeoutInSeconds value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withTimeoutInSeconds(Integer timeoutInSeconds) { + this.timeoutInSeconds = timeoutInSeconds; + return this; + } + + /** + * Get specifies the Azure storage blob where script output stream will be uploaded. + * + * @return the outputBlobUri value + */ + public String outputBlobUri() { + return this.outputBlobUri; + } + + /** + * Set specifies the Azure storage blob where script output stream will be uploaded. + * + * @param outputBlobUri the outputBlobUri value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withOutputBlobUri(String outputBlobUri) { + this.outputBlobUri = outputBlobUri; + return this; + } + + /** + * Get specifies the Azure storage blob where script error stream will be uploaded. + * + * @return the errorBlobUri value + */ + public String errorBlobUri() { + return this.errorBlobUri; + } + + /** + * Set specifies the Azure storage blob where script error stream will be uploaded. + * + * @param errorBlobUri the errorBlobUri value to set + * @return the VirtualMachineRunCommandUpdate object itself. + */ + public VirtualMachineRunCommandUpdate withErrorBlobUri(String errorBlobUri) { + this.errorBlobUri = errorBlobUri; + return this; + } + + /** + * Get the provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the virtual machine run command instance view. + * + * @return the instanceView value + */ + public VirtualMachineRunCommandInstanceView instanceView() { + return this.instanceView; + } + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommands.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommands.java index d02a6c1183cd3..995e02d7ebd6a 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommands.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineRunCommands.java @@ -9,12 +9,20 @@ package com.microsoft.azure.management.compute.v2020_06_01; import rx.Observable; -import com.microsoft.azure.management.compute.v2020_06_01.RunCommandDocument; +import com.microsoft.azure.management.compute.v2020_06_01.LocationVirtualMachineRunCommand; +import rx.Completable; /** * Type representing VirtualMachineRunCommands. */ public interface VirtualMachineRunCommands { + /** + * Begins definition for a new RunCommand resource. + * @param name resource name. + * @return the first stage of the new RunCommand definition. + */ + LocationVirtualMachineRunCommand.DefinitionStages.Blank defineRunCommand(String name); + /** * Gets specific run command for a subscription in a location. * @@ -23,7 +31,7 @@ public interface VirtualMachineRunCommands { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable getAsync(String location, String commandId); + Observable getAsync(String location, String commandId); /** * Lists all available run commands for a subscription in a location. @@ -32,6 +40,38 @@ public interface VirtualMachineRunCommands { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - Observable listAsync(final String location); + Observable listAsync(final String location); + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String vmName, String runCommandName); + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByVirtualMachineAsync(String resourceGroupName, String vmName, String runCommandName); + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByVirtualMachineAsync(final String resourceGroupName, final String vmName); } diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineScaleSetVMRunCommands.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineScaleSetVMRunCommands.java new file mode 100644 index 0000000000000..e0fee6e1cc502 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineScaleSetVMRunCommands.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.compute.v2020_06_01; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.compute.v2020_06_01.implementation.VirtualMachineScaleSetVMRunCommandsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing VirtualMachineScaleSetVMRunCommands. + */ +public interface VirtualMachineScaleSetVMRunCommands extends SupportsCreating, HasInner { + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName); + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID 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 vmScaleSetName, final String instanceId); + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName); + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineScaleSetVirtualMachineRunCommand.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineScaleSetVirtualMachineRunCommand.java new file mode 100644 index 0000000000000..4eb07d83ad30a --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/VirtualMachineScaleSetVirtualMachineRunCommand.java @@ -0,0 +1,408 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.v2020_06_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.compute.v2020_06_01.implementation.VirtualMachineRunCommandInner; +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.compute.v2020_06_01.implementation.ComputeManager; +import java.util.Map; +import java.util.List; + +/** + * Type representing VirtualMachineScaleSetVirtualMachineRunCommand. + */ +public interface VirtualMachineScaleSetVirtualMachineRunCommand extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the asyncExecution value. + */ + Boolean asyncExecution(); + + /** + * @return the errorBlobUri value. + */ + String errorBlobUri(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the instanceView value. + */ + VirtualMachineRunCommandInstanceView instanceView(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the outputBlobUri value. + */ + String outputBlobUri(); + + /** + * @return the parameters value. + */ + List parameters(); + + /** + * @return the protectedParameters value. + */ + List protectedParameters(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the runAsPassword value. + */ + String runAsPassword(); + + /** + * @return the runAsUser value. + */ + String runAsUser(); + + /** + * @return the source value. + */ + VirtualMachineRunCommandScriptSource source(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the timeoutInSeconds value. + */ + Integer timeoutInSeconds(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the VirtualMachineScaleSetVirtualMachineRunCommand definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithVirtualmachine, DefinitionStages.WithLocation, DefinitionStages.WithCreate { + } + + /** + * Grouping of VirtualMachineScaleSetVirtualMachineRunCommand definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a VirtualMachineScaleSetVirtualMachineRunCommand definition. + */ + interface Blank extends WithVirtualmachine { + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify Virtualmachine. + */ + interface WithVirtualmachine { + /** + * Specifies resourceGroupName, vmScaleSetName, instanceId. + * @param resourceGroupName The name of the resource group + * @param vmScaleSetName The name of the VM scale set + * @param instanceId The instance ID of the virtual machine + * @return the next definition stage + */ + WithLocation withExistingVirtualmachine(String resourceGroupName, String vmScaleSetName, String instanceId); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location Resource location + * @return the next definition stage + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify AsyncExecution. + */ + interface WithAsyncExecution { + /** + * Specifies asyncExecution. + * @param asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete + * @return the next definition stage + */ + WithCreate withAsyncExecution(Boolean asyncExecution); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify ErrorBlobUri. + */ + interface WithErrorBlobUri { + /** + * Specifies errorBlobUri. + * @param errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded + * @return the next definition stage + */ + WithCreate withErrorBlobUri(String errorBlobUri); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify OutputBlobUri. + */ + interface WithOutputBlobUri { + /** + * Specifies outputBlobUri. + * @param outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded + * @return the next definition stage + */ + WithCreate withOutputBlobUri(String outputBlobUri); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameters used by the script + * @return the next definition stage + */ + WithCreate withParameters(List parameters); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify ProtectedParameters. + */ + interface WithProtectedParameters { + /** + * Specifies protectedParameters. + * @param protectedParameters The parameters used by the script + * @return the next definition stage + */ + WithCreate withProtectedParameters(List protectedParameters); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify RunAsPassword. + */ + interface WithRunAsPassword { + /** + * Specifies runAsPassword. + * @param runAsPassword Specifies the user account password on the VM when executing the run command + * @return the next definition stage + */ + WithCreate withRunAsPassword(String runAsPassword); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify RunAsUser. + */ + interface WithRunAsUser { + /** + * Specifies runAsUser. + * @param runAsUser Specifies the user account on the VM when executing the run command + * @return the next definition stage + */ + WithCreate withRunAsUser(String runAsUser); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify Source. + */ + interface WithSource { + /** + * Specifies source. + * @param source The source of the run command script + * @return the next definition stage + */ + WithCreate withSource(VirtualMachineRunCommandScriptSource source); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand definition allowing to specify TimeoutInSeconds. + */ + interface WithTimeoutInSeconds { + /** + * Specifies timeoutInSeconds. + * @param timeoutInSeconds The timeout in seconds to execute the run command + * @return the next definition stage + */ + WithCreate withTimeoutInSeconds(Integer timeoutInSeconds); + } + + /** + * 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.WithAsyncExecution, DefinitionStages.WithErrorBlobUri, DefinitionStages.WithOutputBlobUri, DefinitionStages.WithParameters, DefinitionStages.WithProtectedParameters, DefinitionStages.WithRunAsPassword, DefinitionStages.WithRunAsUser, DefinitionStages.WithSource, DefinitionStages.WithTags, DefinitionStages.WithTimeoutInSeconds { + } + } + /** + * The template for a VirtualMachineScaleSetVirtualMachineRunCommand update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAsyncExecution, UpdateStages.WithErrorBlobUri, UpdateStages.WithOutputBlobUri, UpdateStages.WithParameters, UpdateStages.WithProtectedParameters, UpdateStages.WithRunAsPassword, UpdateStages.WithRunAsUser, UpdateStages.WithSource, UpdateStages.WithTags, UpdateStages.WithTimeoutInSeconds { + } + + /** + * Grouping of VirtualMachineScaleSetVirtualMachineRunCommand update stages. + */ + interface UpdateStages { + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify AsyncExecution. + */ + interface WithAsyncExecution { + /** + * Specifies asyncExecution. + * @param asyncExecution Optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete + * @return the next update stage + */ + Update withAsyncExecution(Boolean asyncExecution); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify ErrorBlobUri. + */ + interface WithErrorBlobUri { + /** + * Specifies errorBlobUri. + * @param errorBlobUri Specifies the Azure storage blob where script error stream will be uploaded + * @return the next update stage + */ + Update withErrorBlobUri(String errorBlobUri); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify OutputBlobUri. + */ + interface WithOutputBlobUri { + /** + * Specifies outputBlobUri. + * @param outputBlobUri Specifies the Azure storage blob where script output stream will be uploaded + * @return the next update stage + */ + Update withOutputBlobUri(String outputBlobUri); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify Parameters. + */ + interface WithParameters { + /** + * Specifies parameters. + * @param parameters The parameters used by the script + * @return the next update stage + */ + Update withParameters(List parameters); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify ProtectedParameters. + */ + interface WithProtectedParameters { + /** + * Specifies protectedParameters. + * @param protectedParameters The parameters used by the script + * @return the next update stage + */ + Update withProtectedParameters(List protectedParameters); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify RunAsPassword. + */ + interface WithRunAsPassword { + /** + * Specifies runAsPassword. + * @param runAsPassword Specifies the user account password on the VM when executing the run command + * @return the next update stage + */ + Update withRunAsPassword(String runAsPassword); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify RunAsUser. + */ + interface WithRunAsUser { + /** + * Specifies runAsUser. + * @param runAsUser Specifies the user account on the VM when executing the run command + * @return the next update stage + */ + Update withRunAsUser(String runAsUser); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify Source. + */ + interface WithSource { + /** + * Specifies source. + * @param source The source of the run command script + * @return the next update stage + */ + Update withSource(VirtualMachineRunCommandScriptSource source); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the virtualmachinescalesetvirtualmachineruncommand update allowing to specify TimeoutInSeconds. + */ + interface WithTimeoutInSeconds { + /** + * Specifies timeoutInSeconds. + * @param timeoutInSeconds The timeout in seconds to execute the run command + * @return the next update stage + */ + Update withTimeoutInSeconds(Integer timeoutInSeconds); + } + + } +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManagementClientImpl.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManagementClientImpl.java index 3bdb5e19d9275..a351a5617f7f3 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManagementClientImpl.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManagementClientImpl.java @@ -382,6 +382,19 @@ public VirtualMachineRunCommandsInner virtualMachineRunCommands() { return this.virtualMachineRunCommands; } + /** + * The VirtualMachineScaleSetVMRunCommandsInner object to access its operations. + */ + private VirtualMachineScaleSetVMRunCommandsInner virtualMachineScaleSetVMRunCommands; + + /** + * Gets the VirtualMachineScaleSetVMRunCommandsInner object to access its operations. + * @return the VirtualMachineScaleSetVMRunCommandsInner object. + */ + public VirtualMachineScaleSetVMRunCommandsInner virtualMachineScaleSetVMRunCommands() { + return this.virtualMachineScaleSetVMRunCommands; + } + /** * The ResourceSkusInner object to access its operations. */ @@ -579,6 +592,7 @@ protected void initialize() { this.virtualMachineScaleSetVMs = new VirtualMachineScaleSetVMsInner(restClient().retrofit(), this); this.logAnalytics = new LogAnalyticsInner(restClient().retrofit(), this); this.virtualMachineRunCommands = new VirtualMachineRunCommandsInner(restClient().retrofit(), this); + this.virtualMachineScaleSetVMRunCommands = new VirtualMachineScaleSetVMRunCommandsInner(restClient().retrofit(), this); this.resourceSkus = new ResourceSkusInner(restClient().retrofit(), this); this.disks = new DisksInner(restClient().retrofit(), this); this.snapshots = new SnapshotsInner(restClient().retrofit(), this); diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManager.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManager.java index 53afc22019f57..73db0dfc8e971 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManager.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ComputeManager.java @@ -36,6 +36,7 @@ import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineScaleSetVMs; import com.microsoft.azure.management.compute.v2020_06_01.LogAnalytics; import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommands; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands; import com.microsoft.azure.management.compute.v2020_06_01.ResourceSkus; import com.microsoft.azure.management.compute.v2020_06_01.Disks; import com.microsoft.azure.management.compute.v2020_06_01.Snapshots; @@ -74,6 +75,7 @@ public final class ComputeManager extends ManagerCore implements LocationVirtualMachineRunCommand, LocationVirtualMachineRunCommand.Definition, LocationVirtualMachineRunCommand.Update { + private final ComputeManager manager; + private String resourceGroupName; + private String vmName; + private String runCommandName; + private VirtualMachineRunCommandUpdate updateParameter; + + LocationVirtualMachineRunCommandImpl(String name, ComputeManager manager) { + super(name, new VirtualMachineRunCommandInner()); + this.manager = manager; + // Set resource name + this.runCommandName = name; + // + this.updateParameter = new VirtualMachineRunCommandUpdate(); + } + + LocationVirtualMachineRunCommandImpl(VirtualMachineRunCommandInner inner, ComputeManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.runCommandName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.vmName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualMachines"); + this.runCommandName = IdParsingUtils.getValueFromIdByName(inner.id(), "runCommands"); + // + this.updateParameter = new VirtualMachineRunCommandUpdate(); + } + + @Override + public ComputeManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualMachineRunCommandsInner client = this.manager().inner().virtualMachineRunCommands(); + return client.createOrUpdateAsync(this.resourceGroupName, this.vmName, this.runCommandName, this.inner()) + .map(new Func1() { + @Override + public VirtualMachineRunCommandInner call(VirtualMachineRunCommandInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualMachineRunCommandsInner client = this.manager().inner().virtualMachineRunCommands(); + return client.updateAsync(this.resourceGroupName, this.vmName, this.runCommandName, this.updateParameter) + .map(new Func1() { + @Override + public VirtualMachineRunCommandInner call(VirtualMachineRunCommandInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualMachineRunCommandsInner client = this.manager().inner().virtualMachineRunCommands(); + return client.getAsync(this.resourceGroupName, this.vmName, this.runCommandName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new VirtualMachineRunCommandUpdate(); + } + + @Override + public Boolean asyncExecution() { + return this.inner().asyncExecution(); + } + + @Override + public String errorBlobUri() { + return this.inner().errorBlobUri(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public VirtualMachineRunCommandInstanceView instanceView() { + return this.inner().instanceView(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String outputBlobUri() { + return this.inner().outputBlobUri(); + } + + @Override + public List parameters() { + return this.inner().parameters(); + } + + @Override + public List protectedParameters() { + return this.inner().protectedParameters(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String runAsPassword() { + return this.inner().runAsPassword(); + } + + @Override + public String runAsUser() { + return this.inner().runAsUser(); + } + + @Override + public VirtualMachineRunCommandScriptSource source() { + return this.inner().source(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public Integer timeoutInSeconds() { + return this.inner().timeoutInSeconds(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public LocationVirtualMachineRunCommandImpl withExistingLocation(String resourceGroupName, String vmName) { + this.resourceGroupName = resourceGroupName; + this.vmName = vmName; + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withAsyncExecution(Boolean asyncExecution) { + if (isInCreateMode()) { + this.inner().withAsyncExecution(asyncExecution); + } else { + this.updateParameter.withAsyncExecution(asyncExecution); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withErrorBlobUri(String errorBlobUri) { + if (isInCreateMode()) { + this.inner().withErrorBlobUri(errorBlobUri); + } else { + this.updateParameter.withErrorBlobUri(errorBlobUri); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withOutputBlobUri(String outputBlobUri) { + if (isInCreateMode()) { + this.inner().withOutputBlobUri(outputBlobUri); + } else { + this.updateParameter.withOutputBlobUri(outputBlobUri); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withParameters(List parameters) { + if (isInCreateMode()) { + this.inner().withParameters(parameters); + } else { + this.updateParameter.withParameters(parameters); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withProtectedParameters(List protectedParameters) { + if (isInCreateMode()) { + this.inner().withProtectedParameters(protectedParameters); + } else { + this.updateParameter.withProtectedParameters(protectedParameters); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withRunAsPassword(String runAsPassword) { + if (isInCreateMode()) { + this.inner().withRunAsPassword(runAsPassword); + } else { + this.updateParameter.withRunAsPassword(runAsPassword); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withRunAsUser(String runAsUser) { + if (isInCreateMode()) { + this.inner().withRunAsUser(runAsUser); + } else { + this.updateParameter.withRunAsUser(runAsUser); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withSource(VirtualMachineRunCommandScriptSource source) { + if (isInCreateMode()) { + this.inner().withSource(source); + } else { + this.updateParameter.withSource(source); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public LocationVirtualMachineRunCommandImpl withTimeoutInSeconds(Integer timeoutInSeconds) { + if (isInCreateMode()) { + this.inner().withTimeoutInSeconds(timeoutInSeconds); + } else { + this.updateParameter.withTimeoutInSeconds(timeoutInSeconds); + } + return this; + } + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ProximityPlacementGroupImpl.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ProximityPlacementGroupImpl.java index 3021eb6b9d82a..8b585d3c5e781 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ProximityPlacementGroupImpl.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ProximityPlacementGroupImpl.java @@ -18,6 +18,7 @@ import com.microsoft.azure.management.compute.v2020_06_01.InstanceViewStatus; class ProximityPlacementGroupImpl extends GroupableResourceCoreImpl implements ProximityPlacementGroup, ProximityPlacementGroup.Definition, ProximityPlacementGroup.Update { + private Map utags; ProximityPlacementGroupImpl(String name, ProximityPlacementGroupInner inner, ComputeManager manager) { super(name, inner, manager); } @@ -32,7 +33,7 @@ public Observable createResourceAsync() { @Override public Observable updateResourceAsync() { ProximityPlacementGroupsInner client = this.manager().inner().proximityPlacementGroups(); - return client.updateAsync(this.resourceGroupName(), this.name(), this.tags()) + return client.updateAsync(this.resourceGroupName(), this.name(), this.utags) .map(innerToFluentMap(this)); } @@ -84,4 +85,11 @@ public ProximityPlacementGroupImpl withProximityPlacementGroupType(ProximityPlac this.inner().withProximityPlacementGroupType(proximityPlacementGroupType); return this; } + + @Override + public ProximityPlacementGroupImpl withTags(Map tags) { + this.utags = tags; + return this; + } + } diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineImpl.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineImpl.java index a92410fbfa5ce..b187886c86429 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineImpl.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineImpl.java @@ -264,7 +264,7 @@ public List zones() { } @Override - public VirtualMachineImpl withExistingResourceGroup(String resourceGroupName) { + public VirtualMachineImpl withExistingLocation(String resourceGroupName) { this.resourceGroupName = resourceGroupName; return this; } diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandInner.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandInner.java new file mode 100644 index 0000000000000..8691eaa52ba8e --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandInner.java @@ -0,0 +1,292 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.v2020_06_01.implementation; + +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommandScriptSource; +import java.util.List; +import com.microsoft.azure.management.compute.v2020_06_01.RunCommandInputParameter; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommandInstanceView; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Describes a Virtual Machine run command. + */ +@JsonFlatten +public class VirtualMachineRunCommandInner extends Resource { + /** + * The source of the run command script. + */ + @JsonProperty(value = "properties.source") + private VirtualMachineRunCommandScriptSource source; + + /** + * The parameters used by the script. + */ + @JsonProperty(value = "properties.parameters") + private List parameters; + + /** + * The parameters used by the script. + */ + @JsonProperty(value = "properties.protectedParameters") + private List protectedParameters; + + /** + * Optional. If set to true, provisioning will complete as soon as the + * script starts and will not wait for script to complete. + */ + @JsonProperty(value = "properties.asyncExecution") + private Boolean asyncExecution; + + /** + * Specifies the user account on the VM when executing the run command. + */ + @JsonProperty(value = "properties.runAsUser") + private String runAsUser; + + /** + * Specifies the user account password on the VM when executing the run + * command. + */ + @JsonProperty(value = "properties.runAsPassword") + private String runAsPassword; + + /** + * The timeout in seconds to execute the run command. + */ + @JsonProperty(value = "properties.timeoutInSeconds") + private Integer timeoutInSeconds; + + /** + * Specifies the Azure storage blob where script output stream will be + * uploaded. + */ + @JsonProperty(value = "properties.outputBlobUri") + private String outputBlobUri; + + /** + * Specifies the Azure storage blob where script error stream will be + * uploaded. + */ + @JsonProperty(value = "properties.errorBlobUri") + private String errorBlobUri; + + /** + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The virtual machine run command instance view. + */ + @JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineRunCommandInstanceView instanceView; + + /** + * Get the source of the run command script. + * + * @return the source value + */ + public VirtualMachineRunCommandScriptSource source() { + return this.source; + } + + /** + * Set the source of the run command script. + * + * @param source the source value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withSource(VirtualMachineRunCommandScriptSource source) { + this.source = source; + return this; + } + + /** + * Get the parameters used by the script. + * + * @return the parameters value + */ + public List parameters() { + return this.parameters; + } + + /** + * Set the parameters used by the script. + * + * @param parameters the parameters value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withParameters(List parameters) { + this.parameters = parameters; + return this; + } + + /** + * Get the parameters used by the script. + * + * @return the protectedParameters value + */ + public List protectedParameters() { + return this.protectedParameters; + } + + /** + * Set the parameters used by the script. + * + * @param protectedParameters the protectedParameters value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withProtectedParameters(List protectedParameters) { + this.protectedParameters = protectedParameters; + return this; + } + + /** + * Get optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. + * + * @return the asyncExecution value + */ + public Boolean asyncExecution() { + return this.asyncExecution; + } + + /** + * Set optional. If set to true, provisioning will complete as soon as the script starts and will not wait for script to complete. + * + * @param asyncExecution the asyncExecution value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withAsyncExecution(Boolean asyncExecution) { + this.asyncExecution = asyncExecution; + return this; + } + + /** + * Get specifies the user account on the VM when executing the run command. + * + * @return the runAsUser value + */ + public String runAsUser() { + return this.runAsUser; + } + + /** + * Set specifies the user account on the VM when executing the run command. + * + * @param runAsUser the runAsUser value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + return this; + } + + /** + * Get specifies the user account password on the VM when executing the run command. + * + * @return the runAsPassword value + */ + public String runAsPassword() { + return this.runAsPassword; + } + + /** + * Set specifies the user account password on the VM when executing the run command. + * + * @param runAsPassword the runAsPassword value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withRunAsPassword(String runAsPassword) { + this.runAsPassword = runAsPassword; + return this; + } + + /** + * Get the timeout in seconds to execute the run command. + * + * @return the timeoutInSeconds value + */ + public Integer timeoutInSeconds() { + return this.timeoutInSeconds; + } + + /** + * Set the timeout in seconds to execute the run command. + * + * @param timeoutInSeconds the timeoutInSeconds value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withTimeoutInSeconds(Integer timeoutInSeconds) { + this.timeoutInSeconds = timeoutInSeconds; + return this; + } + + /** + * Get specifies the Azure storage blob where script output stream will be uploaded. + * + * @return the outputBlobUri value + */ + public String outputBlobUri() { + return this.outputBlobUri; + } + + /** + * Set specifies the Azure storage blob where script output stream will be uploaded. + * + * @param outputBlobUri the outputBlobUri value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withOutputBlobUri(String outputBlobUri) { + this.outputBlobUri = outputBlobUri; + return this; + } + + /** + * Get specifies the Azure storage blob where script error stream will be uploaded. + * + * @return the errorBlobUri value + */ + public String errorBlobUri() { + return this.errorBlobUri; + } + + /** + * Set specifies the Azure storage blob where script error stream will be uploaded. + * + * @param errorBlobUri the errorBlobUri value to set + * @return the VirtualMachineRunCommandInner object itself. + */ + public VirtualMachineRunCommandInner withErrorBlobUri(String errorBlobUri) { + this.errorBlobUri = errorBlobUri; + return this; + } + + /** + * Get the provisioning state, which only appears in the response. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the virtual machine run command instance view. + * + * @return the instanceView value + */ + public VirtualMachineRunCommandInstanceView instanceView() { + return this.instanceView; + } + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsImpl.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsImpl.java index 017143a786e94..339d139bd2e17 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsImpl.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsImpl.java @@ -13,8 +13,9 @@ import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommands; import rx.Observable; import rx.functions.Func1; -import com.microsoft.azure.management.compute.v2020_06_01.RunCommandDocument; +import com.microsoft.azure.management.compute.v2020_06_01.LocationVirtualMachineRunCommand; import com.microsoft.azure.Page; +import rx.Completable; class VirtualMachineRunCommandsImpl extends WrapperImpl implements VirtualMachineRunCommands { private final ComputeManager manager; @@ -28,11 +29,20 @@ public ComputeManager manager() { return this.manager; } - private RunCommandDocumentImpl wrapRunCommandDocumentModel(RunCommandDocumentInner inner) { - return new RunCommandDocumentImpl(inner, manager()); + @Override + public LocationVirtualMachineRunCommandImpl defineRunCommand(String name) { + return wrapRunCommandModel(name); + } + + private LocationVirtualMachineRunCommandImpl wrapRunCommandModel(String name) { + return new LocationVirtualMachineRunCommandImpl(name, this.manager()); } - private Observable getRunCommandDocumentInnerUsingVirtualMachineRunCommandsInnerAsync(String id) { + private LocationVirtualMachineRunCommandImpl wrapLocationVirtualMachineRunCommandModel(VirtualMachineRunCommandInner inner) { + return new LocationVirtualMachineRunCommandImpl(inner, manager()); + } + + private Observable getVirtualMachineRunCommandInnerUsingVirtualMachineRunCommandsInnerAsync(String id) { String location = IdParsingUtils.getValueFromIdByName(id, "locations"); String commandId = IdParsingUtils.getValueFromIdByName(id, "runCommands"); VirtualMachineRunCommandsInner client = this.inner(); @@ -40,23 +50,23 @@ private Observable getRunCommandDocumentInnerUsingVirtu } @Override - public Observable getAsync(String location, String commandId) { + public Observable getAsync(String location, String commandId) { VirtualMachineRunCommandsInner client = this.inner(); return client.getAsync(location, commandId) - .flatMap(new Func1>() { + .flatMap(new Func1>() { @Override - public Observable call(RunCommandDocumentInner inner) { + public Observable call(VirtualMachineRunCommandInner inner) { if (inner == null) { return Observable.empty(); } else { - return Observable.just((RunCommandDocument)wrapRunCommandDocumentModel(inner)); + return Observable.just((LocationVirtualMachineRunCommand)wrapLocationVirtualMachineRunCommandModel(inner)); } } }); } @Override - public Observable listAsync(final String location) { + public Observable listAsync(final String location) { VirtualMachineRunCommandsInner client = this.inner(); return client.listAsync(location) .flatMapIterable(new Func1, Iterable>() { @@ -65,16 +75,46 @@ public Iterable call(Page>() { + .map(new Func1() { + @Override + public LocationVirtualMachineRunCommand call(VirtualMachineRunCommandInner inner) { + return wrapLocationVirtualMachineRunCommandModel(inner); + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String vmName, String runCommandName) { + VirtualMachineRunCommandsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, vmName, runCommandName).toCompletable(); + } + + @Override + public Observable getByVirtualMachineAsync(String resourceGroupName, String vmName, String runCommandName) { + VirtualMachineRunCommandsInner client = this.inner(); + return client.getByVirtualMachineAsync(resourceGroupName, vmName, runCommandName) + .map(new Func1() { + @Override + public LocationVirtualMachineRunCommand call(VirtualMachineRunCommandInner inner) { + return new LocationVirtualMachineRunCommandImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByVirtualMachineAsync(final String resourceGroupName, final String vmName) { + VirtualMachineRunCommandsInner client = this.inner(); + return client.listByVirtualMachineAsync(resourceGroupName, vmName) + .flatMapIterable(new Func1, Iterable>() { @Override - public Observable call(RunCommandDocumentBaseInner inner) { - return getRunCommandDocumentInnerUsingVirtualMachineRunCommandsInnerAsync(inner.id()); + public Iterable call(Page page) { + return page.items(); } }) - .map(new Func1() { + .map(new Func1() { @Override - public RunCommandDocument call(RunCommandDocumentInner inner) { - return wrapRunCommandDocumentModel(inner); + public LocationVirtualMachineRunCommand call(VirtualMachineRunCommandInner inner) { + return new LocationVirtualMachineRunCommandImpl(inner, manager()); } }); } diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsInner.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsInner.java index 5a131d430f029..026628753cbfc 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsInner.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineRunCommandsInner.java @@ -13,18 +13,24 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommandUpdate; 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; @@ -65,10 +71,46 @@ interface VirtualMachineRunCommandsService { @GET("subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}") Observable> get(@Path("location") String location, @Path("commandId") String commandId, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineRunCommands createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandInner runCommand, @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.compute.v2020_06_01.VirtualMachineRunCommands beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandInner runCommand, @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.compute.v2020_06_01.VirtualMachineRunCommands update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandUpdate runCommand, @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.compute.v2020_06_01.VirtualMachineRunCommands beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandUpdate runCommand, @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.compute.v2020_06_01.VirtualMachineRunCommands delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineRunCommands beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineRunCommands getByVirtualMachine" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}") + Observable> getByVirtualMachine(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineRunCommands listByVirtualMachine" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands") + Observable> listByVirtualMachine(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineRunCommands 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.compute.v2020_06_01.VirtualMachineRunCommands listByVirtualMachineNext" }) + @GET + Observable> listByVirtualMachineNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -269,102 +311,354 @@ private ServiceResponse getDelegate(Response listNext(final String nextPageLink) { - ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); - return new PagedList(response.body()) { + public VirtualMachineRunCommandInner createOrUpdate(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).toBlocking().last().body(); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand 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 createOrUpdateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand), serviceCallback); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { @Override - public Page nextPage(String nextPageLink) { - return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); } - }; + }); } /** - * Lists all available run commands for a subscription in a location. + * The operation to create or update the run command. * - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), runCommand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner beginCreateOrUpdate(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).toBlocking().single().body(); + } + + /** + * The operation to create or update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand 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> 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); + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand), serviceCallback); } /** - * Lists all available run commands for a subscription in a location. + * The operation to create or update the run command. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<RunCommandDocumentBaseInner> object + * @return the observable to the VirtualMachineRunCommandInner object */ - public Observable> listNextAsync(final String nextPageLink) { - return listNextWithServiceResponseAsync(nextPageLink) - .map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); } /** - * Lists all available run commands for a subscription in a location. + * The operation to create or update the run command. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be created or updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<RunCommandDocumentBaseInner> object + * @return the observable to the VirtualMachineRunCommandInner object */ - public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { - return listNextSinglePageAsync(nextPageLink) - .concatMap(new Func1>, Observable>>>() { + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandInner runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + return service.beginCreateOrUpdate(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), runCommand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { - return Observable.just(page); + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); } - return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } + 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); + } + /** - * Lists all available run commands for a subscription in a location. + * The operation to update the run command. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<RunCommandDocumentBaseInner> object wrapped in {@link ServiceResponse} if successful. + * @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 VirtualMachineRunCommandInner object if successful. */ - public Observable>> listNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + public VirtualMachineRunCommandInner update(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return updateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).toBlocking().last().body(); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand 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 updateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand), serviceCallback); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return updateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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>>>() { + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + Observable> observable = service.update(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), runCommand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner beginUpdate(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).toBlocking().single().body(); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand 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 beginUpdateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand), serviceCallback); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be updated. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + return service.beginUpdate(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), runCommand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { @Override - public Observable>> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse> result = listNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } @@ -372,9 +666,817 @@ public Observable>> call(Respo }); } - private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse beginUpdateDelegate(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); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 vmName, String runCommandName) { + deleteWithServiceResponseAsync(resourceGroupName, vmName, runCommandName).toBlocking().last().body(); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param serviceCallback 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 vmName, String runCommandName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, vmName, runCommandName), serviceCallback); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String vmName, String runCommandName) { + return deleteWithServiceResponseAsync(resourceGroupName, vmName, runCommandName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + Observable> observable = service.delete(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 vmName, String runCommandName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, vmName, runCommandName).toBlocking().single().body(); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @param serviceCallback 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 vmName, String runCommandName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, vmName, runCommandName), serviceCallback); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String vmName, String runCommandName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, vmName, runCommandName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the run command should be deleted. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + return service.beginDelete(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), 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(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner getByVirtualMachine(String resourceGroupName, String vmName, String runCommandName) { + return getByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName, runCommandName).toBlocking().single().body(); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByVirtualMachineAsync(String resourceGroupName, String vmName, String runCommandName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName, runCommandName), serviceCallback); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable getByVirtualMachineAsync(String resourceGroupName, String vmName, String runCommandName) { + return getByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName, runCommandName).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable> getByVirtualMachineWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + final String expand = null; + return service.getByVirtualMachine(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), expand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByVirtualMachineDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner getByVirtualMachine(String resourceGroupName, String vmName, String runCommandName, String expand) { + return getByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, expand).toBlocking().single().body(); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on 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 getByVirtualMachineAsync(String resourceGroupName, String vmName, String runCommandName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, expand), serviceCallback); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable getByVirtualMachineAsync(String resourceGroupName, String vmName, String runCommandName, String expand) { + return getByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName, runCommandName, expand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to get the run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable> getByVirtualMachineWithServiceResponseAsync(String resourceGroupName, String vmName, String runCommandName, String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + return service.getByVirtualMachine(resourceGroupName, vmName, runCommandName, this.client.subscriptionId(), expand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByVirtualMachineDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByVirtualMachineDelegate(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); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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<VirtualMachineRunCommandInner> object if successful. + */ + public PagedList listByVirtualMachine(final String resourceGroupName, final String vmName) { + ServiceResponse> response = listByVirtualMachineSinglePageAsync(resourceGroupName, vmName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVirtualMachineNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByVirtualMachineAsync(final String resourceGroupName, final String vmName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVirtualMachineSinglePageAsync(resourceGroupName, vmName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVirtualMachineNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable> listByVirtualMachineAsync(final String resourceGroupName, final String vmName) { + return listByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable>> listByVirtualMachineWithServiceResponseAsync(final String resourceGroupName, final String vmName) { + return listByVirtualMachineSinglePageAsync(resourceGroupName, vmName) + .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(listByVirtualMachineNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineRunCommandInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVirtualMachineSinglePageAsync(final String resourceGroupName, final String vmName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + final String expand = null; + return service.listByVirtualMachine(resourceGroupName, vmName, this.client.subscriptionId(), expand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByVirtualMachineDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on 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 PagedList<VirtualMachineRunCommandInner> object if successful. + */ + public PagedList listByVirtualMachine(final String resourceGroupName, final String vmName, final String expand) { + ServiceResponse> response = listByVirtualMachineSinglePageAsync(resourceGroupName, vmName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVirtualMachineNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on 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> listByVirtualMachineAsync(final String resourceGroupName, final String vmName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVirtualMachineSinglePageAsync(resourceGroupName, vmName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVirtualMachineNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable> listByVirtualMachineAsync(final String resourceGroupName, final String vmName, final String expand) { + return listByVirtualMachineWithServiceResponseAsync(resourceGroupName, vmName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable>> listByVirtualMachineWithServiceResponseAsync(final String resourceGroupName, final String vmName, final String expand) { + return listByVirtualMachineSinglePageAsync(resourceGroupName, vmName, expand) + .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(listByVirtualMachineNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The operation to get all run commands of a Virtual Machine. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param vmName The name of the virtual machine containing the run command. + ServiceResponse> * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineRunCommandInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVirtualMachineSinglePageAsync(final String resourceGroupName, final String vmName, final String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + return service.listByVirtualMachine(resourceGroupName, vmName, this.client.subscriptionId(), expand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByVirtualMachineDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVirtualMachineDelegate(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 available run commands for a subscription in a location. + * + * @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<RunCommandDocumentBaseInner> 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(); + } + }; + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @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); + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @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<RunCommandDocumentBaseInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all available run commands for a subscription in a location. + * + * @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<RunCommandDocumentBaseInner> 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)); + } + }); + } + + /** + * Lists all available run commands for a subscription in a location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RunCommandDocumentBaseInner> 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); + } + + /** + * The operation to get all run commands of a 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<VirtualMachineRunCommandInner> object if successful. + */ + public PagedList listByVirtualMachineNext(final String nextPageLink) { + ServiceResponse> response = listByVirtualMachineNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByVirtualMachineNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The operation to get all run commands of a 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> listByVirtualMachineNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByVirtualMachineNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByVirtualMachineNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The operation to get all run commands of a 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<VirtualMachineRunCommandInner> object + */ + public Observable> listByVirtualMachineNextAsync(final String nextPageLink) { + return listByVirtualMachineNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The operation to get all run commands of a 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<VirtualMachineRunCommandInner> object + */ + public Observable>> listByVirtualMachineNextWithServiceResponseAsync(final String nextPageLink) { + return listByVirtualMachineNextSinglePageAsync(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(listByVirtualMachineNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * The operation to get all run commands of a 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<VirtualMachineRunCommandInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByVirtualMachineNextSinglePageAsync(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.listByVirtualMachineNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByVirtualMachineNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByVirtualMachineNextDelegate(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/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVMRunCommandsImpl.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVMRunCommandsImpl.java new file mode 100644 index 0000000000000..67d8f0593a322 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVMRunCommandsImpl.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.compute.v2020_06_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineScaleSetVirtualMachineRunCommand; + +class VirtualMachineScaleSetVMRunCommandsImpl extends WrapperImpl implements VirtualMachineScaleSetVMRunCommands { + private final ComputeManager manager; + + VirtualMachineScaleSetVMRunCommandsImpl(ComputeManager manager) { + super(manager.inner().virtualMachineScaleSetVMRunCommands()); + this.manager = manager; + } + + public ComputeManager manager() { + return this.manager; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl define(String name) { + return wrapModel(name); + } + + private VirtualMachineScaleSetVirtualMachineRunCommandImpl wrapModel(VirtualMachineRunCommandInner inner) { + return new VirtualMachineScaleSetVirtualMachineRunCommandImpl(inner, manager()); + } + + private VirtualMachineScaleSetVirtualMachineRunCommandImpl wrapModel(String name) { + return new VirtualMachineScaleSetVirtualMachineRunCommandImpl(name, this.manager()); + } + + @Override + public Observable listAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId) { + VirtualMachineScaleSetVMRunCommandsInner client = this.inner(); + return client.listAsync(resourceGroupName, vmScaleSetName, instanceId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachineScaleSetVirtualMachineRunCommand call(VirtualMachineRunCommandInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + VirtualMachineScaleSetVMRunCommandsInner client = this.inner(); + return client.getAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName) + .flatMap(new Func1>() { + @Override + public Observable call(VirtualMachineRunCommandInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((VirtualMachineScaleSetVirtualMachineRunCommand)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + VirtualMachineScaleSetVMRunCommandsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).toCompletable(); + } + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVMRunCommandsInner.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVMRunCommandsInner.java new file mode 100644 index 0000000000000..6d891724f3926 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVMRunCommandsInner.java @@ -0,0 +1,1236 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.v2020_06_01.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.compute.v2020_06_01.VirtualMachineRunCommandUpdate; +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 VirtualMachineScaleSetVMRunCommands. + */ +public class VirtualMachineScaleSetVMRunCommandsInner { + /** The Retrofit service to perform REST calls. */ + private VirtualMachineScaleSetVMRunCommandsService service; + /** The service client containing this operation class. */ + private ComputeManagementClientImpl client; + + /** + * Initializes an instance of VirtualMachineScaleSetVMRunCommandsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public VirtualMachineScaleSetVMRunCommandsInner(Retrofit retrofit, ComputeManagementClientImpl client) { + this.service = retrofit.create(VirtualMachineScaleSetVMRunCommandsService.class); + this.client = client; + } + + /** + * The interface defining all the services for VirtualMachineScaleSetVMRunCommands to be + * used by Retrofit to perform actually REST calls. + */ + interface VirtualMachineScaleSetVMRunCommandsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandInner runCommand, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandInner runCommand, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandUpdate runCommand, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineRunCommandUpdate runCommand, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("runCommandName") String runCommandName, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("subscriptionId") String subscriptionId, @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.compute.v2020_06_01.VirtualMachineScaleSetVMRunCommands listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner createOrUpdate(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).toBlocking().last().body(); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand 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 createOrUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand), serviceCallback); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), runCommand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner beginCreateOrUpdate(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).toBlocking().single().body(); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand 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 beginCreateOrUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand), serviceCallback); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to create or update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Create Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandInner runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + return service.beginCreateOrUpdate(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), runCommand, 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); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner update(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return updateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).toBlocking().last().body(); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand 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 updateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand), serviceCallback); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return updateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + Observable> observable = service.update(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), runCommand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner beginUpdate(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).toBlocking().single().body(); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand 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 beginUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand), serviceCallback); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, runCommand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param runCommand Parameters supplied to the Update Virtual Machine RunCommand operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, VirtualMachineRunCommandUpdate runCommand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (runCommand == null) { + throw new IllegalArgumentException("Parameter runCommand is required and cannot be null."); + } + Validator.validate(runCommand); + final String apiVersion = "2020-06-01"; + return service.beginUpdate(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), runCommand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(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); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 vmScaleSetName, String instanceId, String runCommandName) { + deleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).toBlocking().last().body(); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param serviceCallback 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 vmScaleSetName, String instanceId, String runCommandName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName), serviceCallback); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + return deleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + Observable> observable = service.delete(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 vmScaleSetName, String instanceId, String runCommandName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).toBlocking().single().body(); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param serviceCallback 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 vmScaleSetName, String instanceId, String runCommandName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName), serviceCallback); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + return service.beginDelete(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), 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(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner get(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).toBlocking().single().body(); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param serviceCallback 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 vmScaleSetName, String instanceId, String runCommandName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName), serviceCallback); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable getAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + final String expand = null; + return service.get(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), expand, 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); + } + } + }); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on 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 VirtualMachineRunCommandInner object if successful. + */ + public VirtualMachineRunCommandInner get(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand).toBlocking().single().body(); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on 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 resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand), serviceCallback); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable getAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, String expand) { + return getWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, runCommandName, expand).map(new Func1, VirtualMachineRunCommandInner>() { + @Override + public VirtualMachineRunCommandInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to get the VMSS VM run command. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param runCommandName The name of the virtual machine run command. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineRunCommandInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, String runCommandName, String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (runCommandName == null) { + throw new IllegalArgumentException("Parameter runCommandName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + return service.get(resourceGroupName, vmScaleSetName, instanceId, runCommandName, this.client.subscriptionId(), expand, 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); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID 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<VirtualMachineRunCommandInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String vmScaleSetName, final String instanceId) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID 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 vmScaleSetName, final String instanceId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId) { + return listWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId) { + return listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId) + .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)); + } + }); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineRunCommandInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + final String expand = null; + return service.list(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), expand, 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); + } + } + }); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on 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 PagedList<VirtualMachineRunCommandInner> object if successful. + */ + public PagedList list(final String resourceGroupName, final String vmScaleSetName, final String instanceId, final String expand) { + ServiceResponse> response = listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on 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> listAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable> listAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId, final String expand) { + return listWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceId The instance ID of the virtual machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineRunCommandInner> object + */ + public Observable>> listWithServiceResponseAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId, final String expand) { + return listSinglePageAsync(resourceGroupName, vmScaleSetName, instanceId, expand) + .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)); + } + }); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param vmScaleSetName The name of the VM scale set. + ServiceResponse> * @param instanceId The instance ID of the virtual machine. + ServiceResponse> * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineRunCommandInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String resourceGroupName, final String vmScaleSetName, final String instanceId, final String expand) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmScaleSetName == null) { + throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."); + } + if (instanceId == null) { + throw new IllegalArgumentException("Parameter instanceId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + return service.list(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), expand, 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); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @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<VirtualMachineRunCommandInner> 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(); + } + }; + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @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); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @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<VirtualMachineRunCommandInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + * @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<VirtualMachineRunCommandInner> 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)); + } + }); + } + + /** + * The operation to get all run commands of an instance in Virtual Machine Scaleset. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineRunCommandInner> 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/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVirtualMachineRunCommandImpl.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVirtualMachineRunCommandImpl.java new file mode 100644 index 0000000000000..4247b24d5ba87 --- /dev/null +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachineScaleSetVirtualMachineRunCommandImpl.java @@ -0,0 +1,295 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.v2020_06_01.implementation; + +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineScaleSetVirtualMachineRunCommand; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommandUpdate; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommandScriptSource; +import com.microsoft.azure.management.compute.v2020_06_01.RunCommandInputParameter; +import com.microsoft.azure.management.compute.v2020_06_01.VirtualMachineRunCommandInstanceView; +import rx.functions.Func1; + +class VirtualMachineScaleSetVirtualMachineRunCommandImpl extends CreatableUpdatableImpl implements VirtualMachineScaleSetVirtualMachineRunCommand, VirtualMachineScaleSetVirtualMachineRunCommand.Definition, VirtualMachineScaleSetVirtualMachineRunCommand.Update { + private final ComputeManager manager; + private String resourceGroupName; + private String vmScaleSetName; + private String instanceId; + private String runCommandName; + private VirtualMachineRunCommandUpdate updateParameter; + + VirtualMachineScaleSetVirtualMachineRunCommandImpl(String name, ComputeManager manager) { + super(name, new VirtualMachineRunCommandInner()); + this.manager = manager; + // Set resource name + this.runCommandName = name; + // + this.updateParameter = new VirtualMachineRunCommandUpdate(); + } + + VirtualMachineScaleSetVirtualMachineRunCommandImpl(VirtualMachineRunCommandInner inner, ComputeManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.runCommandName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.vmScaleSetName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualMachineScaleSets"); + this.instanceId = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualMachines"); + this.runCommandName = IdParsingUtils.getValueFromIdByName(inner.id(), "runCommands"); + // + this.updateParameter = new VirtualMachineRunCommandUpdate(); + } + + @Override + public ComputeManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + VirtualMachineScaleSetVMRunCommandsInner client = this.manager().inner().virtualMachineScaleSetVMRunCommands(); + return client.createOrUpdateAsync(this.resourceGroupName, this.vmScaleSetName, this.instanceId, this.runCommandName, this.inner()) + .map(new Func1() { + @Override + public VirtualMachineRunCommandInner call(VirtualMachineRunCommandInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + VirtualMachineScaleSetVMRunCommandsInner client = this.manager().inner().virtualMachineScaleSetVMRunCommands(); + return client.updateAsync(this.resourceGroupName, this.vmScaleSetName, this.instanceId, this.runCommandName, this.updateParameter) + .map(new Func1() { + @Override + public VirtualMachineRunCommandInner call(VirtualMachineRunCommandInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + VirtualMachineScaleSetVMRunCommandsInner client = this.manager().inner().virtualMachineScaleSetVMRunCommands(); + return client.getAsync(this.resourceGroupName, this.vmScaleSetName, this.instanceId, this.runCommandName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new VirtualMachineRunCommandUpdate(); + } + + @Override + public Boolean asyncExecution() { + return this.inner().asyncExecution(); + } + + @Override + public String errorBlobUri() { + return this.inner().errorBlobUri(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public VirtualMachineRunCommandInstanceView instanceView() { + return this.inner().instanceView(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String outputBlobUri() { + return this.inner().outputBlobUri(); + } + + @Override + public List parameters() { + return this.inner().parameters(); + } + + @Override + public List protectedParameters() { + return this.inner().protectedParameters(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String runAsPassword() { + return this.inner().runAsPassword(); + } + + @Override + public String runAsUser() { + return this.inner().runAsUser(); + } + + @Override + public VirtualMachineRunCommandScriptSource source() { + return this.inner().source(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public Integer timeoutInSeconds() { + return this.inner().timeoutInSeconds(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withExistingVirtualmachine(String resourceGroupName, String vmScaleSetName, String instanceId) { + this.resourceGroupName = resourceGroupName; + this.vmScaleSetName = vmScaleSetName; + this.instanceId = instanceId; + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withAsyncExecution(Boolean asyncExecution) { + if (isInCreateMode()) { + this.inner().withAsyncExecution(asyncExecution); + } else { + this.updateParameter.withAsyncExecution(asyncExecution); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withErrorBlobUri(String errorBlobUri) { + if (isInCreateMode()) { + this.inner().withErrorBlobUri(errorBlobUri); + } else { + this.updateParameter.withErrorBlobUri(errorBlobUri); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withOutputBlobUri(String outputBlobUri) { + if (isInCreateMode()) { + this.inner().withOutputBlobUri(outputBlobUri); + } else { + this.updateParameter.withOutputBlobUri(outputBlobUri); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withParameters(List parameters) { + if (isInCreateMode()) { + this.inner().withParameters(parameters); + } else { + this.updateParameter.withParameters(parameters); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withProtectedParameters(List protectedParameters) { + if (isInCreateMode()) { + this.inner().withProtectedParameters(protectedParameters); + } else { + this.updateParameter.withProtectedParameters(protectedParameters); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withRunAsPassword(String runAsPassword) { + if (isInCreateMode()) { + this.inner().withRunAsPassword(runAsPassword); + } else { + this.updateParameter.withRunAsPassword(runAsPassword); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withRunAsUser(String runAsUser) { + if (isInCreateMode()) { + this.inner().withRunAsUser(runAsUser); + } else { + this.updateParameter.withRunAsUser(runAsUser); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withSource(VirtualMachineRunCommandScriptSource source) { + if (isInCreateMode()) { + this.inner().withSource(source); + } else { + this.updateParameter.withSource(source); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + + @Override + public VirtualMachineScaleSetVirtualMachineRunCommandImpl withTimeoutInSeconds(Integer timeoutInSeconds) { + if (isInCreateMode()) { + this.inner().withTimeoutInSeconds(timeoutInSeconds); + } else { + this.updateParameter.withTimeoutInSeconds(timeoutInSeconds); + } + return this; + } + +} diff --git a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachinesInner.java b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachinesInner.java index bebd10bd1fc20..ae0518486094e 100644 --- a/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachinesInner.java +++ b/sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/VirtualMachinesInner.java @@ -103,11 +103,11 @@ interface VirtualMachinesService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2020_06_01.VirtualMachines delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", method = "DELETE", hasBody = true) - Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("forceDeletion") Boolean forceDeletion, @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.compute.v2020_06_01.VirtualMachines beginDelete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", method = "DELETE", hasBody = true) - Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("forceDeletion") Boolean forceDeletion, @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.compute.v2020_06_01.VirtualMachines getByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") @@ -922,7 +922,77 @@ public Observable> deleteWithServiceResponseAsync(String r throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2020-06-01"; - Observable> observable = service.delete(resourceGroupName, vmName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + final Boolean forceDeletion = null; + Observable> observable = service.delete(resourceGroupName, vmName, this.client.subscriptionId(), forceDeletion, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 vmName, Boolean forceDeletion) { + deleteWithServiceResponseAsync(resourceGroupName, vmName, forceDeletion).toBlocking().last().body(); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param serviceCallback 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 vmName, Boolean forceDeletion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, vmName, forceDeletion), serviceCallback); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String vmName, Boolean forceDeletion) { + return deleteWithServiceResponseAsync(resourceGroupName, vmName, forceDeletion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String vmName, Boolean forceDeletion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + Observable> observable = service.delete(resourceGroupName, vmName, this.client.subscriptionId(), forceDeletion, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -988,7 +1058,88 @@ public Observable> beginDeleteWithServiceResponseAsync(Str throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2020-06-01"; - return service.beginDelete(resourceGroupName, vmName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + final Boolean forceDeletion = null; + return service.beginDelete(resourceGroupName, vmName, this.client.subscriptionId(), forceDeletion, 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); + } + } + }); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 vmName, Boolean forceDeletion) { + beginDeleteWithServiceResponseAsync(resourceGroupName, vmName, forceDeletion).toBlocking().single().body(); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @param serviceCallback 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 vmName, Boolean forceDeletion, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, vmName, forceDeletion), serviceCallback); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String vmName, Boolean forceDeletion) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, vmName, forceDeletion).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param forceDeletion Optional parameter to force delete virtual machines. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String vmName, Boolean forceDeletion) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vmName == null) { + throw new IllegalArgumentException("Parameter vmName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2020-06-01"; + return service.beginDelete(resourceGroupName, vmName, this.client.subscriptionId(), forceDeletion, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) {