VirtualMachinesClientImpl.java
// 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.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.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.compute.fluent.VirtualMachinesClient;
import com.azure.resourcemanager.compute.fluent.models.RunCommandResultInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineCaptureResultInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInstanceViewInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineSizeInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineUpdateInner;
import com.azure.resourcemanager.compute.models.ApiErrorException;
import com.azure.resourcemanager.compute.models.InstanceViewTypes;
import com.azure.resourcemanager.compute.models.RunCommandInput;
import com.azure.resourcemanager.compute.models.VirtualMachineCaptureParameters;
import com.azure.resourcemanager.compute.models.VirtualMachineListResult;
import com.azure.resourcemanager.compute.models.VirtualMachineReimageParameters;
import com.azure.resourcemanager.compute.models.VirtualMachineSizeListResult;
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 VirtualMachinesClient. */
public final class VirtualMachinesClientImpl
implements InnerSupportsGet<VirtualMachineInner>,
InnerSupportsListing<VirtualMachineInner>,
InnerSupportsDelete<Void>,
VirtualMachinesClient {
private final ClientLogger logger = new ClientLogger(VirtualMachinesClientImpl.class);
/** The proxy service used to perform REST calls. */
private final VirtualMachinesService service;
/** The service client containing this operation class. */
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of VirtualMachinesClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
VirtualMachinesClientImpl(ComputeManagementClientImpl client) {
this.service =
RestProxy.create(VirtualMachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientVirtualMachines to be used by the proxy
* service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
private interface VirtualMachinesService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineListResult>> listByLocation(
@HostParam("$host") String endpoint,
@PathParam("location") String location,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/capture")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> capture(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineCaptureParameters parameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineInner parameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> update(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineUpdateInner parameters,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}")
@ExpectedResponses({200, 202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> delete(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineInner>> getByResourceGroup(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("$expand") InstanceViewTypes expand,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/instanceView")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineInstanceViewInner>> instanceView(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/convertToManagedDisks")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> convertToManagedDisks(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/deallocate")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> deallocate(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/generalize")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Void>> generalize(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineListResult>> listByResourceGroup(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineListResult>> list(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@QueryParam("statusOnly") String statusOnly,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/vmSizes")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineSizeListResult>> listAvailableSizes(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/powerOff")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> powerOff(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("skipShutdown") Boolean skipShutdown,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/reapply")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ApiErrorException.class)
Mono<Response<Flux<ByteBuffer>>> reapply(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/restart")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> restart(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/start")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> start(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/redeploy")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> redeploy(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/reimage")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> reimage(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineReimageParameters parameters,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/performMaintenance")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> performMaintenance(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/simulateEviction")
@ExpectedResponses({204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Void>> simulateEviction(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json,text/json", "Content-Type: application/json"})
@Post(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/runCommand")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> runCommand(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") RunCommandInput parameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineListResult>> listByLocationNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineListResult>> listNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineListResult>> listAllNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
}
/**
* Gets all the virtual machines under the specified subscription for the specified location.
*
* @param location The location for which virtual machines under the subscription are queried.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the virtual machines under the specified subscription for the specified location.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.listByLocation(
this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), context))
.<PagedResponse<VirtualMachineInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets all the virtual machines under the specified subscription for the specified location.
*
* @param location The location for which virtual machines under the subscription are queried.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the virtual machines under the specified subscription for the specified location.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.listByLocation(this.client.getEndpoint(), location, apiVersion, this.client.getSubscriptionId(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Gets all the virtual machines under the specified subscription for the specified location.
*
* @param location The location for which virtual machines under the subscription are queried.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the virtual machines under the specified subscription for the specified location.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<VirtualMachineInner> listByLocationAsync(String location) {
return new PagedFlux<>(
() -> listByLocationSinglePageAsync(location), nextLink -> listByLocationNextSinglePageAsync(nextLink));
}
/**
* Gets all the virtual machines under the specified subscription for the specified location.
*
* @param location The location for which virtual machines under the subscription are queried.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the virtual machines under the specified subscription for the specified location.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<VirtualMachineInner> listByLocationAsync(String location, Context context) {
return new PagedFlux<>(
() -> listByLocationSinglePageAsync(location, context),
nextLink -> listByLocationNextSinglePageAsync(nextLink, context));
}
/**
* Gets all the virtual machines under the specified subscription for the specified location.
*
* @param location The location for which virtual machines under the subscription are queried.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the virtual machines under the specified subscription for the specified location.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineInner> listByLocation(String location) {
return new PagedIterable<>(listByLocationAsync(location));
}
/**
* Gets all the virtual machines under the specified subscription for the specified location.
*
* @param location The location for which virtual machines under the subscription are queried.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all the virtual machines under the specified subscription for the specified location.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineInner> listByLocation(String location, Context context) {
return new PagedIterable<>(listByLocationAsync(location, context));
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> captureWithResponseAsync(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.capture(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> captureWithResponseAsync(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.capture(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<VirtualMachineCaptureResultInner>, VirtualMachineCaptureResultInner> beginCaptureAsync(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) {
Mono<Response<Flux<ByteBuffer>>> mono = captureWithResponseAsync(resourceGroupName, vmName, parameters);
return this
.client
.<VirtualMachineCaptureResultInner, VirtualMachineCaptureResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineCaptureResultInner.class,
VirtualMachineCaptureResultInner.class,
Context.NONE);
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<VirtualMachineCaptureResultInner>, VirtualMachineCaptureResultInner>
beginCaptureAsync(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
captureWithResponseAsync(resourceGroupName, vmName, parameters, context);
return this
.client
.<VirtualMachineCaptureResultInner, VirtualMachineCaptureResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineCaptureResultInner.class,
VirtualMachineCaptureResultInner.class,
context);
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineCaptureResultInner>, VirtualMachineCaptureResultInner> beginCapture(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) {
return beginCaptureAsync(resourceGroupName, vmName, parameters).getSyncPoller();
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineCaptureResultInner>, VirtualMachineCaptureResultInner> beginCapture(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) {
return beginCaptureAsync(resourceGroupName, vmName, parameters, context).getSyncPoller();
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineCaptureResultInner> captureAsync(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) {
return beginCaptureAsync(resourceGroupName, vmName, parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<VirtualMachineCaptureResultInner> captureAsync(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) {
return beginCaptureAsync(resourceGroupName, vmName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineCaptureResultInner capture(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) {
return captureAsync(resourceGroupName, vmName, parameters).block();
}
/**
* Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar
* VMs.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return output of virtual machine capture operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineCaptureResultInner capture(
String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters, Context context) {
return captureAsync(resourceGroupName, vmName, parameters, context).block();
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName, String vmName, VirtualMachineInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<VirtualMachineInner>, VirtualMachineInner> beginCreateOrUpdateAsync(
String resourceGroupName, String vmName, VirtualMachineInner parameters) {
Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdateWithResponseAsync(resourceGroupName, vmName, parameters);
return this
.client
.<VirtualMachineInner, VirtualMachineInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineInner.class,
VirtualMachineInner.class,
Context.NONE);
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<VirtualMachineInner>, VirtualMachineInner> beginCreateOrUpdateAsync(
String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, vmName, parameters, context);
return this
.client
.<VirtualMachineInner, VirtualMachineInner>getLroResult(
mono, this.client.getHttpPipeline(), VirtualMachineInner.class, VirtualMachineInner.class, context);
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineInner>, VirtualMachineInner> beginCreateOrUpdate(
String resourceGroupName, String vmName, VirtualMachineInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters).getSyncPoller();
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineInner>, VirtualMachineInner> beginCreateOrUpdate(
String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters, context).getSyncPoller();
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineInner> createOrUpdateAsync(
String resourceGroupName, String vmName, VirtualMachineInner parameters) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<VirtualMachineInner> createOrUpdateAsync(
String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineInner createOrUpdate(String resourceGroupName, String vmName, VirtualMachineInner parameters) {
return createOrUpdateAsync(resourceGroupName, vmName, parameters).block();
}
/**
* The operation to create or update a virtual machine. Please note some properties can be set only during virtual
* machine creation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineInner createOrUpdate(
String resourceGroupName, String vmName, VirtualMachineInner parameters, Context context) {
return createOrUpdateAsync(resourceGroupName, vmName, parameters, context).block();
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.update(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<VirtualMachineInner>, VirtualMachineInner> beginUpdateAsync(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) {
Mono<Response<Flux<ByteBuffer>>> mono = updateWithResponseAsync(resourceGroupName, vmName, parameters);
return this
.client
.<VirtualMachineInner, VirtualMachineInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineInner.class,
VirtualMachineInner.class,
Context.NONE);
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<VirtualMachineInner>, VirtualMachineInner> beginUpdateAsync(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = updateWithResponseAsync(resourceGroupName, vmName, parameters, context);
return this
.client
.<VirtualMachineInner, VirtualMachineInner>getLroResult(
mono, this.client.getHttpPipeline(), VirtualMachineInner.class, VirtualMachineInner.class, context);
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineInner>, VirtualMachineInner> beginUpdate(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) {
return beginUpdateAsync(resourceGroupName, vmName, parameters).getSyncPoller();
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineInner>, VirtualMachineInner> beginUpdate(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) {
return beginUpdateAsync(resourceGroupName, vmName, parameters, context).getSyncPoller();
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineInner> updateAsync(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) {
return beginUpdateAsync(resourceGroupName, vmName, parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<VirtualMachineInner> updateAsync(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) {
return beginUpdateAsync(resourceGroupName, vmName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineInner update(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) {
return updateAsync(resourceGroupName, vmName, parameters).block();
}
/**
* The operation to update a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Describes a Virtual Machine Update.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineInner update(
String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters, Context context) {
return updateAsync(resourceGroupName, vmName, parameters, context).block();
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.delete(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeleteAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String vmName) {
return beginDeleteAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String vmName, Context context) {
return beginDeleteAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(String resourceGroupName, String vmName) {
return beginDeleteAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(String resourceGroupName, String vmName, Context context) {
return beginDeleteAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String vmName) {
deleteAsync(resourceGroupName, vmName).block();
}
/**
* The operation to delete a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String vmName, Context context) {
deleteAsync(resourceGroupName, vmName, context).block();
}
/**
* Retrieves information about the model view or the instance view of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param expand The expand expression to apply on the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<VirtualMachineInner>> getByResourceGroupWithResponseAsync(
String resourceGroupName, String vmName, InstanceViewTypes expand) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.getByResourceGroup(
this.client.getEndpoint(),
resourceGroupName,
vmName,
expand,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Retrieves information about the model view or the instance view of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param expand The expand expression to apply on the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<VirtualMachineInner>> getByResourceGroupWithResponseAsync(
String resourceGroupName, String vmName, InstanceViewTypes expand, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.getByResourceGroup(
this.client.getEndpoint(),
resourceGroupName,
vmName,
expand,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Retrieves information about the model view or the instance view of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param expand The expand expression to apply on the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineInner> getByResourceGroupAsync(
String resourceGroupName, String vmName, InstanceViewTypes expand) {
return getByResourceGroupWithResponseAsync(resourceGroupName, vmName, expand)
.flatMap(
(Response<VirtualMachineInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves information about the model view or the instance view of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineInner> getByResourceGroupAsync(String resourceGroupName, String vmName) {
final InstanceViewTypes expand = null;
return getByResourceGroupWithResponseAsync(resourceGroupName, vmName, expand)
.flatMap(
(Response<VirtualMachineInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves information about the model view or the instance view of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineInner getByResourceGroup(String resourceGroupName, String vmName) {
final InstanceViewTypes expand = null;
return getByResourceGroupAsync(resourceGroupName, vmName, expand).block();
}
/**
* Retrieves information about the model view or the instance view of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param expand The expand expression to apply on the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<VirtualMachineInner> getByResourceGroupWithResponse(
String resourceGroupName, String vmName, InstanceViewTypes expand, Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, vmName, expand, context).block();
}
/**
* Retrieves information about the run-time state of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the instance view of a virtual machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<VirtualMachineInstanceViewInner>> instanceViewWithResponseAsync(
String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.instanceView(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Retrieves information about the run-time state of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the instance view of a virtual machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<VirtualMachineInstanceViewInner>> instanceViewWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.instanceView(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Retrieves information about the run-time state of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the instance view of a virtual machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineInstanceViewInner> instanceViewAsync(String resourceGroupName, String vmName) {
return instanceViewWithResponseAsync(resourceGroupName, vmName)
.flatMap(
(Response<VirtualMachineInstanceViewInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Retrieves information about the run-time state of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the instance view of a virtual machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineInstanceViewInner instanceView(String resourceGroupName, String vmName) {
return instanceViewAsync(resourceGroupName, vmName).block();
}
/**
* Retrieves information about the run-time state of a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the instance view of a virtual machine.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<VirtualMachineInstanceViewInner> instanceViewWithResponse(
String resourceGroupName, String vmName, Context context) {
return instanceViewWithResponseAsync(resourceGroupName, vmName, context).block();
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> convertToManagedDisksWithResponseAsync(
String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.convertToManagedDisks(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> convertToManagedDisksWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.convertToManagedDisks(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginConvertToManagedDisksAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = convertToManagedDisksWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginConvertToManagedDisksAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
convertToManagedDisksWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginConvertToManagedDisks(String resourceGroupName, String vmName) {
return beginConvertToManagedDisksAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginConvertToManagedDisks(
String resourceGroupName, String vmName, Context context) {
return beginConvertToManagedDisksAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> convertToManagedDisksAsync(String resourceGroupName, String vmName) {
return beginConvertToManagedDisksAsync(resourceGroupName, vmName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> convertToManagedDisksAsync(String resourceGroupName, String vmName, Context context) {
return beginConvertToManagedDisksAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void convertToManagedDisks(String resourceGroupName, String vmName) {
convertToManagedDisksAsync(resourceGroupName, vmName).block();
}
/**
* Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before
* invoking this operation.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void convertToManagedDisks(String resourceGroupName, String vmName, Context context) {
convertToManagedDisksAsync(resourceGroupName, vmName, context).block();
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deallocateWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.deallocate(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> deallocateWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.deallocate(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDeallocateAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = deallocateWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginDeallocateAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = deallocateWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDeallocate(String resourceGroupName, String vmName) {
return beginDeallocateAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginDeallocate(
String resourceGroupName, String vmName, Context context) {
return beginDeallocateAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deallocateAsync(String resourceGroupName, String vmName) {
return beginDeallocateAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deallocateAsync(String resourceGroupName, String vmName, Context context) {
return beginDeallocateAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deallocate(String resourceGroupName, String vmName) {
deallocateAsync(resourceGroupName, vmName).block();
}
/**
* Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources
* that this virtual machine uses.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deallocate(String resourceGroupName, String vmName, Context context) {
deallocateAsync(resourceGroupName, vmName, context).block();
}
/**
* Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before
* performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in
* Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
* Linux, please refer to [How to create an image of a virtual machine or
* VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> generalizeWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.generalize(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before
* performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in
* Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
* Linux, please refer to [How to create an image of a virtual machine or
* VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> generalizeWithResponseAsync(String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.generalize(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before
* performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in
* Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
* Linux, please refer to [How to create an image of a virtual machine or
* VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> generalizeAsync(String resourceGroupName, String vmName) {
return generalizeWithResponseAsync(resourceGroupName, vmName).flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before
* performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in
* Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
* Linux, please refer to [How to create an image of a virtual machine or
* VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void generalize(String resourceGroupName, String vmName) {
generalizeAsync(resourceGroupName, vmName).block();
}
/**
* Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before
* performing this operation. <br>For Windows, please refer to [Create a managed image of a generalized VM in
* Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/capture-image-resource).<br>For
* Linux, please refer to [How to create an image of a virtual machine or
* VHD](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image).
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> generalizeWithResponse(String resourceGroupName, String vmName, Context context) {
return generalizeWithResponseAsync(resourceGroupName, vmName, context).block();
}
/**
* Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to
* get the next page of virtual machines.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.listByResourceGroup(
this.client.getEndpoint(),
resourceGroupName,
apiVersion,
this.client.getSubscriptionId(),
context))
.<PagedResponse<VirtualMachineInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to
* get the next page of virtual machines.
*
* @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 ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.listByResourceGroup(
this.client.getEndpoint(), resourceGroupName, apiVersion, this.client.getSubscriptionId(), context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to
* get the next page of virtual machines.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<VirtualMachineInner> listByResourceGroupAsync(String resourceGroupName) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to
* get the next page of virtual machines.
*
* @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 ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<VirtualMachineInner> listByResourceGroupAsync(String resourceGroupName, Context context) {
return new PagedFlux<>(
() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to
* get the next page of virtual machines.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineInner> listByResourceGroup(String resourceGroupName) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
}
/**
* Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to
* get the next page of virtual machines.
*
* @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 ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineInner> listByResourceGroup(String resourceGroupName, Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
}
/**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listSinglePageAsync(String statusOnly) {
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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.list(
this.client.getEndpoint(),
apiVersion,
this.client.getSubscriptionId(),
statusOnly,
context))
.<PagedResponse<VirtualMachineInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listSinglePageAsync(String statusOnly, 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), statusOnly, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<VirtualMachineInner> listAsync(String statusOnly) {
return new PagedFlux<>(() -> listSinglePageAsync(statusOnly), nextLink -> listAllNextSinglePageAsync(nextLink));
}
/**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<VirtualMachineInner> listAsync() {
final String statusOnly = null;
return new PagedFlux<>(() -> listSinglePageAsync(statusOnly), nextLink -> listAllNextSinglePageAsync(nextLink));
}
/**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<VirtualMachineInner> listAsync(String statusOnly, Context context) {
return new PagedFlux<>(
() -> listSinglePageAsync(statusOnly, context), nextLink -> listAllNextSinglePageAsync(nextLink, context));
}
/**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineInner> list(String statusOnly, Context context) {
return new PagedIterable<>(listAsync(statusOnly, context));
}
/**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineInner> list() {
final String statusOnly = null;
return new PagedIterable<>(listAsync(statusOnly));
}
/**
* Lists all available virtual machine sizes to which the specified virtual machine can be resized.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineSizeInner>> listAvailableSizesSinglePageAsync(
String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.listAvailableSizes(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.<PagedResponse<VirtualMachineSizeInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all available virtual machine sizes to which the specified virtual machine can be resized.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineSizeInner>> listAvailableSizesSinglePageAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.listAvailableSizes(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null));
}
/**
* Lists all available virtual machine sizes to which the specified virtual machine can be resized.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<VirtualMachineSizeInner> listAvailableSizesAsync(String resourceGroupName, String vmName) {
return new PagedFlux<>(() -> listAvailableSizesSinglePageAsync(resourceGroupName, vmName));
}
/**
* Lists all available virtual machine sizes to which the specified virtual machine can be resized.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<VirtualMachineSizeInner> listAvailableSizesAsync(
String resourceGroupName, String vmName, Context context) {
return new PagedFlux<>(() -> listAvailableSizesSinglePageAsync(resourceGroupName, vmName, context));
}
/**
* Lists all available virtual machine sizes to which the specified virtual machine can be resized.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineSizeInner> listAvailableSizes(String resourceGroupName, String vmName) {
return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, vmName));
}
/**
* Lists all available virtual machine sizes to which the specified virtual machine can be resized.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<VirtualMachineSizeInner> listAvailableSizes(
String resourceGroupName, String vmName, Context context) {
return new PagedIterable<>(listAvailableSizesAsync(resourceGroupName, vmName, context));
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> powerOffWithResponseAsync(
String resourceGroupName, String vmName, Boolean skipShutdown) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.powerOff(
this.client.getEndpoint(),
resourceGroupName,
vmName,
skipShutdown,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> powerOffWithResponseAsync(
String resourceGroupName, String vmName, Boolean skipShutdown, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.powerOff(
this.client.getEndpoint(),
resourceGroupName,
vmName,
skipShutdown,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginPowerOffAsync(
String resourceGroupName, String vmName, Boolean skipShutdown) {
Mono<Response<Flux<ByteBuffer>>> mono = powerOffWithResponseAsync(resourceGroupName, vmName, skipShutdown);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginPowerOffAsync(
String resourceGroupName, String vmName, Boolean skipShutdown, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
powerOffWithResponseAsync(resourceGroupName, vmName, skipShutdown, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginPowerOff(
String resourceGroupName, String vmName, Boolean skipShutdown) {
return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown).getSyncPoller();
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginPowerOff(
String resourceGroupName, String vmName, Boolean skipShutdown, Context context) {
return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown, context).getSyncPoller();
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> powerOffAsync(String resourceGroupName, String vmName, Boolean skipShutdown) {
return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> powerOffAsync(String resourceGroupName, String vmName, Boolean skipShutdown, Context context) {
return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> powerOffAsync(String resourceGroupName, String vmName) {
final Boolean skipShutdown = null;
return beginPowerOffAsync(resourceGroupName, vmName, skipShutdown)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException 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 vmName, Boolean skipShutdown) {
powerOffAsync(resourceGroupName, vmName, skipShutdown).block();
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates
* non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not
* specified.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException 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 vmName, Boolean skipShutdown, Context context) {
powerOffAsync(resourceGroupName, vmName, skipShutdown, context).block();
}
/**
* The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same
* provisioned resources. You are still charged for this virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void powerOff(String resourceGroupName, String vmName) {
final Boolean skipShutdown = null;
powerOffAsync(resourceGroupName, vmName, skipShutdown).block();
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> reapplyWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.reapply(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> reapplyWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.reapply(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginReapplyAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = reapplyWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginReapplyAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = reapplyWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginReapply(String resourceGroupName, String vmName) {
return beginReapplyAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginReapply(String resourceGroupName, String vmName, Context context) {
return beginReapplyAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> reapplyAsync(String resourceGroupName, String vmName) {
return beginReapplyAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> reapplyAsync(String resourceGroupName, String vmName, Context context) {
return beginReapplyAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reapply(String resourceGroupName, String vmName) {
reapplyAsync(resourceGroupName, vmName).block();
}
/**
* The operation to reapply a virtual machine's state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ApiErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reapply(String resourceGroupName, String vmName, Context context) {
reapplyAsync(resourceGroupName, vmName, context).block();
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> restartWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.restart(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> restartWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.restart(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginRestartAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = restartWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginRestartAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = restartWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRestart(String resourceGroupName, String vmName) {
return beginRestartAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRestart(String resourceGroupName, String vmName, Context context) {
return beginRestartAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> restartAsync(String resourceGroupName, String vmName) {
return beginRestartAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> restartAsync(String resourceGroupName, String vmName, Context context) {
return beginRestartAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void restart(String resourceGroupName, String vmName) {
restartAsync(resourceGroupName, vmName).block();
}
/**
* The operation to restart a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void restart(String resourceGroupName, String vmName, Context context) {
restartAsync(resourceGroupName, vmName, context).block();
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> startWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.start(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> startWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.start(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginStartAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = startWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginStartAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = startWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStart(String resourceGroupName, String vmName) {
return beginStartAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginStart(String resourceGroupName, String vmName, Context context) {
return beginStartAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> startAsync(String resourceGroupName, String vmName) {
return beginStartAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> startAsync(String resourceGroupName, String vmName, Context context) {
return beginStartAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void start(String resourceGroupName, String vmName) {
startAsync(resourceGroupName, vmName).block();
}
/**
* The operation to start a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void start(String resourceGroupName, String vmName, Context context) {
startAsync(resourceGroupName, vmName, context).block();
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> redeployWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.redeploy(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> redeployWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.redeploy(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginRedeployAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = redeployWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginRedeployAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = redeployWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRedeploy(String resourceGroupName, String vmName) {
return beginRedeployAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginRedeploy(String resourceGroupName, String vmName, Context context) {
return beginRedeployAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> redeployAsync(String resourceGroupName, String vmName) {
return beginRedeployAsync(resourceGroupName, vmName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> redeployAsync(String resourceGroupName, String vmName, Context context) {
return beginRedeployAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void redeploy(String resourceGroupName, String vmName) {
redeployAsync(resourceGroupName, vmName).block();
}
/**
* Shuts down the virtual machine, moves it to a new node, and powers it back on.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void redeploy(String resourceGroupName, String vmName, Context context) {
redeployAsync(resourceGroupName, vmName, context).block();
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> reimageWithResponseAsync(
String resourceGroupName, String vmName, Boolean tempDisk) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
VirtualMachineReimageParameters parametersInternal = null;
if (tempDisk != null) {
parametersInternal = new VirtualMachineReimageParameters();
parametersInternal.withTempDisk(tempDisk);
}
VirtualMachineReimageParameters parameters = parametersInternal;
return FluxUtil
.withContext(
context ->
service
.reimage(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> reimageWithResponseAsync(
String resourceGroupName, String vmName, Boolean tempDisk, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
VirtualMachineReimageParameters parametersInternal = null;
if (tempDisk != null) {
parametersInternal = new VirtualMachineReimageParameters();
parametersInternal.withTempDisk(tempDisk);
}
VirtualMachineReimageParameters parameters = parametersInternal;
context = this.client.mergeContext(context);
return service
.reimage(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginReimageAsync(
String resourceGroupName, String vmName, Boolean tempDisk) {
Mono<Response<Flux<ByteBuffer>>> mono = reimageWithResponseAsync(resourceGroupName, vmName, tempDisk);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginReimageAsync(
String resourceGroupName, String vmName, Boolean tempDisk, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = reimageWithResponseAsync(resourceGroupName, vmName, tempDisk, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginReimage(String resourceGroupName, String vmName, Boolean tempDisk) {
return beginReimageAsync(resourceGroupName, vmName, tempDisk).getSyncPoller();
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginReimage(
String resourceGroupName, String vmName, Boolean tempDisk, Context context) {
return beginReimageAsync(resourceGroupName, vmName, tempDisk, context).getSyncPoller();
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> reimageAsync(String resourceGroupName, String vmName, Boolean tempDisk) {
return beginReimageAsync(resourceGroupName, vmName, tempDisk)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> reimageAsync(String resourceGroupName, String vmName, Boolean tempDisk, Context context) {
return beginReimageAsync(resourceGroupName, vmName, tempDisk, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> reimageAsync(String resourceGroupName, String vmName) {
final Boolean tempDisk = null;
return beginReimageAsync(resourceGroupName, vmName, tempDisk)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reimage(String resourceGroupName, String vmName, Boolean tempDisk) {
reimageAsync(resourceGroupName, vmName, tempDisk).block();
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage
* parameter is only supported for VM/VMSS with Ephemeral OS disk.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reimage(String resourceGroupName, String vmName, Boolean tempDisk, Context context) {
reimageAsync(resourceGroupName, vmName, tempDisk, context).block();
}
/**
* Reimages the virtual machine which has an ephemeral OS disk back to its initial state.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void reimage(String resourceGroupName, String vmName) {
final Boolean tempDisk = null;
reimageAsync(resourceGroupName, vmName, tempDisk).block();
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> performMaintenanceWithResponseAsync(
String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.performMaintenance(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> performMaintenanceWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.performMaintenance(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginPerformMaintenanceAsync(String resourceGroupName, String vmName) {
Mono<Response<Flux<ByteBuffer>>> mono = performMaintenanceWithResponseAsync(resourceGroupName, vmName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<Void>, Void> beginPerformMaintenanceAsync(
String resourceGroupName, String vmName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono = performMaintenanceWithResponseAsync(resourceGroupName, vmName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginPerformMaintenance(String resourceGroupName, String vmName) {
return beginPerformMaintenanceAsync(resourceGroupName, vmName).getSyncPoller();
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<Void>, Void> beginPerformMaintenance(
String resourceGroupName, String vmName, Context context) {
return beginPerformMaintenanceAsync(resourceGroupName, vmName, context).getSyncPoller();
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> performMaintenanceAsync(String resourceGroupName, String vmName) {
return beginPerformMaintenanceAsync(resourceGroupName, vmName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> performMaintenanceAsync(String resourceGroupName, String vmName, Context context) {
return beginPerformMaintenanceAsync(resourceGroupName, vmName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void performMaintenance(String resourceGroupName, String vmName) {
performMaintenanceAsync(resourceGroupName, vmName).block();
}
/**
* The operation to perform maintenance on a virtual machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void performMaintenance(String resourceGroupName, String vmName, Context context) {
performMaintenanceAsync(resourceGroupName, vmName, context).block();
}
/**
* The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of
* calling the API.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> simulateEvictionWithResponseAsync(String resourceGroupName, String vmName) {
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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.simulateEviction(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of
* calling the API.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> simulateEvictionWithResponseAsync(
String resourceGroupName, String vmName, 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 (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.simulateEviction(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of
* calling the API.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> simulateEvictionAsync(String resourceGroupName, String vmName) {
return simulateEvictionWithResponseAsync(resourceGroupName, vmName)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of
* calling the API.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void simulateEviction(String resourceGroupName, String vmName) {
simulateEvictionAsync(resourceGroupName, vmName).block();
}
/**
* The operation to simulate the eviction of spot virtual machine. The eviction will occur within 30 minutes of
* calling the API.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> simulateEvictionWithResponse(String resourceGroupName, String vmName, Context context) {
return simulateEvictionWithResponseAsync(resourceGroupName, vmName, context).block();
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> runCommandWithResponseAsync(
String resourceGroupName, String vmName, RunCommandInput parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.runCommand(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> runCommandWithResponseAsync(
String resourceGroupName, String vmName, RunCommandInput parameters, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName 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 = "2019-12-01";
context = this.client.mergeContext(context);
return service
.runCommand(
this.client.getEndpoint(),
resourceGroupName,
vmName,
apiVersion,
this.client.getSubscriptionId(),
parameters,
context);
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<RunCommandResultInner>, RunCommandResultInner> beginRunCommandAsync(
String resourceGroupName, String vmName, RunCommandInput parameters) {
Mono<Response<Flux<ByteBuffer>>> mono = runCommandWithResponseAsync(resourceGroupName, vmName, parameters);
return this
.client
.<RunCommandResultInner, RunCommandResultInner>getLroResult(
mono,
this.client.getHttpPipeline(),
RunCommandResultInner.class,
RunCommandResultInner.class,
Context.NONE);
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<RunCommandResultInner>, RunCommandResultInner> beginRunCommandAsync(
String resourceGroupName, String vmName, RunCommandInput parameters, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
runCommandWithResponseAsync(resourceGroupName, vmName, parameters, context);
return this
.client
.<RunCommandResultInner, RunCommandResultInner>getLroResult(
mono, this.client.getHttpPipeline(), RunCommandResultInner.class, RunCommandResultInner.class, context);
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<RunCommandResultInner>, RunCommandResultInner> beginRunCommand(
String resourceGroupName, String vmName, RunCommandInput parameters) {
return beginRunCommandAsync(resourceGroupName, vmName, parameters).getSyncPoller();
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<RunCommandResultInner>, RunCommandResultInner> beginRunCommand(
String resourceGroupName, String vmName, RunCommandInput parameters, Context context) {
return beginRunCommandAsync(resourceGroupName, vmName, parameters, context).getSyncPoller();
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RunCommandResultInner> runCommandAsync(
String resourceGroupName, String vmName, RunCommandInput parameters) {
return beginRunCommandAsync(resourceGroupName, vmName, parameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<RunCommandResultInner> runCommandAsync(
String resourceGroupName, String vmName, RunCommandInput parameters, Context context) {
return beginRunCommandAsync(resourceGroupName, vmName, parameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RunCommandResultInner runCommand(String resourceGroupName, String vmName, RunCommandInput parameters) {
return runCommandAsync(resourceGroupName, vmName, parameters).block();
}
/**
* Run command on the VM.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine.
* @param parameters Capture Virtual Machine parameters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RunCommandResultInner runCommand(
String resourceGroupName, String vmName, RunCommandInput parameters, Context context) {
return runCommandAsync(resourceGroupName, vmName, parameters, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listByLocationNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listByLocationNext(nextLink, context))
.<PagedResponse<VirtualMachineInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listByLocationNextSinglePageAsync(
String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listByLocationNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listNext(nextLink, context))
.<PagedResponse<VirtualMachineInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listAllNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
return FluxUtil
.withContext(context -> service.listAllNext(nextLink, context))
.<PagedResponse<VirtualMachineInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<VirtualMachineInner>> listAllNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
context = this.client.mergeContext(context);
return service
.listAllNext(nextLink, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
}
}