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

com.azure.resourcemanager.dnsresolver.implementation.DnsForwardingRulesetsClientImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DnsResolver Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The DNS Resolver Management Client. Package tag package-2022-07.

There is a newer version: 1.0.0-beta.3
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.dnsresolver.implementation;

import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.dnsresolver.fluent.DnsForwardingRulesetsClient;
import com.azure.resourcemanager.dnsresolver.fluent.models.DnsForwardingRulesetInner;
import com.azure.resourcemanager.dnsresolver.fluent.models.VirtualNetworkDnsForwardingRulesetInner;
import com.azure.resourcemanager.dnsresolver.models.DnsForwardingRulesetListResult;
import com.azure.resourcemanager.dnsresolver.models.DnsForwardingRulesetPatch;
import com.azure.resourcemanager.dnsresolver.models.VirtualNetworkDnsForwardingRulesetListResult;
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 DnsForwardingRulesetsClient.
 */
public final class DnsForwardingRulesetsClientImpl implements DnsForwardingRulesetsClient {
    /**
     * The proxy service used to perform REST calls.
     */
    private final DnsForwardingRulesetsService service;

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

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

    /**
     * The interface defining all the services for DnsResolverManagementClientDnsForwardingRulesets to be used by the
     * proxy service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "DnsResolverManagemen")
    public interface DnsForwardingRulesetsService {
        @Headers({ "Content-Type: application/json" })
        @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}")
        @ExpectedResponses({ 200, 201, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> createOrUpdate(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("dnsForwardingRulesetName") String dnsForwardingRulesetName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("If-Match") String ifMatch,
            @HeaderParam("If-None-Match") String ifNoneMatch,
            @BodyParam("application/json") DnsForwardingRulesetInner parameters, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}")
        @ExpectedResponses({ 200, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> update(@HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("dnsForwardingRulesetName") String dnsForwardingRulesetName,
            @QueryParam("api-version") String apiVersion, @HeaderParam("If-Match") String ifMatch,
            @BodyParam("application/json") DnsForwardingRulesetPatch parameters, @HeaderParam("Accept") String accept,
            Context context);

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

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

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

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

        @Headers({ "Content-Type: application/json" })
        @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/listDnsForwardingRulesets")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listByVirtualNetwork(
            @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("virtualNetworkName") String virtualNetworkName, @QueryParam("api-version") String apiVersion,
            @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, Context context);

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

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

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

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
        String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters, String ifMatch, String ifNoneMatch) {
        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 (dnsForwardingRulesetName == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter dnsForwardingRulesetName 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.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, dnsForwardingRulesetName, this.client.getApiVersion(), ifMatch, ifNoneMatch,
                parameters, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
        String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters, String ifMatch, String ifNoneMatch,
        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 (dnsForwardingRulesetName == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter dnsForwardingRulesetName 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.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            dnsForwardingRulesetName, this.client.getApiVersion(), ifMatch, ifNoneMatch, parameters, accept, context);
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DnsForwardingRulesetInner> beginCreateOrUpdateAsync(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters, String ifMatch,
        String ifNoneMatch) {
        Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName,
            dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), DnsForwardingRulesetInner.class, DnsForwardingRulesetInner.class,
            this.client.getContext());
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate 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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DnsForwardingRulesetInner> beginCreateOrUpdateAsync(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters) {
        final String ifMatch = null;
        final String ifNoneMatch = null;
        Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName,
            dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), DnsForwardingRulesetInner.class, DnsForwardingRulesetInner.class,
            this.client.getContext());
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DnsForwardingRulesetInner> beginCreateOrUpdateAsync(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters, String ifMatch,
        String ifNoneMatch, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName,
            dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch, context);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), DnsForwardingRulesetInner.class, DnsForwardingRulesetInner.class, context);
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate 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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DnsForwardingRulesetInner> beginCreateOrUpdate(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters) {
        final String ifMatch = null;
        final String ifNoneMatch = null;
        return this
            .beginCreateOrUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch)
            .getSyncPoller();
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DnsForwardingRulesetInner> beginCreateOrUpdate(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters, String ifMatch,
        String ifNoneMatch, Context context) {
        return this
            .beginCreateOrUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch,
                context)
            .getSyncPoller();
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName,
        String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters, String ifMatch, String ifNoneMatch) {
        return beginCreateOrUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName,
        String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters) {
        final String ifMatch = null;
        final String ifNoneMatch = null;
        return beginCreateOrUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName,
        String dnsForwardingRulesetName, DnsForwardingRulesetInner parameters, String ifMatch, String ifNoneMatch,
        Context context) {
        return beginCreateOrUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch,
            context).last().flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DnsForwardingRulesetInner createOrUpdate(String resourceGroupName, String dnsForwardingRulesetName,
        DnsForwardingRulesetInner parameters) {
        final String ifMatch = null;
        final String ifNoneMatch = null;
        return createOrUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch)
            .block();
    }

    /**
     * Creates or updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the CreateOrUpdate operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param ifNoneMatch Set to '*' to allow a new resource to be created, but to prevent updating an existing
     * resource. Other values will be ignored.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DnsForwardingRulesetInner createOrUpdate(String resourceGroupName, String dnsForwardingRulesetName,
        DnsForwardingRulesetInner parameters, String ifMatch, String ifNoneMatch, Context context) {
        return createOrUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, ifNoneMatch,
            context).block();
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> updateWithResponseAsync(String resourceGroupName,
        String dnsForwardingRulesetName, DnsForwardingRulesetPatch parameters, String ifMatch) {
        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 (dnsForwardingRulesetName == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter dnsForwardingRulesetName 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.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
                    dnsForwardingRulesetName, this.client.getApiVersion(), ifMatch, parameters, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> updateWithResponseAsync(String resourceGroupName,
        String dnsForwardingRulesetName, DnsForwardingRulesetPatch parameters, String ifMatch, 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 (dnsForwardingRulesetName == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter dnsForwardingRulesetName 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.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
            dnsForwardingRulesetName, this.client.getApiVersion(), ifMatch, parameters, accept, context);
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DnsForwardingRulesetInner> beginUpdateAsync(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetPatch parameters,
        String ifMatch) {
        Mono>> mono
            = updateWithResponseAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), DnsForwardingRulesetInner.class, DnsForwardingRulesetInner.class,
            this.client.getContext());
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DnsForwardingRulesetInner> beginUpdateAsync(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetPatch parameters) {
        final String ifMatch = null;
        Mono>> mono
            = updateWithResponseAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), DnsForwardingRulesetInner.class, DnsForwardingRulesetInner.class,
            this.client.getContext());
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, DnsForwardingRulesetInner> beginUpdateAsync(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetPatch parameters, String ifMatch,
        Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = updateWithResponseAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, context);
        return this.client.getLroResult(mono,
            this.client.getHttpPipeline(), DnsForwardingRulesetInner.class, DnsForwardingRulesetInner.class, context);
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DnsForwardingRulesetInner>
        beginUpdate(String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetPatch parameters) {
        final String ifMatch = null;
        return this.beginUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch).getSyncPoller();
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @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 describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, DnsForwardingRulesetInner> beginUpdate(
        String resourceGroupName, String dnsForwardingRulesetName, DnsForwardingRulesetPatch parameters, String ifMatch,
        Context context) {
        return this.beginUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, context)
            .getSyncPoller();
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String dnsForwardingRulesetName,
        DnsForwardingRulesetPatch parameters, String ifMatch) {
        return beginUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String dnsForwardingRulesetName,
        DnsForwardingRulesetPatch parameters) {
        final String ifMatch = null;
        return beginUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String dnsForwardingRulesetName,
        DnsForwardingRulesetPatch parameters, String ifMatch, Context context) {
        return beginUpdateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DnsForwardingRulesetInner update(String resourceGroupName, String dnsForwardingRulesetName,
        DnsForwardingRulesetPatch parameters) {
        final String ifMatch = null;
        return updateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch).block();
    }

    /**
     * Updates a DNS forwarding ruleset.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param parameters Parameters supplied to the Update operation.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return describes a DNS forwarding ruleset.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DnsForwardingRulesetInner update(String resourceGroupName, String dnsForwardingRulesetName,
        DnsForwardingRulesetPatch parameters, String ifMatch, Context context) {
        return updateAsync(resourceGroupName, dnsForwardingRulesetName, parameters, ifMatch, context).block();
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 dnsForwardingRulesetName, String ifMatch) {
        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 (dnsForwardingRulesetName == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter dnsForwardingRulesetName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
                resourceGroupName, dnsForwardingRulesetName, this.client.getApiVersion(), ifMatch, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @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 dnsForwardingRulesetName, String ifMatch, 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 (dnsForwardingRulesetName == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter dnsForwardingRulesetName 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,
            dnsForwardingRulesetName, this.client.getApiVersion(), ifMatch, accept, context);
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 dnsForwardingRulesetName, String ifMatch) {
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 dnsForwardingRulesetName) {
        final String ifMatch = null;
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @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 dnsForwardingRulesetName, String ifMatch, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 dnsForwardingRulesetName) {
        final String ifMatch = null;
        return this.beginDeleteAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch).getSyncPoller();
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @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 dnsForwardingRulesetName,
        String ifMatch, Context context) {
        return this.beginDeleteAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch, context).getSyncPoller();
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 dnsForwardingRulesetName, String ifMatch) {
        return beginDeleteAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 dnsForwardingRulesetName) {
        final String ifMatch = null;
        return beginDeleteAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @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 dnsForwardingRulesetName, String ifMatch,
        Context context) {
        return beginDeleteAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 dnsForwardingRulesetName) {
        final String ifMatch = null;
        deleteAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch).block();
    }

    /**
     * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the
     * ruleset will be deleted.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the
     * last-seen ETag value to prevent accidentally overwriting any concurrent changes.
     * @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 dnsForwardingRulesetName, String ifMatch, Context context) {
        deleteAsync(resourceGroupName, dnsForwardingRulesetName, ifMatch, context).block();
    }

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

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

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

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

    /**
     * Gets a DNS forwarding ruleset properties.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 DNS forwarding ruleset properties.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DnsForwardingRulesetInner getByResourceGroup(String resourceGroupName, String dnsForwardingRulesetName) {
        return getByResourceGroupWithResponse(resourceGroupName, dnsForwardingRulesetName, Context.NONE).getValue();
    }

    /**
     * Lists DNS forwarding rulesets within a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName,
        Integer top) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(),
                this.client.getSubscriptionId(), resourceGroupName, this.client.getApiVersion(), top, accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Lists DNS forwarding rulesets within a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName,
        Integer top, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listByResourceGroup(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
                this.client.getApiVersion(), top, accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Lists DNS forwarding rulesets within a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top) {
        return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top),
            nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
    }

    /**
     * Lists DNS forwarding rulesets within a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByResourceGroupAsync(String resourceGroupName) {
        final Integer top = null;
        return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top),
            nextLink -> listByResourceGroupNextSinglePageAsync(nextLink));
    }

    /**
     * Lists DNS forwarding rulesets within a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByResourceGroupAsync(String resourceGroupName, Integer top,
        Context context) {
        return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, top, context),
            nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context));
    }

    /**
     * Lists DNS forwarding rulesets within a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByResourceGroup(String resourceGroupName) {
        final Integer top = null;
        return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top));
    }

    /**
     * Lists DNS forwarding rulesets within a resource group.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByResourceGroup(String resourceGroupName, Integer top,
        Context context) {
        return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, top, context));
    }

    /**
     * Lists DNS forwarding rulesets in all resource groups of a subscription.
     * 
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listSinglePageAsync(Integer top) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(),
                this.client.getApiVersion(), top, accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Lists DNS forwarding rulesets in all resource groups of a subscription.
     * 
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listSinglePageAsync(Integer top, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .list(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), top, accept,
                context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Lists DNS forwarding rulesets in all resource groups of a subscription.
     * 
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listAsync(Integer top) {
        return new PagedFlux<>(() -> listSinglePageAsync(top), nextLink -> listNextSinglePageAsync(nextLink));
    }

    /**
     * Lists DNS forwarding rulesets in all resource groups of a subscription.
     * 
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listAsync() {
        final Integer top = null;
        return new PagedFlux<>(() -> listSinglePageAsync(top), nextLink -> listNextSinglePageAsync(nextLink));
    }

    /**
     * Lists DNS forwarding rulesets in all resource groups of a subscription.
     * 
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listAsync(Integer top, Context context) {
        return new PagedFlux<>(() -> listSinglePageAsync(top, context),
            nextLink -> listNextSinglePageAsync(nextLink, context));
    }

    /**
     * Lists DNS forwarding rulesets in all resource groups of a subscription.
     * 
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable list() {
        final Integer top = null;
        return new PagedIterable<>(listAsync(top));
    }

    /**
     * Lists DNS forwarding rulesets in all resource groups of a subscription.
     * 
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on DNS forwarding rulesets as paginated response with
     * {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable list(Integer top, Context context) {
        return new PagedIterable<>(listAsync(top, context));
    }

    /**
     * Lists DNS forwarding ruleset resource IDs attached to a virtual network.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param virtualNetworkName The name of the virtual network.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on Virtual Network DNS Forwarding Ruleset along with
     * {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>
        listByVirtualNetworkSinglePageAsync(String resourceGroupName, String virtualNetworkName, Integer top) {
        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 (virtualNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.listByVirtualNetwork(this.client.getEndpoint(), this.client.getSubscriptionId(),
                    resourceGroupName, virtualNetworkName, this.client.getApiVersion(), top, accept, context))
            .>map(
                res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                    res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Lists DNS forwarding ruleset resource IDs attached to a virtual network.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param virtualNetworkName The name of the virtual network.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on Virtual Network DNS Forwarding Ruleset along with
     * {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByVirtualNetworkSinglePageAsync(
        String resourceGroupName, String virtualNetworkName, Integer top, 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 (virtualNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listByVirtualNetwork(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
                virtualNetworkName, this.client.getApiVersion(), top, accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Lists DNS forwarding ruleset resource IDs attached to a virtual network.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param virtualNetworkName The name of the virtual network.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on Virtual Network DNS Forwarding Ruleset as paginated response
     * with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByVirtualNetworkAsync(String resourceGroupName,
        String virtualNetworkName, Integer top) {
        return new PagedFlux<>(() -> listByVirtualNetworkSinglePageAsync(resourceGroupName, virtualNetworkName, top),
            nextLink -> listByVirtualNetworkNextSinglePageAsync(nextLink));
    }

    /**
     * Lists DNS forwarding ruleset resource IDs attached to a virtual network.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param virtualNetworkName The name of the virtual network.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on Virtual Network DNS Forwarding Ruleset as paginated response
     * with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByVirtualNetworkAsync(String resourceGroupName,
        String virtualNetworkName) {
        final Integer top = null;
        return new PagedFlux<>(() -> listByVirtualNetworkSinglePageAsync(resourceGroupName, virtualNetworkName, top),
            nextLink -> listByVirtualNetworkNextSinglePageAsync(nextLink));
    }

    /**
     * Lists DNS forwarding ruleset resource IDs attached to a virtual network.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param virtualNetworkName The name of the virtual network.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on Virtual Network DNS Forwarding Ruleset as paginated response
     * with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByVirtualNetworkAsync(String resourceGroupName,
        String virtualNetworkName, Integer top, Context context) {
        return new PagedFlux<>(
            () -> listByVirtualNetworkSinglePageAsync(resourceGroupName, virtualNetworkName, top, context),
            nextLink -> listByVirtualNetworkNextSinglePageAsync(nextLink, context));
    }

    /**
     * Lists DNS forwarding ruleset resource IDs attached to a virtual network.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param virtualNetworkName The name of the virtual network.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 response to an enumeration operation on Virtual Network DNS Forwarding Ruleset as paginated response
     * with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByVirtualNetwork(String resourceGroupName,
        String virtualNetworkName) {
        final Integer top = null;
        return new PagedIterable<>(listByVirtualNetworkAsync(resourceGroupName, virtualNetworkName, top));
    }

    /**
     * Lists DNS forwarding ruleset resource IDs attached to a virtual network.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param virtualNetworkName The name of the virtual network.
     * @param top The maximum number of results to return. If not specified, returns up to 100 results.
     * @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 response to an enumeration operation on Virtual Network DNS Forwarding Ruleset as paginated response
     * with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByVirtualNetwork(String resourceGroupName,
        String virtualNetworkName, Integer top, Context context) {
        return new PagedIterable<>(listByVirtualNetworkAsync(resourceGroupName, virtualNetworkName, top, context));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByResourceGroupNextSinglePageAsync(String nextLink,
        Context context) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listNextSinglePageAsync(String nextLink) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(),
                res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on DNS forwarding rulesets along with {@link PagedResponse} on
     * successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listNextSinglePageAsync(String nextLink, Context context) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.listNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on Virtual Network DNS Forwarding Ruleset along with
     * {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>
        listByVirtualNetworkNextSinglePageAsync(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.listByVirtualNetworkNext(nextLink, this.client.getEndpoint(), accept, context))
            .>map(
                res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                    res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response to an enumeration operation on Virtual Network DNS Forwarding Ruleset along with
     * {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>
        listByVirtualNetworkNextSinglePageAsync(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.listByVirtualNetworkNext(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