VirtualMachineExtensionsClientImpl.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.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.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.VirtualMachineExtensionsClient;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineExtensionInner;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachineExtensionsListResultInner;
import com.azure.resourcemanager.compute.models.VirtualMachineExtensionUpdate;
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 VirtualMachineExtensionsClient. */
public final class VirtualMachineExtensionsClientImpl implements VirtualMachineExtensionsClient {
private final ClientLogger logger = new ClientLogger(VirtualMachineExtensionsClientImpl.class);
/** The proxy service used to perform REST calls. */
private final VirtualMachineExtensionsService service;
/** The service client containing this operation class. */
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of VirtualMachineExtensionsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
VirtualMachineExtensionsClientImpl(ComputeManagementClientImpl client) {
this.service =
RestProxy
.create(VirtualMachineExtensionsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientVirtualMachineExtensions to be used by the
* proxy service to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
private interface VirtualMachineExtensionsService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/extensions/{vmExtensionName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@PathParam("vmExtensionName") String vmExtensionName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineExtensionInner extensionParameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/extensions/{vmExtensionName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> update(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@PathParam("vmExtensionName") String vmExtensionName,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") VirtualMachineExtensionUpdate extensionParameters,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute"
+ "/virtualMachines/{vmName}/extensions/{vmExtensionName}")
@ExpectedResponses({200, 202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<Flux<ByteBuffer>>> delete(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@PathParam("vmExtensionName") String vmExtensionName,
@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}/extensions/{vmExtensionName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineExtensionInner>> get(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@PathParam("vmExtensionName") String vmExtensionName,
@QueryParam("$expand") String 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}/extensions")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<VirtualMachineExtensionsListResultInner>> list(
@HostParam("$host") String endpoint,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("vmName") String vmName,
@QueryParam("$expand") String expand,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters) {
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 (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) {
return Mono
.error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null."));
} else {
extensionParameters.validate();
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
vmName,
vmExtensionName,
apiVersion,
this.client.getSubscriptionId(),
extensionParameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters,
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 (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) {
return Mono
.error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null."));
} else {
extensionParameters.validate();
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
vmName,
vmExtensionName,
apiVersion,
this.client.getSubscriptionId(),
extensionParameters,
context);
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters) {
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters);
return this
.client
.<VirtualMachineExtensionInner, VirtualMachineExtensionInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineExtensionInner.class,
VirtualMachineExtensionInner.class,
Context.NONE);
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginCreateOrUpdateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context);
return this
.client
.<VirtualMachineExtensionInner, VirtualMachineExtensionInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineExtensionInner.class,
VirtualMachineExtensionInner.class,
context);
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginCreateOrUpdate(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters)
.getSyncPoller();
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginCreateOrUpdate(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters,
Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context)
.getSyncPoller();
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineExtensionInner> createOrUpdateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<VirtualMachineExtensionInner> createOrUpdateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters,
Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineExtensionInner createOrUpdate(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters) {
return createOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).block();
}
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineExtensionInner createOrUpdate(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters,
Context context) {
return createOrUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context).block();
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters) {
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 (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) {
return Mono
.error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null."));
} else {
extensionParameters.validate();
}
final String apiVersion = "2019-12-01";
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getEndpoint(),
resourceGroupName,
vmName,
vmExtensionName,
apiVersion,
this.client.getSubscriptionId(),
extensionParameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters,
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 (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) {
return Mono
.error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null."));
} else {
extensionParameters.validate();
}
final String apiVersion = "2019-12-01";
context = this.client.mergeContext(context);
return service
.update(
this.client.getEndpoint(),
resourceGroupName,
vmName,
vmExtensionName,
apiVersion,
this.client.getSubscriptionId(),
extensionParameters,
context);
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginUpdateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters) {
Mono<Response<Flux<ByteBuffer>>> mono =
updateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters);
return this
.client
.<VirtualMachineExtensionInner, VirtualMachineExtensionInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineExtensionInner.class,
VirtualMachineExtensionInner.class,
Context.NONE);
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private PollerFlux<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginUpdateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters,
Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
updateWithResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context);
return this
.client
.<VirtualMachineExtensionInner, VirtualMachineExtensionInner>getLroResult(
mono,
this.client.getHttpPipeline(),
VirtualMachineExtensionInner.class,
VirtualMachineExtensionInner.class,
context);
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginUpdate(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters) {
return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).getSyncPoller();
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<VirtualMachineExtensionInner>, VirtualMachineExtensionInner> beginUpdate(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters,
Context context) {
return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context)
.getSyncPoller();
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineExtensionInner> updateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters) {
return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<VirtualMachineExtensionInner> updateAsync(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters,
Context context) {
return beginUpdateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineExtensionInner update(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters) {
return updateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).block();
}
/**
* The operation to update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Describes a Virtual Machine Extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineExtensionInner update(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionUpdate extensionParameters,
Context context) {
return updateAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters, context).block();
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName) {
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 (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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,
vmExtensionName,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName, 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 (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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,
vmExtensionName,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName) {
Mono<Response<Flux<ByteBuffer>>> mono = deleteWithResponseAsync(resourceGroupName, vmName, vmExtensionName);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE);
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
deleteWithResponseAsync(resourceGroupName, vmName, vmExtensionName, context);
return this
.client
.<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName) {
return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName).getSyncPoller();
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName, Context context) {
return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName, context).getSyncPoller();
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName) {
return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName, Context context) {
return beginDeleteAsync(resourceGroupName, vmName, vmExtensionName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName) {
deleteAsync(resourceGroupName, vmName, vmExtensionName).block();
}
/**
* The operation to delete the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be deleted.
* @param vmExtensionName The name of the virtual machine extension.
* @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, String vmExtensionName, Context context) {
deleteAsync(resourceGroupName, vmName, vmExtensionName, context).block();
}
/**
* The operation to get the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @param vmExtensionName The name of the virtual machine extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<VirtualMachineExtensionInner>> getWithResponseAsync(
String resourceGroupName, String vmName, String vmExtensionName, String expand) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null."));
}
if (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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
.get(
this.client.getEndpoint(),
resourceGroupName,
vmName,
vmExtensionName,
expand,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to get the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @param vmExtensionName The name of the virtual machine extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<VirtualMachineExtensionInner>> getWithResponseAsync(
String resourceGroupName, String vmName, String vmExtensionName, String expand, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (vmName == null) {
return Mono.error(new IllegalArgumentException("Parameter vmName is required and cannot be null."));
}
if (vmExtensionName == null) {
return Mono
.error(new IllegalArgumentException("Parameter vmExtensionName 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
.get(
this.client.getEndpoint(),
resourceGroupName,
vmName,
vmExtensionName,
expand,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to get the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @param vmExtensionName The name of the virtual machine extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineExtensionInner> getAsync(
String resourceGroupName, String vmName, String vmExtensionName, String expand) {
return getWithResponseAsync(resourceGroupName, vmName, vmExtensionName, expand)
.flatMap(
(Response<VirtualMachineExtensionInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* The operation to get the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @param vmExtensionName The name of the virtual machine extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineExtensionInner> getAsync(
String resourceGroupName, String vmName, String vmExtensionName) {
final String expand = null;
return getWithResponseAsync(resourceGroupName, vmName, vmExtensionName, expand)
.flatMap(
(Response<VirtualMachineExtensionInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* The operation to get the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @param vmExtensionName The name of the virtual machine extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineExtensionInner get(String resourceGroupName, String vmName, String vmExtensionName) {
final String expand = null;
return getAsync(resourceGroupName, vmName, vmExtensionName, expand).block();
}
/**
* The operation to get the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @param vmExtensionName The name of the virtual machine extension.
* @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 Extension.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<VirtualMachineExtensionInner> getWithResponse(
String resourceGroupName, String vmName, String vmExtensionName, String expand, Context context) {
return getWithResponseAsync(resourceGroupName, vmName, vmExtensionName, expand, context).block();
}
/**
* The operation to get all extensions of a Virtual Machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @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 the List Extension operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<VirtualMachineExtensionsListResultInner>> listWithResponseAsync(
String resourceGroupName, String vmName, String expand) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (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
.list(
this.client.getEndpoint(),
resourceGroupName,
vmName,
expand,
apiVersion,
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* The operation to get all extensions of a Virtual Machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @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 the List Extension operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<VirtualMachineExtensionsListResultInner>> listWithResponseAsync(
String resourceGroupName, String vmName, String expand, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (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
.list(
this.client.getEndpoint(),
resourceGroupName,
vmName,
expand,
apiVersion,
this.client.getSubscriptionId(),
context);
}
/**
* The operation to get all extensions of a Virtual Machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @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 the List Extension operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineExtensionsListResultInner> listAsync(
String resourceGroupName, String vmName, String expand) {
return listWithResponseAsync(resourceGroupName, vmName, expand)
.flatMap(
(Response<VirtualMachineExtensionsListResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* The operation to get all extensions of a Virtual Machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @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 Extension operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<VirtualMachineExtensionsListResultInner> listAsync(String resourceGroupName, String vmName) {
final String expand = null;
return listWithResponseAsync(resourceGroupName, vmName, expand)
.flatMap(
(Response<VirtualMachineExtensionsListResultInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* The operation to get all extensions of a Virtual Machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @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 Extension operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public VirtualMachineExtensionsListResultInner list(String resourceGroupName, String vmName) {
final String expand = null;
return listAsync(resourceGroupName, vmName, expand).block();
}
/**
* The operation to get all extensions of a Virtual Machine.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine containing the extension.
* @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 the List Extension operation response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<VirtualMachineExtensionsListResultInner> listWithResponse(
String resourceGroupName, String vmName, String expand, Context context) {
return listWithResponseAsync(resourceGroupName, vmName, expand, context).block();
}
}