com.azure.resourcemanager.compute.implementation.VirtualMachineScaleSetVMsClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.compute.fluent.VirtualMachineScaleSetVMsClient;
import com.azure.resourcemanager.compute.fluent.models.RetrieveBootDiagnosticsDataResultInner;
import com.azure.resourcemanager.compute.fluent.models.RunCommandResultInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetVMInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetVMInstanceViewInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
import com.azure.resourcemanager.compute.models.AttachDetachDataDisksRequest;
import com.azure.resourcemanager.compute.models.InstanceViewTypes;
import com.azure.resourcemanager.compute.models.RunCommandInput;
import com.azure.resourcemanager.compute.models.StorageProfile;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMListResult;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMReimageParameters;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in VirtualMachineScaleSetVMsClient.
*/
public final class VirtualMachineScaleSetVMsClientImpl implements VirtualMachineScaleSetVMsClient {
/**
* The proxy service used to perform REST calls.
*/
private final VirtualMachineScaleSetVMsService service;
/**
* The service client containing this operation class.
*/
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of VirtualMachineScaleSetVMsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
VirtualMachineScaleSetVMsClientImpl(ComputeManagementClientImpl client) {
this.service = RestProxy.create(VirtualMachineScaleSetVMsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientVirtualMachineScaleSetVMs to be used by the
* proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
public interface VirtualMachineScaleSetVMsService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimage")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> reimage(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/reimageall")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> reimageAll(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/approveRollingUpgrade")
@ExpectedResponses({ 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> approveRollingUpgrade(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/deallocate")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> deallocate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch,
@BodyParam("application/json") VirtualMachineScaleSetVMInner parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("forceDeletion") Boolean forceDeletion, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("$expand") InstanceViewTypes expand, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/instanceView")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> getInstanceView(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("virtualMachineScaleSetName") String virtualMachineScaleSetName,
@QueryParam("$filter") String filter, @QueryParam("$select") String select,
@QueryParam("$expand") String expand, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> powerOff(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("skipShutdown") Boolean skipShutdown, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> restart(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> start(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> redeploy(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> retrieveBootDiagnosticsData(
@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("sasUriExpirationTimeInMinutes") Integer sasUriExpirationTimeInMinutes,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> performMaintenance(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction")
@ExpectedResponses({ 204 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> simulateEviction(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/attachDetachDataDisks")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> attachDetachDataDisks(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@BodyParam("application/json") AttachDetachDataDisksRequest parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> runCommand(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @PathParam("instanceId") String instanceId,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") RunCommandInput parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> reimageWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmScaleSetVMReimageInput != null) {
vmScaleSetVMReimageInput.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.reimage(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, apiVersion, this.client.getSubscriptionId(), vmScaleSetVMReimageInput, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> reimageWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmScaleSetVMReimageInput != null) {
vmScaleSetVMReimageInput.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.reimage(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), vmScaleSetVMReimageInput, accept, context);
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginReimageAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) {
Mono>> mono
= reimageWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginReimageAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
final VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = null;
Mono>> mono
= reimageWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginReimageAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = reimageWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId,
vmScaleSetVMReimageInput, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginReimage(String resourceGroupName, String vmScaleSetName,
String instanceId) {
final VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = null;
return this.beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput)
.getSyncPoller();
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginReimage(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, Context context) {
return this.beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context)
.getSyncPoller();
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono reimageAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput) {
return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono reimageAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
final VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = null;
return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono reimageAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, Context context) {
return beginReimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reimage(String resourceGroupName, String vmScaleSetName, String instanceId) {
final VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput = null;
reimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput).block();
}
/**
* Reimages (upgrade the operating system) a specific virtual machine in a VM scale set.
*
* @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 vmScaleSetVMReimageInput Parameters for the Reimaging Virtual machine in ScaleSet.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reimage(String resourceGroupName, String vmScaleSetName, String instanceId,
VirtualMachineScaleSetVMReimageParameters vmScaleSetVMReimageInput, Context context) {
reimageAsync(resourceGroupName, vmScaleSetName, instanceId, vmScaleSetVMReimageInput, context).block();
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> reimageAllWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.reimageAll(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> reimageAllWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.reimageAll(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginReimageAllAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
Mono>> mono
= reimageAllWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginReimageAllAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= reimageAllWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginReimageAll(String resourceGroupName, String vmScaleSetName,
String instanceId) {
return this.beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller();
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginReimageAll(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
return this.beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller();
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono reimageAllAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono reimageAllAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
return beginReimageAllAsync(resourceGroupName, vmScaleSetName, instanceId, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId) {
reimageAllAsync(resourceGroupName, vmScaleSetName, instanceId).block();
}
/**
* Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is
* only supported for managed disks.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reimageAll(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) {
reimageAllAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> approveRollingUpgradeWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.approveRollingUpgrade(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> approveRollingUpgradeWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.approveRollingUpgrade(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginApproveRollingUpgradeAsync(String resourceGroupName,
String vmScaleSetName, String instanceId) {
Mono>> mono
= approveRollingUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginApproveRollingUpgradeAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= approveRollingUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginApproveRollingUpgrade(String resourceGroupName,
String vmScaleSetName, String instanceId) {
return this.beginApproveRollingUpgradeAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller();
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginApproveRollingUpgrade(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
return this.beginApproveRollingUpgradeAsync(resourceGroupName, vmScaleSetName, instanceId, context)
.getSyncPoller();
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono approveRollingUpgradeAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return beginApproveRollingUpgradeAsync(resourceGroupName, vmScaleSetName, instanceId).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono approveRollingUpgradeAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
return beginApproveRollingUpgradeAsync(resourceGroupName, vmScaleSetName, instanceId, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void approveRollingUpgrade(String resourceGroupName, String vmScaleSetName, String instanceId) {
approveRollingUpgradeAsync(resourceGroupName, vmScaleSetName, instanceId).block();
}
/**
* Approve upgrade on deferred rolling upgrade for OS disk on a VM scale set instance.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void approveRollingUpgrade(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
approveRollingUpgradeAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> deallocateWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.deallocate(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deallocateWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.deallocate(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
Mono>> mono
= deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDeallocate(String resourceGroupName, String vmScaleSetName,
String instanceId) {
return this.beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller();
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDeallocate(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
return this.beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller();
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deallocateAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deallocateAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
return beginDeallocateAsync(resourceGroupName, vmScaleSetName, instanceId, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deallocate(String resourceGroupName, String vmScaleSetName, String instanceId) {
deallocateAsync(resourceGroupName, vmScaleSetName, instanceId).block();
}
/**
* Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute
* resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deallocate(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) {
deallocateAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a virtual machine scale set virtual machine along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> updateWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMInner parameters, String ifMatch, String ifNoneMatch) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.update(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId,
apiVersion, this.client.getSubscriptionId(), ifMatch, ifNoneMatch, parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a virtual machine scale set virtual machine along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMInner parameters, String ifMatch, String ifNoneMatch,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), ifMatch, ifNoneMatch, parameters, accept, context);
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of describes a virtual machine scale set virtual machine.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, VirtualMachineScaleSetVMInner> beginUpdateAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters,
String ifMatch, String ifNoneMatch) {
Mono>> mono
= updateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetVMInner.class, VirtualMachineScaleSetVMInner.class,
this.client.getContext());
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of describes a virtual machine scale set virtual machine.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, VirtualMachineScaleSetVMInner> beginUpdateAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
Mono>> mono
= updateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetVMInner.class, VirtualMachineScaleSetVMInner.class,
this.client.getContext());
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of describes a virtual machine scale set virtual machine.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, VirtualMachineScaleSetVMInner> beginUpdateAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters,
String ifMatch, String ifNoneMatch, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = updateWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId,
parameters, ifMatch, ifNoneMatch, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetVMInner.class, VirtualMachineScaleSetVMInner.class,
context);
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of describes a virtual machine scale set virtual machine.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, VirtualMachineScaleSetVMInner> beginUpdate(
String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return this.beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch)
.getSyncPoller();
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of describes a virtual machine scale set virtual machine.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, VirtualMachineScaleSetVMInner> beginUpdate(
String resourceGroupName, String vmScaleSetName, String instanceId, VirtualMachineScaleSetVMInner parameters,
String ifMatch, String ifNoneMatch, Context context) {
return this
.beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch, context)
.getSyncPoller();
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a virtual machine scale set virtual machine on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMInner parameters, String ifMatch, String ifNoneMatch) {
return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a virtual machine scale set virtual machine on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a virtual machine scale set virtual machine on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, VirtualMachineScaleSetVMInner parameters, String ifMatch, String ifNoneMatch,
Context context) {
return beginUpdateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch,
context).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a virtual machine scale set virtual machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetVMInner update(String resourceGroupName, String vmScaleSetName, String instanceId,
VirtualMachineScaleSetVMInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return updateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch).block();
}
/**
* Updates a virtual machine of a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set where the extension should be create or updated.
* @param instanceId The instance ID of the virtual machine.
* @param parameters Parameters supplied to the Update Virtual Machine Scale Sets VM operation.
* @param ifMatch The ETag of the transformation. Omit this value to always overwrite the current resource. Specify
* the last-seen ETag value to prevent accidentally overwriting concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will result in error from server as they are not supported.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a virtual machine scale set virtual machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetVMInner update(String resourceGroupName, String vmScaleSetName, String instanceId,
VirtualMachineScaleSetVMInner parameters, String ifMatch, String ifNoneMatch, Context context) {
return updateAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, ifMatch, ifNoneMatch, context)
.block();
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> deleteWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean forceDeletion) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, forceDeletion, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean forceDeletion, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, forceDeletion,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean forceDeletion) {
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
final Boolean forceDeletion = null;
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean forceDeletion, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String vmScaleSetName,
String instanceId) {
final Boolean forceDeletion = null;
return this.beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).getSyncPoller();
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean forceDeletion, Context context) {
return this.beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context)
.getSyncPoller();
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Boolean forceDeletion) {
return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
final Boolean forceDeletion = null;
return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Boolean forceDeletion, Context context) {
return beginDeleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String vmScaleSetName, String instanceId) {
final Boolean forceDeletion = null;
deleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion).block();
}
/**
* Deletes a virtual machine from a VM scale set.
*
* @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 forceDeletion Optional parameter to force delete a virtual machine from a VM scale set. (Feature in
* Preview).
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean forceDeletion,
Context context) {
deleteAsync(resourceGroupName, vmScaleSetName, instanceId, forceDeletion, context).block();
}
/**
* Gets a virtual machine from a VM scale set.
*
* @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. 'InstanceView' will retrieve the instance view of
* the virtual machine. 'UserData' will retrieve the UserData of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a virtual machine from a VM scale set along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, InstanceViewTypes expand) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, expand, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a virtual machine from a VM scale set.
*
* @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. 'InstanceView' will retrieve the instance view of
* the virtual machine. 'UserData' will retrieve the UserData of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a virtual machine from a VM scale set along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, InstanceViewTypes expand, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, expand, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Gets a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a virtual machine from a VM scale set on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
final InstanceViewTypes expand = null;
return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a virtual machine from a VM scale set.
*
* @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. 'InstanceView' will retrieve the instance view of
* the virtual machine. 'UserData' will retrieve the UserData of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a virtual machine from a VM scale set along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String vmScaleSetName,
String instanceId, InstanceViewTypes expand, Context context) {
return getWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, expand, context).block();
}
/**
* Gets a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a virtual machine from a VM scale set.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetVMInner get(String resourceGroupName, String vmScaleSetName, String instanceId) {
final InstanceViewTypes expand = null;
return getWithResponse(resourceGroupName, vmScaleSetName, instanceId, expand, Context.NONE).getValue();
}
/**
* Gets the status of a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the status of a virtual machine from a VM scale set along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>
getInstanceViewWithResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.getInstanceView(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the status of a virtual machine from a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the status of a virtual machine from a VM scale set along with {@link Response} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getInstanceViewWithResponseAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getInstanceView(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* Gets the status of a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the status of a virtual machine from a VM scale set on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getInstanceViewAsync(String resourceGroupName,
String vmScaleSetName, String instanceId) {
return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the status of a virtual machine from a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the status of a virtual machine from a VM scale set along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getInstanceViewWithResponse(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* Gets the status of a virtual machine from a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the status of a virtual machine from a VM scale set.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetVMInstanceViewInner getInstanceView(String resourceGroupName, String vmScaleSetName,
String instanceId) {
return getInstanceViewWithResponse(resourceGroupName, vmScaleSetName, instanceId, Context.NONE).getValue();
}
/**
* Gets a list of all virtual machines in a VM scale sets.
*
* @param resourceGroupName The name of the resource group.
* @param virtualMachineScaleSetName The name of the VM scale set.
* @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code,
* 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.
* @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.
* @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of all virtual machines in a VM scale sets along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName,
String virtualMachineScaleSetName, String filter, String select, String expand) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (virtualMachineScaleSetName == null) {
return Mono.error(
new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.list(this.client.getEndpoint(), resourceGroupName, virtualMachineScaleSetName,
filter, select, expand, apiVersion, this.client.getSubscriptionId(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a list of all virtual machines in a VM scale sets.
*
* @param resourceGroupName The name of the resource group.
* @param virtualMachineScaleSetName The name of the VM scale set.
* @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code,
* 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.
* @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.
* @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of all virtual machines in a VM scale sets along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(String resourceGroupName,
String virtualMachineScaleSetName, String filter, String select, String expand, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (virtualMachineScaleSetName == null) {
return Mono.error(
new IllegalArgumentException("Parameter virtualMachineScaleSetName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), resourceGroupName, virtualMachineScaleSetName, filter, select, expand,
apiVersion, this.client.getSubscriptionId(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Gets a list of all virtual machines in a VM scale sets.
*
* @param resourceGroupName The name of the resource group.
* @param virtualMachineScaleSetName The name of the VM scale set.
* @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code,
* 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.
* @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.
* @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of all virtual machines in a VM scale sets as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAsync(String resourceGroupName,
String virtualMachineScaleSetName, String filter, String select, String expand) {
return new PagedFlux<>(
() -> listSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Gets a list of all virtual machines in a VM scale sets.
*
* @param resourceGroupName The name of the resource group.
* @param virtualMachineScaleSetName The name of the VM scale set.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of all virtual machines in a VM scale sets as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAsync(String resourceGroupName,
String virtualMachineScaleSetName) {
final String filter = null;
final String select = null;
final String expand = null;
return new PagedFlux<>(
() -> listSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Gets a list of all virtual machines in a VM scale sets.
*
* @param resourceGroupName The name of the resource group.
* @param virtualMachineScaleSetName The name of the VM scale set.
* @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code,
* 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.
* @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.
* @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of all virtual machines in a VM scale sets as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(String resourceGroupName,
String virtualMachineScaleSetName, String filter, String select, String expand, Context context) {
return new PagedFlux<>(
() -> listSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of all virtual machines in a VM scale sets.
*
* @param resourceGroupName The name of the resource group.
* @param virtualMachineScaleSetName The name of the VM scale set.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of all virtual machines in a VM scale sets as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName,
String virtualMachineScaleSetName) {
final String filter = null;
final String select = null;
final String expand = null;
return new PagedIterable<>(listAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand));
}
/**
* Gets a list of all virtual machines in a VM scale sets.
*
* @param resourceGroupName The name of the resource group.
* @param virtualMachineScaleSetName The name of the VM scale set.
* @param filter The filter to apply to the operation. Allowed values are 'startswith(instanceView/statuses/code,
* 'PowerState') eq true', 'properties/latestModelApplied eq true', 'properties/latestModelApplied eq false'.
* @param select The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'.
* @param expand The expand expression to apply to the operation. Allowed values are 'instanceView'.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of all virtual machines in a VM scale sets as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(String resourceGroupName,
String virtualMachineScaleSetName, String filter, String select, String expand, Context context) {
return new PagedIterable<>(
listAsync(resourceGroupName, virtualMachineScaleSetName, filter, select, expand, context));
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> powerOffWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean skipShutdown) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.powerOff(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, skipShutdown, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> powerOffWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean skipShutdown, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.powerOff(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, skipShutdown,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginPowerOffAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean skipShutdown) {
Mono>> mono
= powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginPowerOffAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
final Boolean skipShutdown = null;
Mono>> mono
= powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginPowerOffAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean skipShutdown, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginPowerOff(String resourceGroupName, String vmScaleSetName,
String instanceId) {
final Boolean skipShutdown = null;
return this.beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).getSyncPoller();
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginPowerOff(String resourceGroupName, String vmScaleSetName,
String instanceId, Boolean skipShutdown, Context context) {
return this.beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context)
.getSyncPoller();
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono powerOffAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Boolean skipShutdown) {
return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono powerOffAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
final Boolean skipShutdown = null;
return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono powerOffAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Boolean skipShutdown, Context context) {
return beginPowerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void powerOff(String resourceGroupName, String vmScaleSetName, String instanceId) {
final Boolean skipShutdown = null;
powerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown).block();
}
/**
* Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting
* charged for the resources. Instead, use deallocate to release resources and avoid charges.
*
* @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 skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void powerOff(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown,
Context context) {
powerOffAsync(resourceGroupName, vmScaleSetName, instanceId, skipShutdown, context).block();
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> restartWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.restart(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> restartWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.restart(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRestartAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
Mono>> mono = restartWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= restartWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRestart(String resourceGroupName, String vmScaleSetName,
String instanceId) {
return this.beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller();
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRestart(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
return this.beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller();
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono restartAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono restartAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
return beginRestartAsync(resourceGroupName, vmScaleSetName, instanceId, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void restart(String resourceGroupName, String vmScaleSetName, String instanceId) {
restartAsync(resourceGroupName, vmScaleSetName, instanceId).block();
}
/**
* Restarts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void restart(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) {
restartAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> startWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.start(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> startWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.start(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginStartAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
Mono>> mono = startWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginStartAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= startWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginStart(String resourceGroupName, String vmScaleSetName,
String instanceId) {
return this.beginStartAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller();
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginStart(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
return this.beginStartAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller();
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono startAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return beginStartAsync(resourceGroupName, vmScaleSetName, instanceId).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono startAsync(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) {
return beginStartAsync(resourceGroupName, vmScaleSetName, instanceId, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void start(String resourceGroupName, String vmScaleSetName, String instanceId) {
startAsync(resourceGroupName, vmScaleSetName, instanceId).block();
}
/**
* Starts a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void start(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) {
startAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> redeployWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.redeploy(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> redeployWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.redeploy(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRedeployAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
Mono>> mono
= redeployWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginRedeployAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= redeployWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRedeploy(String resourceGroupName, String vmScaleSetName,
String instanceId) {
return this.beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller();
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRedeploy(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
return this.beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId, context).getSyncPoller();
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono redeployAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono redeployAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
return beginRedeployAsync(resourceGroupName, vmScaleSetName, instanceId, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void redeploy(String resourceGroupName, String vmScaleSetName, String instanceId) {
redeployAsync(resourceGroupName, vmScaleSetName, instanceId).block();
}
/**
* Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void redeploy(String resourceGroupName, String vmScaleSetName, String instanceId, Context context) {
redeployAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set.
*
* @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 sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to
* 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a default expiration duration of 120
* minutes.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> retrieveBootDiagnosticsDataWithResponseAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, Integer sasUriExpirationTimeInMinutes) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.retrieveBootDiagnosticsData(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, instanceId, sasUriExpirationTimeInMinutes, apiVersion, this.client.getSubscriptionId(),
accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set.
*
* @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 sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to
* 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a default expiration duration of 120
* minutes.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> retrieveBootDiagnosticsDataWithResponseAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, Integer sasUriExpirationTimeInMinutes,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.retrieveBootDiagnosticsData(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, sasUriExpirationTimeInMinutes, apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the SAS URIs of the console screenshot and serial log blobs on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono retrieveBootDiagnosticsDataAsync(String resourceGroupName,
String vmScaleSetName, String instanceId) {
final Integer sasUriExpirationTimeInMinutes = null;
return retrieveBootDiagnosticsDataWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId,
sasUriExpirationTimeInMinutes).flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set.
*
* @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 sasUriExpirationTimeInMinutes Expiration duration in minutes for the SAS URIs with a value between 1 to
* 1440 minutes. **Note:** If not specified, SAS URIs will be generated with a default expiration duration of 120
* minutes.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the SAS URIs of the console screenshot and serial log blobs along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response retrieveBootDiagnosticsDataWithResponse(
String resourceGroupName, String vmScaleSetName, String instanceId, Integer sasUriExpirationTimeInMinutes,
Context context) {
return retrieveBootDiagnosticsDataWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId,
sasUriExpirationTimeInMinutes, context).block();
}
/**
* The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the SAS URIs of the console screenshot and serial log blobs.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RetrieveBootDiagnosticsDataResultInner retrieveBootDiagnosticsData(String resourceGroupName,
String vmScaleSetName, String instanceId) {
final Integer sasUriExpirationTimeInMinutes = null;
return retrieveBootDiagnosticsDataWithResponse(resourceGroupName, vmScaleSetName, instanceId,
sasUriExpirationTimeInMinutes, Context.NONE).getValue();
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> performMaintenanceWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.performMaintenance(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> performMaintenanceWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.performMaintenance(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginPerformMaintenanceAsync(String resourceGroupName,
String vmScaleSetName, String instanceId) {
Mono>> mono
= performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginPerformMaintenanceAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginPerformMaintenance(String resourceGroupName, String vmScaleSetName,
String instanceId) {
return this.beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).getSyncPoller();
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginPerformMaintenance(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
return this.beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId, context)
.getSyncPoller();
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId) {
performMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId).block();
}
/**
* Performs maintenance on a virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId,
Context context) {
performMaintenanceAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* The operation to simulate the eviction of spot virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> simulateEvictionWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.simulateEviction(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, instanceId, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* The operation to simulate the eviction of spot virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> simulateEvictionWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.simulateEviction(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId,
apiVersion, this.client.getSubscriptionId(), accept, context);
}
/**
* The operation to simulate the eviction of spot virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono simulateEvictionAsync(String resourceGroupName, String vmScaleSetName, String instanceId) {
return simulateEvictionWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId)
.flatMap(ignored -> Mono.empty());
}
/**
* The operation to simulate the eviction of spot virtual machine in a VM scale set.
*
* @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 context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response simulateEvictionWithResponse(String resourceGroupName, String vmScaleSetName,
String instanceId, Context context) {
return simulateEvictionWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, context).block();
}
/**
* The operation to simulate the eviction of spot virtual machine in a VM scale set.
*
* @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 ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void simulateEviction(String resourceGroupName, String vmScaleSetName, String instanceId) {
simulateEvictionWithResponse(resourceGroupName, vmScaleSetName, instanceId, Context.NONE);
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies the storage settings for the virtual machine disks along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> attachDetachDataDisksWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, AttachDetachDataDisksRequest parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.attachDetachDataDisks(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, instanceId, this.client.getSubscriptionId(), apiVersion, parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies the storage settings for the virtual machine disks along with {@link Response} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> attachDetachDataDisksWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, AttachDetachDataDisksRequest parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.attachDetachDataDisks(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId,
this.client.getSubscriptionId(), apiVersion, parameters, accept, context);
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of specifies the storage settings for the virtual machine disks.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, StorageProfile> beginAttachDetachDataDisksAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, AttachDetachDataDisksRequest parameters) {
Mono>> mono
= attachDetachDataDisksWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
StorageProfile.class, StorageProfile.class, this.client.getContext());
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of specifies the storage settings for the virtual machine disks.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, StorageProfile> beginAttachDetachDataDisksAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, AttachDetachDataDisksRequest parameters,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = attachDetachDataDisksWithResponseAsync(resourceGroupName,
vmScaleSetName, instanceId, parameters, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
StorageProfile.class, StorageProfile.class, context);
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of specifies the storage settings for the virtual machine disks.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, StorageProfile> beginAttachDetachDataDisks(String resourceGroupName,
String vmScaleSetName, String instanceId, AttachDetachDataDisksRequest parameters) {
return this.beginAttachDetachDataDisksAsync(resourceGroupName, vmScaleSetName, instanceId, parameters)
.getSyncPoller();
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of specifies the storage settings for the virtual machine disks.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, StorageProfile> beginAttachDetachDataDisks(String resourceGroupName,
String vmScaleSetName, String instanceId, AttachDetachDataDisksRequest parameters, Context context) {
return this.beginAttachDetachDataDisksAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context)
.getSyncPoller();
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies the storage settings for the virtual machine disks on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono attachDetachDataDisksAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, AttachDetachDataDisksRequest parameters) {
return beginAttachDetachDataDisksAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies the storage settings for the virtual machine disks on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono attachDetachDataDisksAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, AttachDetachDataDisksRequest parameters, Context context) {
return beginAttachDetachDataDisksAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies the storage settings for the virtual machine disks.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public StorageProfile attachDetachDataDisks(String resourceGroupName, String vmScaleSetName, String instanceId,
AttachDetachDataDisksRequest parameters) {
return attachDetachDataDisksAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).block();
}
/**
* Attach and detach data disks to/from a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the attach and detach data disks operation on a Virtual Machine Scale
* Sets VM.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return specifies the storage settings for the virtual machine disks.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public StorageProfile attachDetachDataDisks(String resourceGroupName, String vmScaleSetName, String instanceId,
AttachDetachDataDisksRequest parameters, Context context) {
return attachDetachDataDisksAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context).block();
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> runCommandWithResponseAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, RunCommandInput parameters) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json, text/json";
return FluxUtil
.withContext(context -> service.runCommand(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
instanceId, apiVersion, this.client.getSubscriptionId(), parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> runCommandWithResponseAsync(String resourceGroupName,
String vmScaleSetName, String instanceId, RunCommandInput parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmScaleSetName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null."));
}
if (instanceId == null) {
return Mono.error(new IllegalArgumentException("Parameter instanceId is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json, text/json";
context = this.client.mergeContext(context);
return service.runCommand(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, instanceId, apiVersion,
this.client.getSubscriptionId(), parameters, accept, context);
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, RunCommandResultInner> beginRunCommandAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) {
Mono>> mono
= runCommandWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), RunCommandResultInner.class, RunCommandResultInner.class,
this.client.getContext());
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, RunCommandResultInner> beginRunCommandAsync(
String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= runCommandWithResponseAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), RunCommandResultInner.class, RunCommandResultInner.class, context);
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, RunCommandResultInner> beginRunCommand(
String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters) {
return this.beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).getSyncPoller();
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, RunCommandResultInner> beginRunCommand(
String resourceGroupName, String vmScaleSetName, String instanceId, RunCommandInput parameters,
Context context) {
return this.beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context)
.getSyncPoller();
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono runCommandAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, RunCommandInput parameters) {
return beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response body on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono runCommandAsync(String resourceGroupName, String vmScaleSetName,
String instanceId, RunCommandInput parameters, Context context) {
return beginRunCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RunCommandResultInner runCommand(String resourceGroupName, String vmScaleSetName, String instanceId,
RunCommandInput parameters) {
return runCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters).block();
}
/**
* Run command on a virtual machine in a VM scale set.
*
* @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 parameters Parameters supplied to the Run command operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RunCommandResultInner runCommand(String resourceGroupName, String vmScaleSetName, String instanceId,
RunCommandInput parameters, Context context) {
return runCommandAsync(resourceGroupName, vmScaleSetName, instanceId, parameters, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine Scale Set VMs operation response along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(),
res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine Scale Set VMs operation response along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink,
Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}