com.azure.resourcemanager.compute.implementation.VirtualMachineScaleSetRollingUpgradesClientImpl 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.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.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.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.VirtualMachineScaleSetRollingUpgradesClient;
import com.azure.resourcemanager.compute.fluent.models.RollingUpgradeStatusInfoInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
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
* VirtualMachineScaleSetRollingUpgradesClient.
*/
public final class VirtualMachineScaleSetRollingUpgradesClientImpl
implements VirtualMachineScaleSetRollingUpgradesClient {
/**
* The proxy service used to perform REST calls.
*/
private final VirtualMachineScaleSetRollingUpgradesService service;
/**
* The service client containing this operation class.
*/
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of VirtualMachineScaleSetRollingUpgradesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
VirtualMachineScaleSetRollingUpgradesClientImpl(ComputeManagementClientImpl client) {
this.service = RestProxy.create(VirtualMachineScaleSetRollingUpgradesService.class, client.getHttpPipeline(),
client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientVirtualMachineScaleSetRollingUpgrades to be
* used by the proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
public interface VirtualMachineScaleSetRollingUpgradesService {
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> cancel(@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}/osRollingUpgrade")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> startOSUpgrade(@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}/extensionRollingUpgrade")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono>> startExtensionUpgrade(@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}/rollingUpgrades/latest")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono> getLatest(@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);
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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>> cancelWithResponseAsync(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.cancel(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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>> cancelWithResponseAsync(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.cancel(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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> beginCancelAsync(String resourceGroupName, String vmScaleSetName) {
Mono>> mono = cancelWithResponseAsync(resourceGroupName, vmScaleSetName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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> beginCancelAsync(String resourceGroupName, String vmScaleSetName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = cancelWithResponseAsync(resourceGroupName, vmScaleSetName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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> beginCancel(String resourceGroupName, String vmScaleSetName) {
return this.beginCancelAsync(resourceGroupName, vmScaleSetName).getSyncPoller();
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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> beginCancel(String resourceGroupName, String vmScaleSetName,
Context context) {
return this.beginCancelAsync(resourceGroupName, vmScaleSetName, context).getSyncPoller();
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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 cancelAsync(String resourceGroupName, String vmScaleSetName) {
return beginCancelAsync(resourceGroupName, vmScaleSetName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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 cancelAsync(String resourceGroupName, String vmScaleSetName, Context context) {
return beginCancelAsync(resourceGroupName, vmScaleSetName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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 cancel(String resourceGroupName, String vmScaleSetName) {
cancelAsync(resourceGroupName, vmScaleSetName).block();
}
/**
* Cancels the current virtual machine scale set rolling upgrade.
*
* @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 cancel(String resourceGroupName, String vmScaleSetName, Context context) {
cancelAsync(resourceGroupName, vmScaleSetName, context).block();
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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>> startOSUpgradeWithResponseAsync(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.startOSUpgrade(this.client.getEndpoint(), resourceGroupName, vmScaleSetName,
apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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>> startOSUpgradeWithResponseAsync(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.startOSUpgrade(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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> beginStartOSUpgradeAsync(String resourceGroupName,
String vmScaleSetName) {
Mono>> mono = startOSUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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> beginStartOSUpgradeAsync(String resourceGroupName, String vmScaleSetName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= startOSUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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> beginStartOSUpgrade(String resourceGroupName, String vmScaleSetName) {
return this.beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName).getSyncPoller();
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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> beginStartOSUpgrade(String resourceGroupName, String vmScaleSetName,
Context context) {
return this.beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName, context).getSyncPoller();
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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 startOSUpgradeAsync(String resourceGroupName, String vmScaleSetName) {
return beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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 startOSUpgradeAsync(String resourceGroupName, String vmScaleSetName, Context context) {
return beginStartOSUpgradeAsync(resourceGroupName, vmScaleSetName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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 startOSUpgrade(String resourceGroupName, String vmScaleSetName) {
startOSUpgradeAsync(resourceGroupName, vmScaleSetName).block();
}
/**
* Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image
* OS version. Instances which are already running the latest available OS version are not affected.
*
* @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 startOSUpgrade(String resourceGroupName, String vmScaleSetName, Context context) {
startOSUpgradeAsync(resourceGroupName, vmScaleSetName, context).block();
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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>> startExtensionUpgradeWithResponseAsync(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.startExtensionUpgrade(this.client.getEndpoint(), resourceGroupName,
vmScaleSetName, apiVersion, this.client.getSubscriptionId(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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>> startExtensionUpgradeWithResponseAsync(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.startExtensionUpgrade(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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> beginStartExtensionUpgradeAsync(String resourceGroupName,
String vmScaleSetName) {
Mono>> mono
= startExtensionUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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> beginStartExtensionUpgradeAsync(String resourceGroupName,
String vmScaleSetName, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= startExtensionUpgradeWithResponseAsync(resourceGroupName, vmScaleSetName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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> beginStartExtensionUpgrade(String resourceGroupName,
String vmScaleSetName) {
return this.beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).getSyncPoller();
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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> beginStartExtensionUpgrade(String resourceGroupName,
String vmScaleSetName, Context context) {
return this.beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName, context).getSyncPoller();
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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 startExtensionUpgradeAsync(String resourceGroupName, String vmScaleSetName) {
return beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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 startExtensionUpgradeAsync(String resourceGroupName, String vmScaleSetName, Context context) {
return beginStartExtensionUpgradeAsync(resourceGroupName, vmScaleSetName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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 startExtensionUpgrade(String resourceGroupName, String vmScaleSetName) {
startExtensionUpgradeAsync(resourceGroupName, vmScaleSetName).block();
}
/**
* Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest
* available extension version. Instances which are already running the latest extension versions are not affected.
*
* @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 startExtensionUpgrade(String resourceGroupName, String vmScaleSetName, Context context) {
startExtensionUpgradeAsync(resourceGroupName, vmScaleSetName, context).block();
}
/**
* Gets the status of the latest virtual machine scale set rolling upgrade.
*
* @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 the latest virtual machine scale set rolling upgrade along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getLatestWithResponseAsync(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.getLatest(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 the latest virtual machine scale set rolling upgrade.
*
* @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 the latest virtual machine scale set rolling upgrade along with {@link Response} on
* successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getLatestWithResponseAsync(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.getLatest(this.client.getEndpoint(), resourceGroupName, vmScaleSetName, apiVersion,
this.client.getSubscriptionId(), accept, context);
}
/**
* Gets the status of the latest virtual machine scale set rolling upgrade.
*
* @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 the latest virtual machine scale set rolling upgrade on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getLatestAsync(String resourceGroupName, String vmScaleSetName) {
return getLatestWithResponseAsync(resourceGroupName, vmScaleSetName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets the status of the latest virtual machine scale set rolling upgrade.
*
* @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 the latest virtual machine scale set rolling upgrade along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getLatestWithResponse(String resourceGroupName,
String vmScaleSetName, Context context) {
return getLatestWithResponseAsync(resourceGroupName, vmScaleSetName, context).block();
}
/**
* Gets the status of the latest virtual machine scale set rolling upgrade.
*
* @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 the latest virtual machine scale set rolling upgrade.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RollingUpgradeStatusInfoInner getLatest(String resourceGroupName, String vmScaleSetName) {
return getLatestWithResponse(resourceGroupName, vmScaleSetName, Context.NONE).getValue();
}
}