com.azure.resourcemanager.compute.implementation.DisksClientImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.implementation;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.compute.fluent.DisksClient;
import com.azure.resourcemanager.compute.fluent.models.AccessUriInner;
import com.azure.resourcemanager.compute.fluent.models.DiskInner;
import com.azure.resourcemanager.compute.models.DiskList;
import com.azure.resourcemanager.compute.models.DiskUpdate;
import com.azure.resourcemanager.compute.models.GrantAccessData;
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 DisksClient.
*/
public final class DisksClientImpl
implements InnerSupportsGet, InnerSupportsListing, InnerSupportsDelete, DisksClient {
/**
* The proxy service used to perform REST calls.
*/
private final DisksService service;
/**
* The service client containing this operation class.
*/
private final ComputeManagementClientImpl client;
/**
* Initializes an instance of DisksClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
DisksClientImpl(ComputeManagementClientImpl client) {
this.service = RestProxy.create(DisksService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ComputeManagementClientDisks to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "ComputeManagementCli")
public interface DisksService {
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName,
@QueryParam("api-version") String apiVersion, @BodyParam("application/json") DiskInner disk,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> update(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName,
@QueryParam("api-version") String apiVersion, @BodyParam("application/json") DiskUpdate disk,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> getByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}")
@ExpectedResponses({ 200, 202, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName,
@QueryParam("api-version") String apiVersion, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroup(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> list(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> grantAccess(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") GrantAccessData grantAccessData, @HeaderParam("Accept") String accept,
Context context);
@Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" })
@Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess")
@ExpectedResponses({ 200, 202 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> revokeAccess(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskName") String diskName,
@QueryParam("api-version") String apiVersion, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByResourceGroupNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context);
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk 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 disk resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String diskName,
DiskInner disk) {
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
if (disk == null) {
return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null."));
} else {
disk.validate();
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, diskName, apiVersion, disk, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk 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 disk resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String diskName,
DiskInner disk, 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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
if (disk == null) {
return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null."));
} else {
disk.validate();
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
diskName, apiVersion, disk, accept, context);
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DiskInner> beginCreateOrUpdateAsync(String resourceGroupName,
String diskName, DiskInner disk) {
Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, diskName, disk);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), DiskInner.class,
DiskInner.class, this.client.getContext());
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DiskInner> beginCreateOrUpdateAsync(String resourceGroupName,
String diskName, DiskInner disk, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= createOrUpdateWithResponseAsync(resourceGroupName, diskName, disk, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), DiskInner.class,
DiskInner.class, context);
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName,
DiskInner disk) {
return this.beginCreateOrUpdateAsync(resourceGroupName, diskName, disk).getSyncPoller();
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DiskInner> beginCreateOrUpdate(String resourceGroupName, String diskName,
DiskInner disk, Context context) {
return this.beginCreateOrUpdateAsync(resourceGroupName, diskName, disk, context).getSyncPoller();
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk 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 disk resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono createOrUpdateAsync(String resourceGroupName, String diskName, DiskInner disk) {
return beginCreateOrUpdateAsync(resourceGroupName, diskName, disk).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk 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 disk resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String diskName, DiskInner disk,
Context context) {
return beginCreateOrUpdateAsync(resourceGroupName, diskName, disk, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk 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 disk resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner disk) {
return createOrUpdateAsync(resourceGroupName, diskName, disk).block();
}
/**
* Creates or updates a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Put disk 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 disk resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DiskInner createOrUpdate(String resourceGroupName, String diskName, DiskInner disk, Context context) {
return createOrUpdateAsync(resourceGroupName, diskName, disk, context).block();
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk 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 disk resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> updateWithResponseAsync(String resourceGroupName, String diskName,
DiskUpdate disk) {
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
if (disk == null) {
return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null."));
} else {
disk.validate();
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, diskName, apiVersion, disk, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk 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 disk resource along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> updateWithResponseAsync(String resourceGroupName, String diskName,
DiskUpdate disk, 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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
if (disk == null) {
return Mono.error(new IllegalArgumentException("Parameter disk is required and cannot be null."));
} else {
disk.validate();
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, diskName,
apiVersion, disk, accept, context);
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, DiskInner> beginUpdateAsync(String resourceGroupName, String diskName,
DiskUpdate disk) {
Mono>> mono = updateWithResponseAsync(resourceGroupName, diskName, disk);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), DiskInner.class,
DiskInner.class, this.client.getContext());
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, DiskInner> beginUpdateAsync(String resourceGroupName, String diskName,
DiskUpdate disk, Context context) {
context = this.client.mergeContext(context);
Mono>> mono = updateWithResponseAsync(resourceGroupName, diskName, disk, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), DiskInner.class,
DiskInner.class, context);
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DiskInner> beginUpdate(String resourceGroupName, String diskName,
DiskUpdate disk) {
return this.beginUpdateAsync(resourceGroupName, diskName, disk).getSyncPoller();
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of disk resource.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, DiskInner> beginUpdate(String resourceGroupName, String diskName,
DiskUpdate disk, Context context) {
return this.beginUpdateAsync(resourceGroupName, diskName, disk, context).getSyncPoller();
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk 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 disk resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono updateAsync(String resourceGroupName, String diskName, DiskUpdate disk) {
return beginUpdateAsync(resourceGroupName, diskName, disk).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk 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 disk resource on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono updateAsync(String resourceGroupName, String diskName, DiskUpdate disk, Context context) {
return beginUpdateAsync(resourceGroupName, diskName, disk, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk 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 disk resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DiskInner update(String resourceGroupName, String diskName, DiskUpdate disk) {
return updateAsync(resourceGroupName, diskName, disk).block();
}
/**
* Updates (patches) a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param disk Disk object supplied in the body of the Patch disk 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 disk resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DiskInner update(String resourceGroupName, String diskName, DiskUpdate disk, Context context) {
return updateAsync(resourceGroupName, diskName, disk, context).block();
}
/**
* Gets information about a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 information about a disk along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String diskName) {
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.getByResourceGroup(this.client.getEndpoint(),
this.client.getSubscriptionId(), resourceGroupName, diskName, apiVersion, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets information about a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 information about a disk along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String diskName,
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
diskName, apiVersion, accept, context);
}
/**
* Gets information about a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 information about a disk on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono getByResourceGroupAsync(String resourceGroupName, String diskName) {
return getByResourceGroupWithResponseAsync(resourceGroupName, diskName)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets information about a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 information about a disk along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getByResourceGroupWithResponse(String resourceGroupName, String diskName,
Context context) {
return getByResourceGroupWithResponseAsync(resourceGroupName, diskName, context).block();
}
/**
* Gets information about a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 information about a disk.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DiskInner getByResourceGroup(String resourceGroupName, String diskName) {
return getByResourceGroupWithResponse(resourceGroupName, diskName, Context.NONE).getValue();
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> deleteWithResponseAsync(String resourceGroupName, String diskName) {
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, diskName, apiVersion, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> deleteWithResponseAsync(String resourceGroupName, String diskName,
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, diskName,
apiVersion, context);
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String diskName) {
Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String diskName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String diskName) {
return this.beginDeleteAsync(resourceGroupName, diskName).getSyncPoller();
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginDelete(String resourceGroupName, String diskName, Context context) {
return this.beginDeleteAsync(resourceGroupName, diskName, context).getSyncPoller();
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono deleteAsync(String resourceGroupName, String diskName) {
return beginDeleteAsync(resourceGroupName, diskName).last().flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono deleteAsync(String resourceGroupName, String diskName, Context context) {
return beginDeleteAsync(resourceGroupName, diskName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 diskName) {
deleteAsync(resourceGroupName, diskName).block();
}
/**
* Deletes a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 diskName, Context context) {
deleteAsync(resourceGroupName, diskName, context).block();
}
/**
* Lists all the disks under a resource group.
*
* @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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listByResourceGroup(this.client.getEndpoint(),
this.client.getSubscriptionId(), resourceGroupName, apiVersion, accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists all the disks under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName,
Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
apiVersion, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Lists all the disks under a resource group.
*
* @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 Disks operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listByResourceGroupAsync(String resourceGroupName) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
}
/**
* Lists all the disks under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 Disks operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) {
return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
}
/**
* Lists all the disks under a resource group.
*
* @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 Disks operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
}
/**
* Lists all the disks under a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 Disks operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
}
/**
* Lists all the disks under a subscription.
*
* @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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync() {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion,
accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Lists all the disks under a 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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listSinglePageAsync(Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono.error(new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Lists all the disks under a subscription.
*
* @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 Disks operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAsync() {
return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink));
}
/**
* Lists all the disks under a 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 Disks operation response as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listAsync(Context context) {
return new PagedFlux<>(() -> listSinglePageAsync(context),
nextLink -> listNextSinglePageAsync(nextLink, context));
}
/**
* Lists all the disks under a subscription.
*
* @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 Disks operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list() {
return new PagedIterable<>(listAsync());
}
/**
* Lists all the disks under a 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 Disks operation response as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable list(Context context) {
return new PagedIterable<>(listAsync(context));
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access 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 a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> grantAccessWithResponseAsync(String resourceGroupName, String diskName,
GrantAccessData grantAccessData) {
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
if (grantAccessData == null) {
return Mono
.error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."));
} else {
grantAccessData.validate();
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.grantAccess(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, diskName, apiVersion, grantAccessData, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access 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 a disk access SAS uri along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> grantAccessWithResponseAsync(String resourceGroupName, String diskName,
GrantAccessData grantAccessData, 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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
if (grantAccessData == null) {
return Mono
.error(new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."));
} else {
grantAccessData.validate();
}
final String apiVersion = "2024-03-02";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.grantAccess(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
diskName, apiVersion, grantAccessData, accept, context);
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, AccessUriInner> beginGrantAccessAsync(String resourceGroupName,
String diskName, GrantAccessData grantAccessData) {
Mono>> mono
= grantAccessWithResponseAsync(resourceGroupName, diskName, grantAccessData);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
AccessUriInner.class, AccessUriInner.class, this.client.getContext());
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, AccessUriInner> beginGrantAccessAsync(String resourceGroupName,
String diskName, GrantAccessData grantAccessData, Context context) {
context = this.client.mergeContext(context);
Mono>> mono
= grantAccessWithResponseAsync(resourceGroupName, diskName, grantAccessData, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(),
AccessUriInner.class, AccessUriInner.class, context);
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, AccessUriInner> beginGrantAccess(String resourceGroupName,
String diskName, GrantAccessData grantAccessData) {
return this.beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData).getSyncPoller();
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, AccessUriInner> beginGrantAccess(String resourceGroupName,
String diskName, GrantAccessData grantAccessData, Context context) {
return this.beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData, context).getSyncPoller();
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access 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 a disk access SAS uri on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono grantAccessAsync(String resourceGroupName, String diskName,
GrantAccessData grantAccessData) {
return beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access 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 a disk access SAS uri on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono grantAccessAsync(String resourceGroupName, String diskName,
GrantAccessData grantAccessData, Context context) {
return beginGrantAccessAsync(resourceGroupName, diskName, grantAccessData, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access 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 a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData) {
return grantAccessAsync(resourceGroupName, diskName, grantAccessData).block();
}
/**
* Grants access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param grantAccessData Access data object supplied in the body of the get disk access 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 a disk access SAS uri.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData,
Context context) {
return grantAccessAsync(resourceGroupName, diskName, grantAccessData, context).block();
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono>> revokeAccessWithResponseAsync(String resourceGroupName, String diskName) {
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
return FluxUtil
.withContext(context -> service.revokeAccess(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, diskName, apiVersion, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono>> revokeAccessWithResponseAsync(String resourceGroupName, String diskName,
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."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (diskName == null) {
return Mono.error(new IllegalArgumentException("Parameter diskName is required and cannot be null."));
}
final String apiVersion = "2024-03-02";
context = this.client.mergeContext(context);
return service.revokeAccess(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
diskName, apiVersion, context);
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux, Void> beginRevokeAccessAsync(String resourceGroupName, String diskName) {
Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, diskName);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
this.client.getContext());
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux, Void> beginRevokeAccessAsync(String resourceGroupName, String diskName,
Context context) {
context = this.client.mergeContext(context);
Mono>> mono = revokeAccessWithResponseAsync(resourceGroupName, diskName, context);
return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
context);
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String diskName) {
return this.beginRevokeAccessAsync(resourceGroupName, diskName).getSyncPoller();
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller, Void> beginRevokeAccess(String resourceGroupName, String diskName,
Context context) {
return this.beginRevokeAccessAsync(resourceGroupName, diskName, context).getSyncPoller();
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono revokeAccessAsync(String resourceGroupName, String diskName) {
return beginRevokeAccessAsync(resourceGroupName, diskName).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 A {@link Mono} that completes when a successful response is received.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono revokeAccessAsync(String resourceGroupName, String diskName, Context context) {
return beginRevokeAccessAsync(resourceGroupName, diskName, context).last()
.flatMap(this.client::getLroFinalResultOrError);
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 revokeAccess(String resourceGroupName, String diskName) {
revokeAccessAsync(resourceGroupName, diskName).block();
}
/**
* Revokes access to a disk.
*
* @param resourceGroupName The name of the resource group.
* @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is
* created. Supported characters for the name are a-z, A-Z, 0-9, _ and -. The maximum name length is 80 characters.
* @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 revokeAccess(String resourceGroupName, String diskName, Context context) {
revokeAccessAsync(resourceGroupName, diskName, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, 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 URL to get the next list of items.
* @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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
.>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Get the next page of items.
*
* @param nextLink The URL to get the next list of items.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws 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 Disks operation response along with {@link PagedResponse} on successful completion of
* {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
}