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

com.azure.resourcemanager.elasticsan.implementation.VolumeSnapshotsClientImpl 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.elasticsan.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.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.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.elasticsan.fluent.VolumeSnapshotsClient;
import com.azure.resourcemanager.elasticsan.fluent.models.SnapshotInner;
import com.azure.resourcemanager.elasticsan.models.SnapshotList;
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 VolumeSnapshotsClient.
 */
public final class VolumeSnapshotsClientImpl implements VolumeSnapshotsClient {
    /**
     * The proxy service used to perform REST calls.
     */
    private final VolumeSnapshotsService service;

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

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

    /**
     * The interface defining all the services for ElasticSanManagementVolumeSnapshots to be used by the proxy service
     * to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "ElasticSanManagement")
    public interface VolumeSnapshotsService {
        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listByVolumeGroup(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("elasticSanName") String elasticSanName, @PathParam("volumeGroupName") String volumeGroupName,
            @QueryParam("$filter") String filter, @QueryParam("api-version") String apiVersion,
            @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}")
        @ExpectedResponses({ 200, 201 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> create(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("elasticSanName") String elasticSanName, @PathParam("volumeGroupName") String volumeGroupName,
            @PathParam("snapshotName") String snapshotName, @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") SnapshotInner parameters, @HeaderParam("Accept") String accept,
            Context context);

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

        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> get(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("elasticSanName") String elasticSanName, @PathParam("volumeGroupName") String volumeGroupName,
            @PathParam("snapshotName") String snapshotName, @QueryParam("api-version") String apiVersion,
            @HeaderParam("Accept") String accept, Context context);

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

    /**
     * List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param filter Specify $filter='volumeName eq <volume name>' to filter on volume.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Snapshots along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByVolumeGroupSinglePageAsync(String resourceGroupName,
        String elasticSanName, String volumeGroupName, String filter) {
        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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.listByVolumeGroup(this.client.getEndpoint(),
                this.client.getSubscriptionId(), resourceGroupName, elasticSanName, volumeGroupName, filter,
                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()));
    }

    /**
     * List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param filter Specify $filter='volumeName eq <volume name>' to filter on volume.
     * @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 Snapshots along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByVolumeGroupSinglePageAsync(String resourceGroupName,
        String elasticSanName, String volumeGroupName, String filter, 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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listByVolumeGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
                elasticSanName, volumeGroupName, filter, this.client.getApiVersion(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param filter Specify $filter='volumeName eq <volume name>' to filter on volume.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Snapshots as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByVolumeGroupAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String filter) {
        return new PagedFlux<>(
            () -> listByVolumeGroupSinglePageAsync(resourceGroupName, elasticSanName, volumeGroupName, filter),
            nextLink -> listByVolumeGroupNextSinglePageAsync(nextLink));
    }

    /**
     * List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Snapshots as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByVolumeGroupAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName) {
        final String filter = null;
        return new PagedFlux<>(
            () -> listByVolumeGroupSinglePageAsync(resourceGroupName, elasticSanName, volumeGroupName, filter),
            nextLink -> listByVolumeGroupNextSinglePageAsync(nextLink));
    }

    /**
     * List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param filter Specify $filter='volumeName eq <volume name>' to filter on volume.
     * @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 Snapshots as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByVolumeGroupAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String filter, Context context) {
        return new PagedFlux<>(
            () -> listByVolumeGroupSinglePageAsync(resourceGroupName, elasticSanName, volumeGroupName, filter, context),
            nextLink -> listByVolumeGroupNextSinglePageAsync(nextLink, context));
    }

    /**
     * List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Snapshots as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByVolumeGroup(String resourceGroupName, String elasticSanName,
        String volumeGroupName) {
        final String filter = null;
        return new PagedIterable<>(listByVolumeGroupAsync(resourceGroupName, elasticSanName, volumeGroupName, filter));
    }

    /**
     * List Snapshots in a VolumeGroup or List Snapshots by Volume (name) in a VolumeGroup using filter.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param filter Specify $filter='volumeName eq <volume name>' to filter on volume.
     * @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 Snapshots as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByVolumeGroup(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String filter, Context context) {
        return new PagedIterable<>(
            listByVolumeGroupAsync(resourceGroupName, elasticSanName, volumeGroupName, filter, context));
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Volume Snapshot request along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createWithResponseAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName, SnapshotInner parameters) {
        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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        if (snapshotName == null) {
            return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
        }
        if (parameters == null) {
            return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
        } else {
            parameters.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, elasticSanName, volumeGroupName, snapshotName, this.client.getApiVersion(),
                parameters, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @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 Volume Snapshot request along with {@link Response} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createWithResponseAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName, SnapshotInner parameters, 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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        if (snapshotName == null) {
            return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
        }
        if (parameters == null) {
            return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
        } else {
            parameters.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            elasticSanName, volumeGroupName, snapshotName, this.client.getApiVersion(), parameters, accept, context);
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Volume Snapshot request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, SnapshotInner> beginCreateAsync(String resourceGroupName,
        String elasticSanName, String volumeGroupName, String snapshotName, SnapshotInner parameters) {
        Mono>> mono
            = createWithResponseAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            SnapshotInner.class, SnapshotInner.class, this.client.getContext());
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @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 Volume Snapshot request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, SnapshotInner> beginCreateAsync(String resourceGroupName,
        String elasticSanName, String volumeGroupName, String snapshotName, SnapshotInner parameters, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono = createWithResponseAsync(resourceGroupName, elasticSanName,
            volumeGroupName, snapshotName, parameters, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            SnapshotInner.class, SnapshotInner.class, context);
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Volume Snapshot request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, SnapshotInner> beginCreate(String resourceGroupName,
        String elasticSanName, String volumeGroupName, String snapshotName, SnapshotInner parameters) {
        return this.beginCreateAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters)
            .getSyncPoller();
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @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 Volume Snapshot request.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, SnapshotInner> beginCreate(String resourceGroupName,
        String elasticSanName, String volumeGroupName, String snapshotName, SnapshotInner parameters, Context context) {
        return this
            .beginCreateAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters, context)
            .getSyncPoller();
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Volume Snapshot request on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createAsync(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName, SnapshotInner parameters) {
        return beginCreateAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @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 Volume Snapshot request on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createAsync(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName, SnapshotInner parameters, Context context) {
        return beginCreateAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Volume Snapshot request.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SnapshotInner create(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName, SnapshotInner parameters) {
        return createAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters).block();
    }

    /**
     * Create a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param parameters Snapshot object.
     * @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 Volume Snapshot request.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SnapshotInner create(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName, SnapshotInner parameters, Context context) {
        return createAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, parameters, context)
            .block();
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> deleteWithResponseAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName) {
        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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        if (snapshotName == null) {
            return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
                    elasticSanName, volumeGroupName, snapshotName, this.client.getApiVersion(), accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> deleteWithResponseAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName, 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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        if (snapshotName == null) {
            return Mono.error(new IllegalArgumentException("Parameter snapshotName 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,
            elasticSanName, volumeGroupName, snapshotName, this.client.getApiVersion(), accept, context);
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName) {
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, Void> beginDelete(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName) {
        return this.beginDeleteAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName).getSyncPoller();
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, Void> beginDelete(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName, Context context) {
        return this.beginDeleteAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, context)
            .getSyncPoller();
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono deleteAsync(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName) {
        return beginDeleteAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono deleteAsync(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName, Context context) {
        return beginDeleteAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(String resourceGroupName, String elasticSanName, String volumeGroupName, String snapshotName) {
        deleteAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName).block();
    }

    /**
     * Delete a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(String resourceGroupName, String elasticSanName, String volumeGroupName, String snapshotName,
        Context context) {
        deleteAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, context).block();
    }

    /**
     * Get a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Volume Snapshot along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getWithResponseAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName) {
        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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        if (snapshotName == null) {
            return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
                    elasticSanName, volumeGroupName, snapshotName, this.client.getApiVersion(), accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Volume Snapshot along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getWithResponseAsync(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName, 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 (elasticSanName == null) {
            return Mono.error(new IllegalArgumentException("Parameter elasticSanName is required and cannot be null."));
        }
        if (volumeGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter volumeGroupName is required and cannot be null."));
        }
        if (snapshotName == null) {
            return Mono.error(new IllegalArgumentException("Parameter snapshotName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            elasticSanName, volumeGroupName, snapshotName, this.client.getApiVersion(), accept, context);
    }

    /**
     * Get a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Volume Snapshot on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono getAsync(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName) {
        return getWithResponseAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Volume Snapshot along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getWithResponse(String resourceGroupName, String elasticSanName,
        String volumeGroupName, String snapshotName, Context context) {
        return getWithResponseAsync(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, context).block();
    }

    /**
     * Get a Volume Snapshot.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param elasticSanName The name of the ElasticSan.
     * @param volumeGroupName The name of the VolumeGroup.
     * @param snapshotName The name of the volume snapshot within the given volume group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Volume Snapshot.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SnapshotInner get(String resourceGroupName, String elasticSanName, String volumeGroupName,
        String snapshotName) {
        return getWithResponse(resourceGroupName, elasticSanName, volumeGroupName, snapshotName, Context.NONE)
            .getValue();
    }

    /**
     * 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 Snapshots along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByVolumeGroupNextSinglePageAsync(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.listByVolumeGroupNext(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 Snapshots along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByVolumeGroupNextSinglePageAsync(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.listByVolumeGroupNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy