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

package com.azure.resourcemanager.databox.implementation;

import com.azure.core.annotation.BodyParam;
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.Post;
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.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.databox.fluent.ServicesClient;
import com.azure.resourcemanager.databox.fluent.models.AddressValidationOutputInner;
import com.azure.resourcemanager.databox.fluent.models.RegionConfigurationResponseInner;
import com.azure.resourcemanager.databox.fluent.models.SkuInformationInner;
import com.azure.resourcemanager.databox.fluent.models.ValidationResponseInner;
import com.azure.resourcemanager.databox.models.AvailableSkuRequest;
import com.azure.resourcemanager.databox.models.AvailableSkusResult;
import com.azure.resourcemanager.databox.models.RegionConfigurationRequest;
import com.azure.resourcemanager.databox.models.ValidateAddress;
import com.azure.resourcemanager.databox.models.ValidationRequest;
import reactor.core.publisher.Mono;

/** An instance of this class provides access to all the operations defined in ServicesClient. */
public final class ServicesClientImpl implements ServicesClient {
    /** The proxy service used to perform REST calls. */
    private final ServicesService service;

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

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

    /**
     * The interface defining all the services for DataBoxManagementClientServices to be used by the proxy service to
     * perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "DataBoxManagementCli")
    public interface ServicesService {
        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/availableSkus")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<AvailableSkusResult>> listAvailableSkusByResourceGroup(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("location") String location,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") AvailableSkuRequest availableSkuRequest,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateAddress")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<AddressValidationOutputInner>> validateAddress(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("location") String location,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") ValidateAddress validateAddress,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/validateInputs")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<ValidationResponseInner>> validateInputsByResourceGroup(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("location") String location,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") ValidationRequest validationRequest,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/validateInputs")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<ValidationResponseInner>> validateInputs(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("location") String location,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") ValidationRequest validationRequest,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<RegionConfigurationResponseInner>> regionConfiguration(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("location") String location,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") RegionConfigurationRequest regionConfigurationRequest,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBox/locations/{location}/regionConfiguration")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<RegionConfigurationResponseInner>> regionConfigurationByResourceGroup(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("location") String location,
            @QueryParam("api-version") String apiVersion,
            @BodyParam("application/json") RegionConfigurationRequest regionConfigurationRequest,
            @HeaderParam("Accept") String accept,
            Context context);

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

    /**
     * This method provides the list of available skus for the given subscription, resource group and location.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param availableSkuRequest Filters for showing the available skus.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 available skus operation response along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SkuInformationInner>> listAvailableSkusByResourceGroupSinglePageAsync(
        String resourceGroupName, String location, AvailableSkuRequest availableSkuRequest) {
        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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (availableSkuRequest == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter availableSkuRequest is required and cannot be null."));
        } else {
            availableSkuRequest.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listAvailableSkusByResourceGroup(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            location,
                            this.client.getApiVersion(),
                            availableSkuRequest,
                            accept,
                            context))
            .<PagedResponse<SkuInformationInner>>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()));
    }

    /**
     * This method provides the list of available skus for the given subscription, resource group and location.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param availableSkuRequest Filters for showing the available skus.
     * @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 available skus operation response along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SkuInformationInner>> listAvailableSkusByResourceGroupSinglePageAsync(
        String resourceGroupName, String location, AvailableSkuRequest availableSkuRequest, 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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (availableSkuRequest == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter availableSkuRequest is required and cannot be null."));
        } else {
            availableSkuRequest.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listAvailableSkusByResourceGroup(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                location,
                this.client.getApiVersion(),
                availableSkuRequest,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * This method provides the list of available skus for the given subscription, resource group and location.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param availableSkuRequest Filters for showing the available skus.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 available skus operation response as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<SkuInformationInner> listAvailableSkusByResourceGroupAsync(
        String resourceGroupName, String location, AvailableSkuRequest availableSkuRequest) {
        return new PagedFlux<>(
            () -> listAvailableSkusByResourceGroupSinglePageAsync(resourceGroupName, location, availableSkuRequest),
            nextLink -> listAvailableSkusByResourceGroupNextSinglePageAsync(nextLink));
    }

    /**
     * This method provides the list of available skus for the given subscription, resource group and location.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param availableSkuRequest Filters for showing the available skus.
     * @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 available skus operation response as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<SkuInformationInner> listAvailableSkusByResourceGroupAsync(
        String resourceGroupName, String location, AvailableSkuRequest availableSkuRequest, Context context) {
        return new PagedFlux<>(
            () ->
                listAvailableSkusByResourceGroupSinglePageAsync(
                    resourceGroupName, location, availableSkuRequest, context),
            nextLink -> listAvailableSkusByResourceGroupNextSinglePageAsync(nextLink, context));
    }

    /**
     * This method provides the list of available skus for the given subscription, resource group and location.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param availableSkuRequest Filters for showing the available skus.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 available skus operation response as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<SkuInformationInner> listAvailableSkusByResourceGroup(
        String resourceGroupName, String location, AvailableSkuRequest availableSkuRequest) {
        return new PagedIterable<>(
            listAvailableSkusByResourceGroupAsync(resourceGroupName, location, availableSkuRequest));
    }

    /**
     * This method provides the list of available skus for the given subscription, resource group and location.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param availableSkuRequest Filters for showing the available skus.
     * @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 available skus operation response as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<SkuInformationInner> listAvailableSkusByResourceGroup(
        String resourceGroupName, String location, AvailableSkuRequest availableSkuRequest, Context context) {
        return new PagedIterable<>(
            listAvailableSkusByResourceGroupAsync(resourceGroupName, location, availableSkuRequest, context));
    }

    /**
     * [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and
     * provide alternate addresses if any.
     *
     * @param location The location of the resource.
     * @param validateAddress Shipping address of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return output of the address validation api along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<AddressValidationOutputInner>> validateAddressWithResponseAsync(
        String location, ValidateAddress validateAddress) {
        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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (validateAddress == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter validateAddress is required and cannot be null."));
        } else {
            validateAddress.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .validateAddress(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            location,
                            this.client.getApiVersion(),
                            validateAddress,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and
     * provide alternate addresses if any.
     *
     * @param location The location of the resource.
     * @param validateAddress Shipping address of the customer.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return output of the address validation api along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<AddressValidationOutputInner>> validateAddressWithResponseAsync(
        String location, ValidateAddress validateAddress, 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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (validateAddress == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter validateAddress is required and cannot be null."));
        } else {
            validateAddress.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .validateAddress(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                location,
                this.client.getApiVersion(),
                validateAddress,
                accept,
                context);
    }

    /**
     * [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and
     * provide alternate addresses if any.
     *
     * @param location The location of the resource.
     * @param validateAddress Shipping address of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return output of the address validation api on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<AddressValidationOutputInner> validateAddressAsync(String location, ValidateAddress validateAddress) {
        return validateAddressWithResponseAsync(location, validateAddress)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and
     * provide alternate addresses if any.
     *
     * @param location The location of the resource.
     * @param validateAddress Shipping address of the customer.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return output of the address validation api along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<AddressValidationOutputInner> validateAddressWithResponse(
        String location, ValidateAddress validateAddress, Context context) {
        return validateAddressWithResponseAsync(location, validateAddress, context).block();
    }

    /**
     * [DEPRECATED NOTICE: This operation will soon be removed]. This method validates the customer shipping address and
     * provide alternate addresses if any.
     *
     * @param location The location of the resource.
     * @param validateAddress Shipping address of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return output of the address validation api.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public AddressValidationOutputInner validateAddress(String location, ValidateAddress validateAddress) {
        return validateAddressWithResponse(location, validateAddress, Context.NONE).getValue();
    }

    /**
     * This method does all necessary pre-job creation validation under resource group.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 of pre job creation validations along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<ValidationResponseInner>> validateInputsByResourceGroupWithResponseAsync(
        String resourceGroupName, String location, ValidationRequest validationRequest) {
        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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (validationRequest == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter validationRequest is required and cannot be null."));
        } else {
            validationRequest.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .validateInputsByResourceGroup(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            location,
                            this.client.getApiVersion(),
                            validationRequest,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * This method does all necessary pre-job creation validation under resource group.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @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 of pre job creation validations along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<ValidationResponseInner>> validateInputsByResourceGroupWithResponseAsync(
        String resourceGroupName, String location, ValidationRequest validationRequest, 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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (validationRequest == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter validationRequest is required and cannot be null."));
        } else {
            validationRequest.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .validateInputsByResourceGroup(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                location,
                this.client.getApiVersion(),
                validationRequest,
                accept,
                context);
    }

    /**
     * This method does all necessary pre-job creation validation under resource group.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 of pre job creation validations on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<ValidationResponseInner> validateInputsByResourceGroupAsync(
        String resourceGroupName, String location, ValidationRequest validationRequest) {
        return validateInputsByResourceGroupWithResponseAsync(resourceGroupName, location, validationRequest)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * This method does all necessary pre-job creation validation under resource group.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @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 of pre job creation validations along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<ValidationResponseInner> validateInputsByResourceGroupWithResponse(
        String resourceGroupName, String location, ValidationRequest validationRequest, Context context) {
        return validateInputsByResourceGroupWithResponseAsync(resourceGroupName, location, validationRequest, context)
            .block();
    }

    /**
     * This method does all necessary pre-job creation validation under resource group.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 of pre job creation validations.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ValidationResponseInner validateInputsByResourceGroup(
        String resourceGroupName, String location, ValidationRequest validationRequest) {
        return validateInputsByResourceGroupWithResponse(resourceGroupName, location, validationRequest, Context.NONE)
            .getValue();
    }

    /**
     * This method does all necessary pre-job creation validation under subscription.
     *
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 of pre job creation validations along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<ValidationResponseInner>> validateInputsWithResponseAsync(
        String location, ValidationRequest validationRequest) {
        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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (validationRequest == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter validationRequest is required and cannot be null."));
        } else {
            validationRequest.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .validateInputs(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            location,
                            this.client.getApiVersion(),
                            validationRequest,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * This method does all necessary pre-job creation validation under subscription.
     *
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @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 of pre job creation validations along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<ValidationResponseInner>> validateInputsWithResponseAsync(
        String location, ValidationRequest validationRequest, 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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (validationRequest == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter validationRequest is required and cannot be null."));
        } else {
            validationRequest.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .validateInputs(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                location,
                this.client.getApiVersion(),
                validationRequest,
                accept,
                context);
    }

    /**
     * This method does all necessary pre-job creation validation under subscription.
     *
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 of pre job creation validations on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<ValidationResponseInner> validateInputsAsync(String location, ValidationRequest validationRequest) {
        return validateInputsWithResponseAsync(location, validationRequest)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * This method does all necessary pre-job creation validation under subscription.
     *
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @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 of pre job creation validations along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<ValidationResponseInner> validateInputsWithResponse(
        String location, ValidationRequest validationRequest, Context context) {
        return validateInputsWithResponseAsync(location, validationRequest, context).block();
    }

    /**
     * This method does all necessary pre-job creation validation under subscription.
     *
     * @param location The location of the resource.
     * @param validationRequest Inputs of the customer.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 of pre job creation validations.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ValidationResponseInner validateInputs(String location, ValidationRequest validationRequest) {
        return validateInputsWithResponse(location, validationRequest, Context.NONE).getValue();
    }

    /**
     * This API provides configuration details specific to given region/location at Subscription level.
     *
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return configuration response specific to a region along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<RegionConfigurationResponseInner>> regionConfigurationWithResponseAsync(
        String location, RegionConfigurationRequest regionConfigurationRequest) {
        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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (regionConfigurationRequest == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter regionConfigurationRequest is required and cannot be null."));
        } else {
            regionConfigurationRequest.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .regionConfiguration(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            location,
                            this.client.getApiVersion(),
                            regionConfigurationRequest,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * This API provides configuration details specific to given region/location at Subscription level.
     *
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region.
     * @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 configuration response specific to a region along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<RegionConfigurationResponseInner>> regionConfigurationWithResponseAsync(
        String location, RegionConfigurationRequest regionConfigurationRequest, 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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (regionConfigurationRequest == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter regionConfigurationRequest is required and cannot be null."));
        } else {
            regionConfigurationRequest.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .regionConfiguration(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                location,
                this.client.getApiVersion(),
                regionConfigurationRequest,
                accept,
                context);
    }

    /**
     * This API provides configuration details specific to given region/location at Subscription level.
     *
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return configuration response specific to a region on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<RegionConfigurationResponseInner> regionConfigurationAsync(
        String location, RegionConfigurationRequest regionConfigurationRequest) {
        return regionConfigurationWithResponseAsync(location, regionConfigurationRequest)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * This API provides configuration details specific to given region/location at Subscription level.
     *
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region.
     * @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 configuration response specific to a region along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<RegionConfigurationResponseInner> regionConfigurationWithResponse(
        String location, RegionConfigurationRequest regionConfigurationRequest, Context context) {
        return regionConfigurationWithResponseAsync(location, regionConfigurationRequest, context).block();
    }

    /**
     * This API provides configuration details specific to given region/location at Subscription level.
     *
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return configuration response specific to a region.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public RegionConfigurationResponseInner regionConfiguration(
        String location, RegionConfigurationRequest regionConfigurationRequest) {
        return regionConfigurationWithResponse(location, regionConfigurationRequest, Context.NONE).getValue();
    }

    /**
     * This API provides configuration details specific to given region/location at Resource group level.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region at resource group level.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return configuration response specific to a region along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<RegionConfigurationResponseInner>> regionConfigurationByResourceGroupWithResponseAsync(
        String resourceGroupName, String location, RegionConfigurationRequest regionConfigurationRequest) {
        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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (regionConfigurationRequest == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter regionConfigurationRequest is required and cannot be null."));
        } else {
            regionConfigurationRequest.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .regionConfigurationByResourceGroup(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            location,
                            this.client.getApiVersion(),
                            regionConfigurationRequest,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * This API provides configuration details specific to given region/location at Resource group level.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region at resource group level.
     * @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 configuration response specific to a region along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<RegionConfigurationResponseInner>> regionConfigurationByResourceGroupWithResponseAsync(
        String resourceGroupName,
        String location,
        RegionConfigurationRequest regionConfigurationRequest,
        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 (location == null) {
            return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null."));
        }
        if (regionConfigurationRequest == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter regionConfigurationRequest is required and cannot be null."));
        } else {
            regionConfigurationRequest.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .regionConfigurationByResourceGroup(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                location,
                this.client.getApiVersion(),
                regionConfigurationRequest,
                accept,
                context);
    }

    /**
     * This API provides configuration details specific to given region/location at Resource group level.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region at resource group level.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return configuration response specific to a region on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<RegionConfigurationResponseInner> regionConfigurationByResourceGroupAsync(
        String resourceGroupName, String location, RegionConfigurationRequest regionConfigurationRequest) {
        return regionConfigurationByResourceGroupWithResponseAsync(
                resourceGroupName, location, regionConfigurationRequest)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * This API provides configuration details specific to given region/location at Resource group level.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region at resource group level.
     * @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 configuration response specific to a region along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<RegionConfigurationResponseInner> regionConfigurationByResourceGroupWithResponse(
        String resourceGroupName,
        String location,
        RegionConfigurationRequest regionConfigurationRequest,
        Context context) {
        return regionConfigurationByResourceGroupWithResponseAsync(
                resourceGroupName, location, regionConfigurationRequest, context)
            .block();
    }

    /**
     * This API provides configuration details specific to given region/location at Resource group level.
     *
     * @param resourceGroupName The Resource Group Name.
     * @param location The location of the resource.
     * @param regionConfigurationRequest Request body to get the configuration for the region at resource group level.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return configuration response specific to a region.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public RegionConfigurationResponseInner regionConfigurationByResourceGroup(
        String resourceGroupName, String location, RegionConfigurationRequest regionConfigurationRequest) {
        return regionConfigurationByResourceGroupWithResponse(
                resourceGroupName, location, regionConfigurationRequest, Context.NONE)
            .getValue();
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <p>The nextLink parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the available skus operation response along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SkuInformationInner>> listAvailableSkusByResourceGroupNextSinglePageAsync(
        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.listAvailableSkusByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<SkuInformationInner>>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
     *     <p>The nextLink parameter.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the available skus operation response along with {@link PagedResponse} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<SkuInformationInner>> listAvailableSkusByResourceGroupNextSinglePageAsync(
        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
            .listAvailableSkusByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }
}
