All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.storagepool.implementation.DiskPoolsClientImpl Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.storagepool.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.storagepool.fluent.DiskPoolsClient;
import com.azure.resourcemanager.storagepool.fluent.models.DiskPoolInner;
import com.azure.resourcemanager.storagepool.fluent.models.OutboundEnvironmentEndpointInner;
import com.azure.resourcemanager.storagepool.models.DiskPoolCreate;
import com.azure.resourcemanager.storagepool.models.DiskPoolListResult;
import com.azure.resourcemanager.storagepool.models.DiskPoolUpdate;
import com.azure.resourcemanager.storagepool.models.OutboundEnvironmentEndpointList;
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 DiskPoolsClient.
 */
public final class DiskPoolsClientImpl implements DiskPoolsClient {
    /**
     * The proxy service used to perform REST calls.
     */
    private final DiskPoolsService service;

    /**
     * The service client containing this operation class.
     */
    private final StoragePoolManagementImpl client;

    /**
     * Initializes an instance of DiskPoolsClientImpl.
     * 
     * @param client the instance of the service client containing this operation class.
     */
    DiskPoolsClientImpl(StoragePoolManagementImpl client) {
        this.service
            = RestProxy.create(DiskPoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
        this.client = client;
    }

    /**
     * The interface defining all the services for StoragePoolManagementDiskPools to be used by the proxy service to
     * perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "StoragePoolManagemen")
    public interface DiskPoolsService {
        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/providers/Microsoft.StoragePool/diskPools")
        @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" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools")
        @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" })
        @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}")
        @ExpectedResponses({ 200, 201 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> createOrUpdate(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") DiskPoolCreate diskPoolCreatePayload, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}")
        @ExpectedResponses({ 200, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> update(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") DiskPoolUpdate diskPoolUpdatePayload, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}")
        @ExpectedResponses({ 200, 202, 204 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> delete(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> getByResourceGroup(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/outboundNetworkDependenciesEndpoints")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listOutboundNetworkDependenciesEndpoints(
            @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/start")
        @ExpectedResponses({ 200, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> start(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/deallocate")
        @ExpectedResponses({ 200, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> deallocate(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StoragePool/diskPools/{diskPoolName}/upgrade")
        @ExpectedResponses({ 200, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> upgrade(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName, @PathParam("diskPoolName") String diskPoolName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("{nextLink}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listBySubscriptionNext(
            @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> 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> listOutboundNetworkDependenciesEndpointsNext(
            @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
            @HeaderParam("Accept") String accept, Context context);
    }

    /**
     * Gets a list of Disk Pools in 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 a list of Disk Pools in a subscription 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 accept = "application/json";
        return FluxUtil
            .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(),
                this.client.getApiVersion(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
                res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Gets a list of Disk Pools in 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 a list of Disk Pools in a subscription 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 accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), accept,
                context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Gets a list of Disk Pools in 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 a list of Disk Pools in a subscription as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listAsync() {
        return new PagedFlux<>(() -> listSinglePageAsync(),
            nextLink -> listBySubscriptionNextSinglePageAsync(nextLink));
    }

    /**
     * Gets a list of Disk Pools in 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 a list of Disk Pools in a subscription as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listAsync(Context context) {
        return new PagedFlux<>(() -> listSinglePageAsync(context),
            nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context));
    }

    /**
     * Gets a list of Disk Pools in 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 a list of Disk Pools in a subscription as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable list() {
        return new PagedIterable<>(listAsync());
    }

    /**
     * Gets a list of Disk Pools in 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 a list of Disk Pools in a subscription as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable list(Context context) {
        return new PagedIterable<>(listAsync(context));
    }

    /**
     * Gets a list of DiskPools in a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 list of DiskPools in a resource group along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (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 accept = "application/json";
        return FluxUtil
            .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(),
                this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
                res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Gets a list of DiskPools in a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 list of DiskPools in a resource group along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName,
        Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (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 accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
                this.client.getApiVersion(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Gets a list of DiskPools in a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 list of DiskPools in a resource group as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByResourceGroupAsync(String resourceGroupName) {
        return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName),
            nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
    }

    /**
     * Gets a list of DiskPools in a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 list of DiskPools in a resource group as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) {
        return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context),
            nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
    }

    /**
     * Gets a list of DiskPools in a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 list of DiskPools in a resource group as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByResourceGroup(String resourceGroupName) {
        return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName));
    }

    /**
     * Gets a list of DiskPools in a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @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 list of DiskPools in a resource group as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
        return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context));
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
        String diskPoolName, DiskPoolCreate diskPoolCreatePayload) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        if (diskPoolCreatePayload == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter diskPoolCreatePayload is required and cannot be null."));
        } else {
            diskPoolCreatePayload.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, diskPoolName, this.client.getApiVersion(), diskPoolCreatePayload, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
        String diskPoolName, DiskPoolCreate diskPoolCreatePayload, 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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        if (diskPoolCreatePayload == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter diskPoolCreatePayload is required and cannot be null."));
        } else {
            diskPoolCreatePayload.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            diskPoolName, this.client.getApiVersion(), diskPoolCreatePayload, accept, context);
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DiskPoolInner> beginCreateOrUpdateAsync(String resourceGroupName,
        String diskPoolName, DiskPoolCreate diskPoolCreatePayload) {
        Mono>> mono
            = createOrUpdateWithResponseAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            DiskPoolInner.class, DiskPoolInner.class, this.client.getContext());
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DiskPoolInner> beginCreateOrUpdateAsync(String resourceGroupName,
        String diskPoolName, DiskPoolCreate diskPoolCreatePayload, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = createOrUpdateWithResponseAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            DiskPoolInner.class, DiskPoolInner.class, context);
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DiskPoolInner> beginCreateOrUpdate(String resourceGroupName,
        String diskPoolName, DiskPoolCreate diskPoolCreatePayload) {
        return this.beginCreateOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload).getSyncPoller();
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DiskPoolInner> beginCreateOrUpdate(String resourceGroupName,
        String diskPoolName, DiskPoolCreate diskPoolCreatePayload, Context context) {
        return this.beginCreateOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload, context)
            .getSyncPoller();
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName, String diskPoolName,
        DiskPoolCreate diskPoolCreatePayload) {
        return beginCreateOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName, String diskPoolName,
        DiskPoolCreate diskPoolCreatePayload, Context context) {
        return beginCreateOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DiskPoolInner createOrUpdate(String resourceGroupName, String diskPoolName,
        DiskPoolCreate diskPoolCreatePayload) {
        return createOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload).block();
    }

    /**
     * Create or Update Disk pool. This create or update operation can take 15 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolCreatePayload Request payload for Disk Pool create 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DiskPoolInner createOrUpdate(String resourceGroupName, String diskPoolName,
        DiskPoolCreate diskPoolCreatePayload, Context context) {
        return createOrUpdateAsync(resourceGroupName, diskPoolName, diskPoolCreatePayload, context).block();
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> updateWithResponseAsync(String resourceGroupName, String diskPoolName,
        DiskPoolUpdate diskPoolUpdatePayload) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        if (diskPoolUpdatePayload == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter diskPoolUpdatePayload is required and cannot be null."));
        } else {
            diskPoolUpdatePayload.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, diskPoolName, this.client.getApiVersion(), diskPoolUpdatePayload, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> updateWithResponseAsync(String resourceGroupName, String diskPoolName,
        DiskPoolUpdate diskPoolUpdatePayload, 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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        if (diskPoolUpdatePayload == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter diskPoolUpdatePayload is required and cannot be null."));
        } else {
            diskPoolUpdatePayload.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            diskPoolName, this.client.getApiVersion(), diskPoolUpdatePayload, accept, context);
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DiskPoolInner> beginUpdateAsync(String resourceGroupName,
        String diskPoolName, DiskPoolUpdate diskPoolUpdatePayload) {
        Mono>> mono
            = updateWithResponseAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            DiskPoolInner.class, DiskPoolInner.class, this.client.getContext());
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DiskPoolInner> beginUpdateAsync(String resourceGroupName,
        String diskPoolName, DiskPoolUpdate diskPoolUpdatePayload, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = updateWithResponseAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            DiskPoolInner.class, DiskPoolInner.class, context);
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DiskPoolInner> beginUpdate(String resourceGroupName,
        String diskPoolName, DiskPoolUpdate diskPoolUpdatePayload) {
        return this.beginUpdateAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload).getSyncPoller();
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DiskPoolInner> beginUpdate(String resourceGroupName,
        String diskPoolName, DiskPoolUpdate diskPoolUpdatePayload, Context context) {
        return this.beginUpdateAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload, context).getSyncPoller();
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String diskPoolName,
        DiskPoolUpdate diskPoolUpdatePayload) {
        return beginUpdateAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String diskPoolName,
        DiskPoolUpdate diskPoolUpdatePayload, Context context) {
        return beginUpdateAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DiskPoolInner update(String resourceGroupName, String diskPoolName, DiskPoolUpdate diskPoolUpdatePayload) {
        return updateAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload).block();
    }

    /**
     * Update a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param diskPoolUpdatePayload Request payload for Disk Pool update 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 response for Disk Pool request.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DiskPoolInner update(String resourceGroupName, String diskPoolName, DiskPoolUpdate diskPoolUpdatePayload,
        Context context) {
        return updateAsync(resourceGroupName, diskPoolName, diskPoolUpdatePayload, context).block();
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 diskPoolName) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, diskPoolName, this.client.getApiVersion(), accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 diskPoolName,
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            diskPoolName, this.client.getApiVersion(), accept, context);
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 diskPoolName) {
        Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskPoolName);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 diskPoolName,
        Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono = deleteWithResponseAsync(resourceGroupName, diskPoolName, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 diskPoolName) {
        return this.beginDeleteAsync(resourceGroupName, diskPoolName).getSyncPoller();
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 diskPoolName,
        Context context) {
        return this.beginDeleteAsync(resourceGroupName, diskPoolName, context).getSyncPoller();
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 diskPoolName) {
        return beginDeleteAsync(resourceGroupName, diskPoolName).last().flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 diskPoolName, Context context) {
        return beginDeleteAsync(resourceGroupName, diskPoolName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 diskPoolName) {
        deleteAsync(resourceGroupName, diskPoolName).block();
    }

    /**
     * Delete a Disk pool; attached disks are not affected. This delete operation can take 10 minutes to complete. This
     * is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 diskPoolName, Context context) {
        deleteAsync(resourceGroupName, diskPoolName, context).block();
    }

    /**
     * Get a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 pool along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
        String diskPoolName) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(),
                    resourceGroupName, diskPoolName, this.client.getApiVersion(), accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 pool along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName,
        String diskPoolName, 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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.getByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            diskPoolName, this.client.getApiVersion(), accept, context);
    }

    /**
     * Get a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 pool on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono getByResourceGroupAsync(String resourceGroupName, String diskPoolName) {
        return getByResourceGroupWithResponseAsync(resourceGroupName, diskPoolName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 pool along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getByResourceGroupWithResponse(String resourceGroupName, String diskPoolName,
        Context context) {
        return getByResourceGroupWithResponseAsync(resourceGroupName, diskPoolName, context).block();
    }

    /**
     * Get a Disk pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 pool.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DiskPoolInner getByResourceGroup(String resourceGroupName, String diskPoolName) {
        return getByResourceGroupWithResponse(resourceGroupName, diskPoolName, Context.NONE).getValue();
    }

    /**
     * Gets the network endpoints of all outbound dependencies of a Disk Pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 network endpoints of all outbound dependencies of a Disk Pool along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>
        listOutboundNetworkDependenciesEndpointsSinglePageAsync(String resourceGroupName, String diskPoolName) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.listOutboundNetworkDependenciesEndpoints(this.client.getEndpoint(),
                this.client.getSubscriptionId(), resourceGroupName, diskPoolName, this.client.getApiVersion(), accept,
                context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Gets the network endpoints of all outbound dependencies of a Disk Pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 network endpoints of all outbound dependencies of a Disk Pool along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>
        listOutboundNetworkDependenciesEndpointsSinglePageAsync(String resourceGroupName, String diskPoolName,
            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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listOutboundNetworkDependenciesEndpoints(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, diskPoolName, this.client.getApiVersion(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Gets the network endpoints of all outbound dependencies of a Disk Pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 network endpoints of all outbound dependencies of a Disk Pool as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux
        listOutboundNetworkDependenciesEndpointsAsync(String resourceGroupName, String diskPoolName) {
        return new PagedFlux<>(
            () -> listOutboundNetworkDependenciesEndpointsSinglePageAsync(resourceGroupName, diskPoolName),
            nextLink -> listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(nextLink));
    }

    /**
     * Gets the network endpoints of all outbound dependencies of a Disk Pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 network endpoints of all outbound dependencies of a Disk Pool as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux
        listOutboundNetworkDependenciesEndpointsAsync(String resourceGroupName, String diskPoolName, Context context) {
        return new PagedFlux<>(
            () -> listOutboundNetworkDependenciesEndpointsSinglePageAsync(resourceGroupName, diskPoolName, context),
            nextLink -> listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(nextLink, context));
    }

    /**
     * Gets the network endpoints of all outbound dependencies of a Disk Pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 network endpoints of all outbound dependencies of a Disk Pool as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable
        listOutboundNetworkDependenciesEndpoints(String resourceGroupName, String diskPoolName) {
        return new PagedIterable<>(listOutboundNetworkDependenciesEndpointsAsync(resourceGroupName, diskPoolName));
    }

    /**
     * Gets the network endpoints of all outbound dependencies of a Disk Pool.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 network endpoints of all outbound dependencies of a Disk Pool as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable
        listOutboundNetworkDependenciesEndpoints(String resourceGroupName, String diskPoolName, Context context) {
        return new PagedIterable<>(
            listOutboundNetworkDependenciesEndpointsAsync(resourceGroupName, diskPoolName, context));
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>> startWithResponseAsync(String resourceGroupName, String diskPoolName) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.start(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, diskPoolName, this.client.getApiVersion(), accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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>> startWithResponseAsync(String resourceGroupName, String diskPoolName,
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.start(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            diskPoolName, this.client.getApiVersion(), accept, context);
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginStartAsync(String resourceGroupName, String diskPoolName) {
        Mono>> mono = startWithResponseAsync(resourceGroupName, diskPoolName);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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> beginStartAsync(String resourceGroupName, String diskPoolName,
        Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono = startWithResponseAsync(resourceGroupName, diskPoolName, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginStart(String resourceGroupName, String diskPoolName) {
        return this.beginStartAsync(resourceGroupName, diskPoolName).getSyncPoller();
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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> beginStart(String resourceGroupName, String diskPoolName,
        Context context) {
        return this.beginStartAsync(resourceGroupName, diskPoolName, context).getSyncPoller();
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 startAsync(String resourceGroupName, String diskPoolName) {
        return beginStartAsync(resourceGroupName, diskPoolName).last().flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 startAsync(String resourceGroupName, String diskPoolName, Context context) {
        return beginStartAsync(resourceGroupName, diskPoolName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void start(String resourceGroupName, String diskPoolName) {
        startAsync(resourceGroupName, diskPoolName).block();
    }

    /**
     * The operation to start a Disk Pool. This start operation can take 10 minutes to complete. This is expected
     * service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void start(String resourceGroupName, String diskPoolName, Context context) {
        startAsync(resourceGroupName, diskPoolName, context).block();
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>> deallocateWithResponseAsync(String resourceGroupName,
        String diskPoolName) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.deallocate(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, diskPoolName, this.client.getApiVersion(), accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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>> deallocateWithResponseAsync(String resourceGroupName, String diskPoolName,
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.deallocate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            diskPoolName, this.client.getApiVersion(), accept, context);
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeallocateAsync(String resourceGroupName, String diskPoolName) {
        Mono>> mono = deallocateWithResponseAsync(resourceGroupName, diskPoolName);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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> beginDeallocateAsync(String resourceGroupName, String diskPoolName,
        Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono = deallocateWithResponseAsync(resourceGroupName, diskPoolName, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeallocate(String resourceGroupName, String diskPoolName) {
        return this.beginDeallocateAsync(resourceGroupName, diskPoolName).getSyncPoller();
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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> beginDeallocate(String resourceGroupName, String diskPoolName,
        Context context) {
        return this.beginDeallocateAsync(resourceGroupName, diskPoolName, context).getSyncPoller();
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 deallocateAsync(String resourceGroupName, String diskPoolName) {
        return beginDeallocateAsync(resourceGroupName, diskPoolName).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 deallocateAsync(String resourceGroupName, String diskPoolName, Context context) {
        return beginDeallocateAsync(resourceGroupName, diskPoolName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void deallocate(String resourceGroupName, String diskPoolName) {
        deallocateAsync(resourceGroupName, diskPoolName).block();
    }

    /**
     * Shuts down the Disk Pool and releases the compute resources. You are not billed for the compute resources that
     * this Disk Pool uses. This operation can take 10 minutes to complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void deallocate(String resourceGroupName, String diskPoolName, Context context) {
        deallocateAsync(resourceGroupName, diskPoolName, context).block();
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>> upgradeWithResponseAsync(String resourceGroupName, String diskPoolName) {
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.upgrade(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, diskPoolName, this.client.getApiVersion(), accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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>> upgradeWithResponseAsync(String resourceGroupName, String diskPoolName,
        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 (diskPoolName == null) {
            return Mono.error(new IllegalArgumentException("Parameter diskPoolName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.upgrade(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            diskPoolName, this.client.getApiVersion(), accept, context);
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginUpgradeAsync(String resourceGroupName, String diskPoolName) {
        Mono>> mono = upgradeWithResponseAsync(resourceGroupName, diskPoolName);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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> beginUpgradeAsync(String resourceGroupName, String diskPoolName,
        Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono = upgradeWithResponseAsync(resourceGroupName, diskPoolName, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginUpgrade(String resourceGroupName, String diskPoolName) {
        return this.beginUpgradeAsync(resourceGroupName, diskPoolName).getSyncPoller();
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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> beginUpgrade(String resourceGroupName, String diskPoolName,
        Context context) {
        return this.beginUpgradeAsync(resourceGroupName, diskPoolName, context).getSyncPoller();
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 upgradeAsync(String resourceGroupName, String diskPoolName) {
        return beginUpgradeAsync(resourceGroupName, diskPoolName).last().flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 upgradeAsync(String resourceGroupName, String diskPoolName, Context context) {
        return beginUpgradeAsync(resourceGroupName, diskPoolName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 upgrade(String resourceGroupName, String diskPoolName) {
        upgradeAsync(resourceGroupName, diskPoolName).block();
    }

    /**
     * Upgrade replaces the underlying virtual machine hosts one at a time. This operation can take 10-15 minutes to
     * complete. This is expected service behavior.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param diskPoolName The name of the Disk Pool.
     * @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 upgrade(String resourceGroupName, String diskPoolName, Context context) {
        upgradeAsync(resourceGroupName, diskPoolName, 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 list of Disk Pools along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 list of Disk Pools along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 list of Disk Pools 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 list of Disk Pools 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 collection of Outbound Environment Endpoints along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>
        listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(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.listOutboundNetworkDependenciesEndpointsNext(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 collection of Outbound Environment Endpoints along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>
        listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(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
            .listOutboundNetworkDependenciesEndpointsNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy