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

package com.azure.resourcemanager.managednetworkfabric.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.managednetworkfabric.fluent.ExternalNetworksClient;
import com.azure.resourcemanager.managednetworkfabric.fluent.models.ExternalNetworkInner;
import com.azure.resourcemanager.managednetworkfabric.models.EnableDisableOnResources;
import com.azure.resourcemanager.managednetworkfabric.models.ExternalNetworkPatch;
import com.azure.resourcemanager.managednetworkfabric.models.ExternalNetworksList;
import com.azure.resourcemanager.managednetworkfabric.models.UpdateAdministrativeState;
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 ExternalNetworksClient. */
public final class ExternalNetworksClientImpl implements ExternalNetworksClient {
    /** The proxy service used to perform REST calls. */
    private final ExternalNetworksService service;

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

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

    /**
     * The interface defining all the services for AzureNetworkFabricManagementServiceApiExternalNetworks to be used by
     * the proxy service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "AzureNetworkFabricMa")
    public interface ExternalNetworksService {
        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> create(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @BodyParam("application/json") ExternalNetworkInner body,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<ExternalNetworkInner>> get(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Patch(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> update(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @BodyParam("application/json") ExternalNetworkPatch body,
            @HeaderParam("Accept") String accept,
            Context context);

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

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<ExternalNetworksList>> list(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateAdministrativeState")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateAdministrativeState(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @BodyParam("application/json") UpdateAdministrativeState body,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBgpAdministrativeState")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateBgpAdministrativeState(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @BodyParam("application/json") UpdateAdministrativeState body,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/updateBfdForBgpAdministrativeState")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateBfdForBgpAdministrativeState(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @BodyParam("application/json") UpdateAdministrativeState body,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearIpv6Neighbors")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> clearIpv6Neighbors(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @BodyParam("application/json") EnableDisableOnResources body,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/{l3IsolationDomainName}/externalNetworks/{externalNetworkName}/clearArpEntries")
        @ExpectedResponses({202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> clearArpEntries(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("l3IsolationDomainName") String l3IsolationDomainName,
            @PathParam("externalNetworkName") String externalNetworkName,
            @BodyParam("application/json") EnableDisableOnResources body,
            @HeaderParam("Accept") String accept,
            Context context);

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

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createWithResponseAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkInner body) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .create(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            body,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 defines the ExternalNetwork item along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkInner body,
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .create(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                body,
                accept,
                context);
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginCreateAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkInner body) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body);
        return this
            .client
            .<ExternalNetworkInner, ExternalNetworkInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                ExternalNetworkInner.class,
                ExternalNetworkInner.class,
                this.client.getContext());
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginCreateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkInner body,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context);
        return this
            .client
            .<ExternalNetworkInner, ExternalNetworkInner>getLroResult(
                mono, this.client.getHttpPipeline(), ExternalNetworkInner.class, ExternalNetworkInner.class, context);
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginCreate(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkInner body) {
        return this
            .beginCreateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .getSyncPoller();
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginCreate(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkInner body,
        Context context) {
        return this
            .beginCreateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .getSyncPoller();
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<ExternalNetworkInner> createAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkInner body) {
        return beginCreateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 defines the ExternalNetwork item on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<ExternalNetworkInner> createAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkInner body,
        Context context) {
        return beginCreateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ExternalNetworkInner create(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkInner body) {
        return createAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body).block();
    }

    /**
     * Creates ExternalNetwork for Layer3 Isolation Domain for communication of computes with external services
     *
     * <p>Creates ExternalNetwork PUT method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ExternalNetworkInner create(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkInner body,
        Context context) {
        return createAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context).block();
    }

    /**
     * Retrieves details of ExternalNetwork.
     *
     * <p>Implements ExternalNetworks GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<ExternalNetworkInner>> getWithResponseAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .get(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Retrieves details of ExternalNetwork.
     *
     * <p>Implements ExternalNetworks GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @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 defines the ExternalNetwork item along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<ExternalNetworkInner>> getWithResponseAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, 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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .get(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                accept,
                context);
    }

    /**
     * Retrieves details of ExternalNetwork.
     *
     * <p>Implements ExternalNetworks GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<ExternalNetworkInner> getAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName) {
        return getWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Retrieves details of ExternalNetwork.
     *
     * <p>Implements ExternalNetworks GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @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 defines the ExternalNetwork item along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<ExternalNetworkInner> getWithResponse(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, Context context) {
        return getWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, context).block();
    }

    /**
     * Retrieves details of ExternalNetwork.
     *
     * <p>Implements ExternalNetworks GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ExternalNetworkInner get(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName) {
        return getWithResponse(resourceGroupName, l3IsolationDomainName, externalNetworkName, Context.NONE).getValue();
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkPatch body) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .update(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            body,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @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 defines the ExternalNetwork item along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkPatch body,
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .update(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                body,
                accept,
                context);
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginUpdateAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkPatch body) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body);
        return this
            .client
            .<ExternalNetworkInner, ExternalNetworkInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                ExternalNetworkInner.class,
                ExternalNetworkInner.class,
                this.client.getContext());
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginUpdateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkPatch body,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context);
        return this
            .client
            .<ExternalNetworkInner, ExternalNetworkInner>getLroResult(
                mono, this.client.getHttpPipeline(), ExternalNetworkInner.class, ExternalNetworkInner.class, context);
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginUpdate(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkPatch body) {
        return this
            .beginUpdateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .getSyncPoller();
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<ExternalNetworkInner>, ExternalNetworkInner> beginUpdate(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkPatch body,
        Context context) {
        return this
            .beginUpdateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .getSyncPoller();
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<ExternalNetworkInner> updateAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkPatch body) {
        return beginUpdateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @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 defines the ExternalNetwork item on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<ExternalNetworkInner> updateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkPatch body,
        Context context) {
        return beginUpdateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ExternalNetworkInner update(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, ExternalNetworkPatch body) {
        return updateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body).block();
    }

    /**
     * Updates a ExternalNetworks.
     *
     * <p>API to update certain properties of the ExternalNetworks resource.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body ExternalNetwork properties to update. Only annotations are supported.
     * @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 defines the ExternalNetwork item.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ExternalNetworkInner update(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        ExternalNetworkPatch body,
        Context context) {
        return updateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context).block();
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .delete(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @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<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, 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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName 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,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                accept,
                context);
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginDeleteAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @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<PollResult<Void>, Void> beginDeleteAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginDelete(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName) {
        return this.beginDeleteAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName).getSyncPoller();
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @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<PollResult<Void>, Void> beginDelete(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, Context context) {
        return this
            .beginDeleteAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, context)
            .getSyncPoller();
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void> deleteAsync(String resourceGroupName, String l3IsolationDomainName, String externalNetworkName) {
        return beginDeleteAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @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<Void> deleteAsync(
        String resourceGroupName, String l3IsolationDomainName, String externalNetworkName, Context context) {
        return beginDeleteAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 l3IsolationDomainName, String externalNetworkName) {
        deleteAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName).block();
    }

    /**
     * Deletes a ExternalNetworks.
     *
     * <p>Implements ExternalNetworks DELETE method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @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 l3IsolationDomainName, String externalNetworkName, Context context) {
        deleteAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, context).block();
    }

    /**
     * Executes list operation to display External Networks within an isolation domain.
     *
     * <p>Implements External Networks list by resource group GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return list of ExternalNetworks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<ExternalNetworkInner>> listSinglePageAsync(
        String resourceGroupName, String l3IsolationDomainName) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .list(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            accept,
                            context))
            .<PagedResponse<ExternalNetworkInner>>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()));
    }

    /**
     * Executes list operation to display External Networks within an isolation domain.
     *
     * <p>Implements External Networks list by resource group GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return list of ExternalNetworks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<ExternalNetworkInner>> listSinglePageAsync(
        String resourceGroupName, String l3IsolationDomainName, 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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName 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(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Executes list operation to display External Networks within an isolation domain.
     *
     * <p>Implements External Networks list by resource group GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return list of ExternalNetworks as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<ExternalNetworkInner> listAsync(String resourceGroupName, String l3IsolationDomainName) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, l3IsolationDomainName),
            nextLink -> listNextSinglePageAsync(nextLink));
    }

    /**
     * Executes list operation to display External Networks within an isolation domain.
     *
     * <p>Implements External Networks list by resource group GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return list of ExternalNetworks as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<ExternalNetworkInner> listAsync(
        String resourceGroupName, String l3IsolationDomainName, Context context) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, l3IsolationDomainName, context),
            nextLink -> listNextSinglePageAsync(nextLink, context));
    }

    /**
     * Executes list operation to display External Networks within an isolation domain.
     *
     * <p>Implements External Networks list by resource group GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return list of ExternalNetworks as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<ExternalNetworkInner> list(String resourceGroupName, String l3IsolationDomainName) {
        return new PagedIterable<>(listAsync(resourceGroupName, l3IsolationDomainName));
    }

    /**
     * Executes list operation to display External Networks within an isolation domain.
     *
     * <p>Implements External Networks list by resource group GET method.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return list of ExternalNetworks as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<ExternalNetworkInner> list(
        String resourceGroupName, String l3IsolationDomainName, Context context) {
        return new PagedIterable<>(listAsync(resourceGroupName, l3IsolationDomainName, context));
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Response<Flux<ByteBuffer>>> updateAdministrativeStateWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateAdministrativeState(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            body,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Response<Flux<ByteBuffer>>> updateAdministrativeStateWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateAdministrativeState(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                body,
                accept,
                context);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginUpdateAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateAdministrativeStateWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginUpdateAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateAdministrativeStateWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginUpdateAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        return this
            .beginUpdateAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .getSyncPoller();
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginUpdateAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        return this
            .beginUpdateAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .getSyncPoller();
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void> updateAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        return beginUpdateAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Void> updateAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        return beginUpdateAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 updateAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        updateAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body).block();
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>Executes update operation to enable or disable administrative State for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 updateAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        updateAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .block();
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Response<Flux<ByteBuffer>>> updateBgpAdministrativeStateWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateBgpAdministrativeState(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            body,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Response<Flux<ByteBuffer>>> updateBgpAdministrativeStateWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateBgpAdministrativeState(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                body,
                accept,
                context);
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginUpdateBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateBgpAdministrativeStateWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginUpdateBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateBgpAdministrativeStateWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginUpdateBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        return this
            .beginUpdateBgpAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .getSyncPoller();
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginUpdateBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        return this
            .beginUpdateBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .getSyncPoller();
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void> updateBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        return beginUpdateBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Void> updateBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        return beginUpdateBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 updateBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        updateBgpAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body).block();
    }

    /**
     * Executes BGP state update operation to the underlying resources.
     *
     * <p>Update BGP for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 updateBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        updateBgpAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .block();
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Response<Flux<ByteBuffer>>> updateBfdForBgpAdministrativeStateWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateBfdForBgpAdministrativeState(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            body,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Response<Flux<ByteBuffer>>> updateBfdForBgpAdministrativeStateWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateBfdForBgpAdministrativeState(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                body,
                accept,
                context);
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginUpdateBfdForBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateBfdForBgpAdministrativeStateWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginUpdateBfdForBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateBfdForBgpAdministrativeStateWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginUpdateBfdForBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        return this
            .beginUpdateBfdForBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .getSyncPoller();
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginUpdateBfdForBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        return this
            .beginUpdateBfdForBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .getSyncPoller();
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void> updateBfdForBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        return beginUpdateBfdForBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Void> updateBfdForBgpAdministrativeStateAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        return beginUpdateBfdForBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 updateBfdForBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body) {
        updateBfdForBgpAdministrativeStateAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .block();
    }

    /**
     * Execute BfdForBgp update operation to the underlying resources.
     *
     * <p>Update BfdForBgp for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 updateBfdForBgpAdministrativeState(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        UpdateAdministrativeState body,
        Context context) {
        updateBfdForBgpAdministrativeStateAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .block();
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Response<Flux<ByteBuffer>>> clearIpv6NeighborsWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .clearIpv6Neighbors(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            body,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Response<Flux<ByteBuffer>>> clearIpv6NeighborsWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .clearIpv6Neighbors(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                body,
                accept,
                context);
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginClearIpv6NeighborsAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            clearIpv6NeighborsWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginClearIpv6NeighborsAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            clearIpv6NeighborsWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginClearIpv6Neighbors(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        return this
            .beginClearIpv6NeighborsAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .getSyncPoller();
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginClearIpv6Neighbors(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        return this
            .beginClearIpv6NeighborsAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .getSyncPoller();
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void> clearIpv6NeighborsAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        return beginClearIpv6NeighborsAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Void> clearIpv6NeighborsAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        return beginClearIpv6NeighborsAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 clearIpv6Neighbors(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        clearIpv6NeighborsAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body).block();
    }

    /**
     * Executes clearIpv6Neighbors table operation to the underlying resources.
     *
     * <p>clearIpv6Neighbors for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 clearIpv6Neighbors(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        clearIpv6NeighborsAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context).block();
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Response<Flux<ByteBuffer>>> clearArpEntriesWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .clearArpEntries(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            l3IsolationDomainName,
                            externalNetworkName,
                            body,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Response<Flux<ByteBuffer>>> clearArpEntriesWithResponseAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        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 (l3IsolationDomainName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter l3IsolationDomainName is required and cannot be null."));
        }
        if (externalNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter externalNetworkName is required and cannot be null."));
        }
        if (body == null) {
            return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null."));
        } else {
            body.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .clearArpEntries(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                l3IsolationDomainName,
                externalNetworkName,
                body,
                accept,
                context);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginClearArpEntriesAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            clearArpEntriesWithResponseAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginClearArpEntriesAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            clearArpEntriesWithResponseAsync(
                resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<PollResult<Void>, Void> beginClearArpEntries(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        return this
            .beginClearArpEntriesAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .getSyncPoller();
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<PollResult<Void>, Void> beginClearArpEntries(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        return this
            .beginClearArpEntriesAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .getSyncPoller();
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void> clearArpEntriesAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        return beginClearArpEntriesAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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<Void> clearArpEntriesAsync(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        return beginClearArpEntriesAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 clearArpEntries(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body) {
        clearArpEntriesAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body).block();
    }

    /**
     * Implements the operation to the underlying resources.
     *
     * <p>clearArpEntries for externalNetwork.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param l3IsolationDomainName Name of the L3IsolationDomain.
     * @param externalNetworkName Name of the ExternalNetwork.
     * @param body Request payload.
     * @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 clearArpEntries(
        String resourceGroupName,
        String l3IsolationDomainName,
        String externalNetworkName,
        EnableDisableOnResources body,
        Context context) {
        clearArpEntriesAsync(resourceGroupName, l3IsolationDomainName, externalNetworkName, body, context).block();
    }

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

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