com.azure.resourcemanager.compute.implementation.VirtualMachineScaleSetsClientImpl 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.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.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.VirtualMachineScaleSetsClient;
import com.azure.resourcemanager.compute.fluent.models.RecoveryWalkResponseInner;
import com.azure.resourcemanager.compute.fluent.models.UpgradeOperationHistoricalStatusInfoInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetInstanceViewInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineScaleSetSkuInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
import com.azure.resourcemanager.compute.models.ExpandTypesForGetVMScaleSets;
import com.azure.resourcemanager.compute.models.OrchestrationServiceStateInput;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetListOSUpgradeHistory;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetListResult;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetListSkusResult;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetListWithLinkResult;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetReimageParameters;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetUpdate;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMInstanceIDs;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMInstanceRequiredIDs;
import com.azure.resourcemanager.compute.models.VMScaleSetConvertToSinglePlacementGroupInput;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsDelete;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsGet;
import com.azure.resourcemanager.resources.fluentcore.collection.InnerSupportsListing;
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 VirtualMachineScaleSetsClient.
*/
public final class VirtualMachineScaleSetsClientImpl implements InnerSupportsGet,
InnerSupportsListing, InnerSupportsDelete, VirtualMachineScaleSetsClient {
/**
* The proxy service used to perform REST calls.
*/
private final VirtualMachineScaleSetsService service;
/**
* The service client containing this operation class.
*/
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of VirtualMachineScaleSetsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
VirtualMachineScaleSetsClientImpl(ComputeManagementClientImpl client) {
this.service = RestProxy.create(VirtualMachineScaleSetsService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientVirtualMachineScaleSets to be used by the
* proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
public interface VirtualMachineScaleSetsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listByLocation(@HostParam("$host") String endpoint,
@PathParam("location") String location, @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}")
@ExpectedResponses({ 200, 201 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("If-Match") String ifMatch,
@HeaderParam("If-None-Match") String ifNoneMatch,
@BodyParam("application/json") VirtualMachineScaleSetInner parameters, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("If-Match") String ifMatch,
@HeaderParam("If-None-Match") String ifNoneMatch,
@BodyParam("application/json") VirtualMachineScaleSetUpdate parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @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}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> getByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@QueryParam("$expand") ExpandTypesForGetVMScaleSets expand, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> deallocate(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("hibernate") Boolean hibernate,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> deleteInstances(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("forceDeletion") Boolean forceDeletion,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> getInstanceView(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @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")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> list(@HostParam("$host") String endpoint,
@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}/skus")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listSkus(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @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}/osUpgradeHistory")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> getOSUpgradeHistory(
@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @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}/poweroff")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> powerOff(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("skipShutdown") Boolean skipShutdown,
@QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> restart(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> start(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reapply")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> reapply(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @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}/redeploy")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> redeploy(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> performMaintenance(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> updateInstances(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> reimage(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetReimageParameters vmScaleSetReimageInput,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> reimageAll(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/approveRollingUpgrade")
@ExpectedResponses({ 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> approveRollingUpgrade(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> forceRecoveryServiceFabricPlatformUpdateDomainWalk(
@HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@QueryParam("platformUpdateDomain") int platformUpdateDomain, @QueryParam("zone") String zone,
@QueryParam("placementGroupId") String placementGroupId, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> convertToSinglePlacementGroup(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VMScaleSetConvertToSinglePlacementGroupInput parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> setOrchestrationServiceState(@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmScaleSetName") String vmScaleSetName, @QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") OrchestrationServiceStateInput parameters,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listByLocationNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listAllNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> listSkusNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> getOSUpgradeHistoryNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Gets all the VM scale sets under the specified subscription for the specified location.
*
* @param location The location for which VM scale sets under the subscription are queried.
* @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 all the VM scale sets under the specified subscription for the specified location along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByLocationSinglePageAsync(String location) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required 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.listByLocation(this.client.getEndpoint(), location, 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 all the VM scale sets under the specified subscription for the specified location.
*
* @param location The location for which VM scale sets under the subscription are queried.
* @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 all the VM scale sets under the specified subscription for the specified location along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByLocationSinglePageAsync(String location,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (location == null) {
return Mono.error(new IllegalArgumentException("Parameter location is required 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
.listByLocation(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), accept,
context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Gets all the VM scale sets under the specified subscription for the specified location.
*
* @param location The location for which VM scale sets under the subscription are queried.
* @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 all the VM scale sets under the specified subscription for the specified location as paginated response
* with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByLocationAsync(String location) {
return new PagedFlux<>(() -> listByLocationSinglePageAsync(location),
nextLink -> listByLocationNextSinglePageAsync(nextLink));
}
/**
* Gets all the VM scale sets under the specified subscription for the specified location.
*
* @param location The location for which VM scale sets under the subscription are queried.
* @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 all the VM scale sets under the specified subscription for the specified location as paginated response
* with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByLocationAsync(String location, Context context) {
return new PagedFlux<>(() -> listByLocationSinglePageAsync(location, context),
nextLink -> listByLocationNextSinglePageAsync(nextLink, context));
}
/**
* Gets all the VM scale sets under the specified subscription for the specified location.
*
* @param location The location for which VM scale sets under the subscription are queried.
* @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 all the VM scale sets under the specified subscription for the specified location as paginated response
* with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByLocation(String location) {
return new PagedIterable<>(listByLocationAsync(location));
}
/**
* Gets all the VM scale sets under the specified subscription for the specified location.
*
* @param location The location for which VM scale sets under the subscription are queried.
* @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 all the VM scale sets under the specified subscription for the specified location as paginated response
* with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByLocation(String location, Context context) {
return new PagedIterable<>(listByLocationAsync(location, context));
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetInner 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 (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.createOrUpdate(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
apiVersion, this.client.getSubscriptionId(), ifMatch, ifNoneMatch, parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetInner 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 (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.createOrUpdate(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), ifMatch, ifNoneMatch, parameters, accept, context);
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, VirtualMachineScaleSetInner> beginCreateOrUpdateAsync(
String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, String ifMatch,
String ifNoneMatch) {
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetInner.class, VirtualMachineScaleSetInner.class,
this.client.getContext());
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, VirtualMachineScaleSetInner> beginCreateOrUpdateAsync(
String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetInner.class, VirtualMachineScaleSetInner.class,
this.client.getContext());
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, VirtualMachineScaleSetInner> beginCreateOrUpdateAsync(
String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, String ifMatch,
String ifNoneMatch, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vmScaleSetName,
parameters, ifMatch, ifNoneMatch, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetInner.class, VirtualMachineScaleSetInner.class,
context);
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, VirtualMachineScaleSetInner>
beginCreateOrUpdate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return this.beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch)
.getSyncPoller();
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, VirtualMachineScaleSetInner> beginCreateOrUpdate(
String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetInner parameters, String ifMatch,
String ifNoneMatch, Context context) {
return this
.beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch, context)
.getSyncPoller();
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetInner parameters, String ifMatch, String ifNoneMatch) {
return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetInner parameters, String ifMatch, String ifNoneMatch, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetInner createOrUpdate(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return createOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch).block();
}
/**
* Create or update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetInner createOrUpdate(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetInner parameters, String ifMatch, String ifNoneMatch, Context context) {
return createOrUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch, context)
.block();
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> updateWithResponseAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetUpdate 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 (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,
apiVersion, this.client.getSubscriptionId(), ifMatch, ifNoneMatch, parameters, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetUpdate 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 (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, apiVersion,
this.client.getSubscriptionId(), ifMatch, ifNoneMatch, parameters, accept, context);
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, VirtualMachineScaleSetInner> beginUpdateAsync(
String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, String ifMatch,
String ifNoneMatch) {
Mono>> mono
= updateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetInner.class, VirtualMachineScaleSetInner.class,
this.client.getContext());
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, VirtualMachineScaleSetInner>
beginUpdateAsync(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
Mono>> mono
= updateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetInner.class, VirtualMachineScaleSetInner.class,
this.client.getContext());
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, VirtualMachineScaleSetInner> beginUpdateAsync(
String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, String ifMatch,
String ifNoneMatch, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= updateWithResponseAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch, context);
return this.client.getLroResult(mono,
this.client.getHttpPipeline(), VirtualMachineScaleSetInner.class, VirtualMachineScaleSetInner.class,
context);
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, VirtualMachineScaleSetInner>
beginUpdate(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return this.beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch)
.getSyncPoller();
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, VirtualMachineScaleSetInner> beginUpdate(
String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters, String ifMatch,
String ifNoneMatch, Context context) {
return this.beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch, context)
.getSyncPoller();
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetUpdate parameters, String ifMatch, String ifNoneMatch) {
return beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetUpdate parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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 on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetUpdate parameters, String ifMatch, String ifNoneMatch, Context context) {
return beginUpdateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetInner update(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetUpdate parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
return updateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch).block();
}
/**
* Update a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set to create or update.
* @param parameters The scale set object.
* @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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetInner update(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetUpdate parameters, String ifMatch, String ifNoneMatch, Context context) {
return updateAsync(resourceGroupName, vmScaleSetName, parameters, ifMatch, ifNoneMatch, context).block();
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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,
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 (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,
forceDeletion, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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,
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 (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, forceDeletion, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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,
Boolean forceDeletion) {
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, vmScaleSetName, forceDeletion);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String vmScaleSetName) {
final Boolean forceDeletion = null;
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, vmScaleSetName, forceDeletion);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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,
Boolean forceDeletion, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deleteWithResponseAsync(resourceGroupName, vmScaleSetName, forceDeletion, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String vmScaleSetName) {
final Boolean forceDeletion = null;
return this.beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).getSyncPoller();
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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,
Boolean forceDeletion, Context context) {
return this.beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context).getSyncPoller();
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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, Boolean forceDeletion) {
return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String vmScaleSetName) {
final Boolean forceDeletion = null;
return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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, Boolean forceDeletion,
Context context) {
return beginDeleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String vmScaleSetName) {
final Boolean forceDeletion = null;
deleteAsync(resourceGroupName, vmScaleSetName, forceDeletion).block();
}
/**
* Deletes a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param forceDeletion Optional parameter to force delete 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, Boolean forceDeletion, Context context) {
deleteAsync(resourceGroupName, vmScaleSetName, forceDeletion, context).block();
}
/**
* Display information about a virtual machine scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the
* VM scale set that was provided by the user during the VM scale set Create/Update 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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
String vmScaleSetName, ExpandTypesForGetVMScaleSets 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 (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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, apiVersion, this.client.getSubscriptionId(), expand, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Display information about a virtual machine scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the
* VM scale set that was provided by the user during the VM scale set Create/Update operation.
* @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 along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
String vmScaleSetName, ExpandTypesForGetVMScaleSets 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 (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.getByResourceGroup(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), expand, accept, context);
}
/**
* Display information about a virtual machine scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 describes a Virtual Machine Scale Set on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getByResourceGroupAsync(String resourceGroupName, String vmScaleSetName) {
final ExpandTypesForGetVMScaleSets expand = null;
return getByResourceGroupWithResponseAsync(resourceGroupName, vmScaleSetName, expand)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Display information about a virtual machine scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param expand The expand expression to apply on the operation. 'UserData' retrieves the UserData property of the
* VM scale set that was provided by the user during the VM scale set Create/Update operation.
* @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 along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getByResourceGroupWithResponse(String resourceGroupName,
String vmScaleSetName, ExpandTypesForGetVMScaleSets expand, Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, vmScaleSetName, expand, context).block();
}
/**
* Display information about a virtual machine scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 describes a Virtual Machine Scale Set.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetInner getByResourceGroup(String resourceGroupName, String vmScaleSetName) {
final ExpandTypesForGetVMScaleSets expand = null;
return getByResourceGroupWithResponse(resourceGroupName, vmScaleSetName, expand, Context.NONE).getValue();
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> deallocateWithResponseAsync(String resourceGroupName, String vmScaleSetName,
Boolean hibernate, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.deallocate(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
hibernate, apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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, Boolean hibernate, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.deallocate(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, hibernate, apiVersion,
this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName,
Boolean hibernate, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
Mono>> mono
= deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName) {
final Boolean hibernate = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
Mono>> mono
= deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
Boolean hibernate, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= deallocateWithResponseAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDeallocate(String resourceGroupName, String vmScaleSetName) {
final Boolean hibernate = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return this.beginDeallocateAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs).getSyncPoller();
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
Boolean hibernate, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return this.beginDeallocateAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs, context)
.getSyncPoller();
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deallocateAsync(String resourceGroupName, String vmScaleSetName, Boolean hibernate,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
return beginDeallocateAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deallocateAsync(String resourceGroupName, String vmScaleSetName) {
final Boolean hibernate = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return beginDeallocateAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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, Boolean hibernate,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return beginDeallocateAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deallocate(String resourceGroupName, String vmScaleSetName) {
final Boolean hibernate = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
deallocateAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs).block();
}
/**
* Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute
* resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param hibernate Optional parameter to hibernate a virtual machine from the VM scale set. (This feature is
* available for VMSS with Flexible OrchestrationMode only).
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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, Boolean hibernate,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
deallocateAsync(resourceGroupName, vmScaleSetName, hibernate, vmInstanceIDs, context).block();
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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>> deleteInstancesWithResponseAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs == null) {
return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null."));
} else {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.deleteInstances(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
forceDeletion, apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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>> deleteInstancesWithResponseAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs == null) {
return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null."));
} else {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.deleteInstances(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, forceDeletion,
apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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> beginDeleteInstancesAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion) {
Mono>> mono
= deleteInstancesWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteInstancesAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) {
final Boolean forceDeletion = null;
Mono>> mono
= deleteInstancesWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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> beginDeleteInstancesAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = deleteInstancesWithResponseAsync(resourceGroupName, vmScaleSetName,
vmInstanceIDs, forceDeletion, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDeleteInstances(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) {
final Boolean forceDeletion = null;
return this.beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion)
.getSyncPoller();
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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> beginDeleteInstances(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion, Context context) {
return this.beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context)
.getSyncPoller();
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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 deleteInstancesAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion) {
return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteInstancesAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) {
final Boolean forceDeletion = null;
return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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 deleteInstancesAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion, Context context) {
return beginDeleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deleteInstances(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) {
final Boolean forceDeletion = null;
deleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion).block();
}
/**
* Deletes virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @param forceDeletion Optional parameter to force delete virtual machines from the 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 deleteInstances(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, Boolean forceDeletion, Context context) {
deleteInstancesAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, forceDeletion, context).block();
}
/**
* Gets the status of a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the status of a VM scale set instance along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>
getInstanceViewWithResponseAsync(String resourceGroupName, String vmScaleSetName) {
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 (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, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets the status of a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 VM scale set instance along with {@link Response} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
getInstanceViewWithResponseAsync(String resourceGroupName, String vmScaleSetName, 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 (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, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Gets the status of a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the status of a VM scale set instance on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getInstanceViewAsync(String resourceGroupName,
String vmScaleSetName) {
return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the status of a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 VM scale set instance along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getInstanceViewWithResponse(String resourceGroupName,
String vmScaleSetName, Context context) {
return getInstanceViewWithResponseAsync(resourceGroupName, vmScaleSetName, context).block();
}
/**
* Gets the status of a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the status of a VM scale set instance.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineScaleSetInstanceViewInner getInstanceView(String resourceGroupName, String vmScaleSetName) {
return getInstanceViewWithResponse(resourceGroupName, vmScaleSetName, Context.NONE).getValue();
}
/**
* Gets a list of all VM scale sets under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 VM scale sets under a resource group along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupSinglePageAsync(String resourceGroupName) {
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 (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.listByResourceGroup(this.client.getEndpoint(), resourceGroupName,
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 VM scale sets under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 VM scale sets under a resource group along with {@link PagedResponse} on successful
* completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
listByResourceGroupSinglePageAsync(String resourceGroupName, 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 (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
.listByResourceGroup(this.client.getEndpoint(), resourceGroupName, 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 VM scale sets under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 VM scale sets under a resource group as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByResourceGroupAsync(String resourceGroupName) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName),
nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Gets a list of all VM scale sets under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 VM scale sets under a resource group as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of all VM scale sets under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 VM scale sets under a resource group as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
}
/**
* Gets a list of all VM scale sets under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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 VM scale sets under a resource group as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
}
/**
* Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink
* property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM
* Scale Sets.
*
* @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 VM Scale Sets in the subscription, regardless of the associated resource group along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync() {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
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(), 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 VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink
* property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM
* Scale Sets.
*
* @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 VM Scale Sets in the subscription, regardless of the associated resource group along with
* {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
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(), 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 VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink
* property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM
* Scale Sets.
*
* @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 VM Scale Sets in the subscription, regardless of the associated resource group as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAsync() {
return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink));
}
/**
* Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink
* property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM
* Scale Sets.
*
* @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 VM Scale Sets in the subscription, regardless of the associated resource group as paginated
* response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(context),
nextLink -> listAllNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink
* property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM
* Scale Sets.
*
* @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 VM Scale Sets in the subscription, regardless of the associated resource group as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list() {
return new PagedIterable<>(listAsync());
}
/**
* Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use nextLink
* property in the response to get the next page of VM Scale Sets. Do this till nextLink is null to fetch all the VM
* Scale Sets.
*
* @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 VM Scale Sets in the subscription, regardless of the associated resource group as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(Context context) {
return new PagedIterable<>(listAsync(context));
}
/**
* Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for
* each SKU.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed
* for each SKU along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSkusSinglePageAsync(String resourceGroupName,
String vmScaleSetName) {
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 (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.listSkus(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for
* each SKU.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed
* for each SKU along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSkusSinglePageAsync(String resourceGroupName,
String vmScaleSetName, 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 (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
.listSkus(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, 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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for
* each SKU.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed
* for each SKU as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listSkusAsync(String resourceGroupName, String vmScaleSetName) {
return new PagedFlux<>(() -> listSkusSinglePageAsync(resourceGroupName, vmScaleSetName),
nextLink -> listSkusNextSinglePageAsync(nextLink));
}
/**
* Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for
* each SKU.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed
* for each SKU as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listSkusAsync(String resourceGroupName, String vmScaleSetName,
Context context) {
return new PagedFlux<>(() -> listSkusSinglePageAsync(resourceGroupName, vmScaleSetName, context),
nextLink -> listSkusNextSinglePageAsync(nextLink, context));
}
/**
* Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for
* each SKU.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed
* for each SKU as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listSkus(String resourceGroupName, String vmScaleSetName) {
return new PagedIterable<>(listSkusAsync(resourceGroupName, vmScaleSetName));
}
/**
* Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for
* each SKU.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 SKUs available for your VM scale set, including the minimum and maximum VM instances allowed
* for each SKU as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listSkus(String resourceGroupName, String vmScaleSetName,
Context context) {
return new PagedIterable<>(listSkusAsync(resourceGroupName, vmScaleSetName, context));
}
/**
* Gets list of OS upgrades on a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 list of OS upgrades on a VM scale set instance along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
getOSUpgradeHistorySinglePageAsync(String resourceGroupName, String vmScaleSetName) {
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 (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.getOSUpgradeHistory(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, 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 list of OS upgrades on a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 list of OS upgrades on a VM scale set instance along with {@link PagedResponse} on successful completion
* of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>
getOSUpgradeHistorySinglePageAsync(String resourceGroupName, String vmScaleSetName, 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 (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
.getOSUpgradeHistory(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Gets list of OS upgrades on a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 list of OS upgrades on a VM scale set instance as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux getOSUpgradeHistoryAsync(String resourceGroupName,
String vmScaleSetName) {
return new PagedFlux<>(() -> getOSUpgradeHistorySinglePageAsync(resourceGroupName, vmScaleSetName),
nextLink -> getOSUpgradeHistoryNextSinglePageAsync(nextLink));
}
/**
* Gets list of OS upgrades on a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 list of OS upgrades on a VM scale set instance as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux getOSUpgradeHistoryAsync(String resourceGroupName,
String vmScaleSetName, Context context) {
return new PagedFlux<>(() -> getOSUpgradeHistorySinglePageAsync(resourceGroupName, vmScaleSetName, context),
nextLink -> getOSUpgradeHistoryNextSinglePageAsync(nextLink, context));
}
/**
* Gets list of OS upgrades on a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 list of OS upgrades on a VM scale set instance as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable getOSUpgradeHistory(String resourceGroupName,
String vmScaleSetName) {
return new PagedIterable<>(getOSUpgradeHistoryAsync(resourceGroupName, vmScaleSetName));
}
/**
* Gets list of OS upgrades on a VM scale set instance.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 list of OS upgrades on a VM scale set instance as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable getOSUpgradeHistory(String resourceGroupName,
String vmScaleSetName, Context context) {
return new PagedIterable<>(getOSUpgradeHistoryAsync(resourceGroupName, vmScaleSetName, context));
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> powerOffWithResponseAsync(String resourceGroupName, String vmScaleSetName,
Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.powerOff(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
skipShutdown, apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.powerOff(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, skipShutdown, apiVersion,
this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginPowerOffAsync(String resourceGroupName, String vmScaleSetName,
Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
Mono>> mono
= powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Power off (stop) one or more virtual machines 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.
* @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) {
final Boolean skipShutdown = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
Mono>> mono
= powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= powerOffWithResponseAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Power off (stop) one or more virtual machines 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.
* @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) {
final Boolean skipShutdown = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return this.beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs).getSyncPoller();
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
Boolean skipShutdown, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return this.beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context)
.getSyncPoller();
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono powerOffAsync(String resourceGroupName, String vmScaleSetName, Boolean skipShutdown,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Power off (stop) one or more virtual machines 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.
* @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) {
final Boolean skipShutdown = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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, Boolean skipShutdown,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return beginPowerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Power off (stop) one or more virtual machines 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.
* @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) {
final Boolean skipShutdown = null;
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
powerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs).block();
}
/**
* Power off (stop) one or more virtual machines 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 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 vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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, Boolean skipShutdown,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
powerOffAsync(resourceGroupName, vmScaleSetName, skipShutdown, vmInstanceIDs, context).block();
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> restartWithResponseAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.restart(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.restart(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRestartAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
Mono>> mono
= restartWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRestartAsync(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
Mono>> mono
= restartWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= restartWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRestart(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return this.beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller();
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return this.beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller();
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono restartAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono restartAsync(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return beginRestartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void restart(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
restartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block();
}
/**
* Restarts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
restartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block();
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> startWithResponseAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.start(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.start(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginStartAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
Mono>> mono
= startWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginStartAsync(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
Mono>> mono
= startWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= startWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginStart(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return this.beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller();
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return this.beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller();
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono startAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono startAsync(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return beginStartAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void start(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
startAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block();
}
/**
* Starts one or more virtual machines in a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
startAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block();
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> reapplyWithResponseAsync(String resourceGroupName, String vmScaleSetName) {
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 (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.reapply(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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>> reapplyWithResponseAsync(String resourceGroupName, String vmScaleSetName,
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 (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.reapply(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginReapplyAsync(String resourceGroupName, String vmScaleSetName) {
Mono>> mono = reapplyWithResponseAsync(resourceGroupName, vmScaleSetName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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> beginReapplyAsync(String resourceGroupName, String vmScaleSetName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = reapplyWithResponseAsync(resourceGroupName, vmScaleSetName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginReapply(String resourceGroupName, String vmScaleSetName) {
return this.beginReapplyAsync(resourceGroupName, vmScaleSetName).getSyncPoller();
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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> beginReapply(String resourceGroupName, String vmScaleSetName,
Context context) {
return this.beginReapplyAsync(resourceGroupName, vmScaleSetName, context).getSyncPoller();
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono reapplyAsync(String resourceGroupName, String vmScaleSetName) {
return beginReapplyAsync(resourceGroupName, vmScaleSetName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 reapplyAsync(String resourceGroupName, String vmScaleSetName, Context context) {
return beginReapplyAsync(resourceGroupName, vmScaleSetName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reapply(String resourceGroupName, String vmScaleSetName) {
reapplyAsync(resourceGroupName, vmScaleSetName).block();
}
/**
* Reapplies the Virtual Machine Scale Set Virtual Machine Profile to the Virtual Machine Instances.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @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 reapply(String resourceGroupName, String vmScaleSetName, Context context) {
reapplyAsync(resourceGroupName, vmScaleSetName, context).block();
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> redeployWithResponseAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.redeploy(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.redeploy(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRedeployAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
Mono>> mono
= redeployWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRedeployAsync(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
Mono>> mono
= redeployWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= redeployWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRedeploy(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return this.beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller();
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return this.beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).getSyncPoller();
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono redeployAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono redeployAsync(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return beginRedeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void redeploy(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
redeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block();
}
/**
* Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, and powers them
* back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
redeployAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block();
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> performMaintenanceWithResponseAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.performMaintenance(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs != null) {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.performMaintenance(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginPerformMaintenanceAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
Mono>> mono
= performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginPerformMaintenanceAsync(String resourceGroupName,
String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
Mono>> mono
= performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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, VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= performMaintenanceWithResponseAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginPerformMaintenance(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return this.beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).getSyncPoller();
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return this.beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context)
.getSyncPoller();
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono performMaintenanceAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs) {
return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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 {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono performMaintenanceAsync(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
return beginPerformMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName 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.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void performMaintenance(String resourceGroupName, String vmScaleSetName) {
final VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
performMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs).block();
}
/**
* Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not
* eligible for perform maintenance will be failed. Please refer to best practices for more details:
* https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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,
VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, Context context) {
performMaintenanceAsync(resourceGroupName, vmScaleSetName, vmInstanceIDs, context).block();
}
/**
* Upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> updateInstancesWithResponseAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) {
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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs == null) {
return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null."));
} else {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.updateInstances(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, apiVersion, this.client.getSubscriptionId(), vmInstanceIDs, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from the VM scale set.
* @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>> updateInstancesWithResponseAsync(String resourceGroupName,
String vmScaleSetName, VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, 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 (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (vmInstanceIDs == null) {
return Mono.error(new IllegalArgumentException("Parameter vmInstanceIDs is required and cannot be null."));
} else {
vmInstanceIDs.validate();
}
final String apiVersion = "2024-07-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.updateInstances(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), vmInstanceIDs, accept, context);
}
/**
* Upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param vmInstanceIDs A list of virtual machine instance IDs from 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 the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginUpdateInstancesAsync(String resourceGroupName, String vmScaleSetName,
VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs) {
Mono