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

package com.azure.resourcemanager.avs.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.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.avs.fluent.WorkloadNetworksClient;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkDhcpInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkDnsServiceInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkDnsZoneInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkGatewayInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkPortMirroringInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkPublicIpInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkSegmentInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkVMGroupInner;
import com.azure.resourcemanager.avs.fluent.models.WorkloadNetworkVirtualMachineInner;
import com.azure.resourcemanager.avs.models.WorkloadNetworkDhcpList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkDnsServicesList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkDnsZonesList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkGatewayList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkName;
import com.azure.resourcemanager.avs.models.WorkloadNetworkPortMirroringList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkPublicIPsList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkSegmentsList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkVMGroupsList;
import com.azure.resourcemanager.avs.models.WorkloadNetworkVirtualMachinesList;
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 WorkloadNetworksClient. */
public final class WorkloadNetworksClientImpl implements WorkloadNetworksClient {
    /** The proxy service used to perform REST calls. */
    private final WorkloadNetworksService service;

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

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

    /**
     * The interface defining all the services for AvsClientWorkloadNetworks to be used by the proxy service to perform
     * REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "AvsClientWorkloadNet")
    public interface WorkloadNetworksService {
        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/{workloadNetworkName}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkInner>> get(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("workloadNetworkName") WorkloadNetworkName workloadNetworkName,
            @HeaderParam("Accept") String accept,
            Context context);

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

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/segments")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkSegmentsList>> listSegments(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/segments/{segmentId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkSegmentInner>> getSegment(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("segmentId") String segmentId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/segments/{segmentId}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createSegments(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("segmentId") String segmentId,
            @BodyParam("application/json") WorkloadNetworkSegmentInner workloadNetworkSegment,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Patch(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/segments/{segmentId}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateSegments(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("segmentId") String segmentId,
            @BodyParam("application/json") WorkloadNetworkSegmentInner workloadNetworkSegment,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/segments/{segmentId}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> deleteSegment(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("segmentId") String segmentId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dhcpConfigurations")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkDhcpList>> listDhcp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkDhcpInner>> getDhcp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("dhcpId") String dhcpId,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createDhcp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dhcpId") String dhcpId,
            @BodyParam("application/json") WorkloadNetworkDhcpInner workloadNetworkDhcp,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Patch(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateDhcp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dhcpId") String dhcpId,
            @BodyParam("application/json") WorkloadNetworkDhcpInner workloadNetworkDhcp,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> deleteDhcp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dhcpId") String dhcpId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/gateways")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkGatewayList>> listGateways(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkGatewayInner>> getGateway(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("gatewayId") String gatewayId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/portMirroringProfiles")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkPortMirroringList>> listPortMirroring(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkPortMirroringInner>> getPortMirroring(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("portMirroringId") String portMirroringId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createPortMirroring(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("portMirroringId") String portMirroringId,
            @BodyParam("application/json") WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Patch(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updatePortMirroring(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("portMirroringId") String portMirroringId,
            @BodyParam("application/json") WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> deletePortMirroring(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("portMirroringId") String portMirroringId,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/vmGroups")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkVMGroupsList>> listVMGroups(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkVMGroupInner>> getVMGroup(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("vmGroupId") String vmGroupId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createVMGroup(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("vmGroupId") String vmGroupId,
            @BodyParam("application/json") WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Patch(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateVMGroup(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("vmGroupId") String vmGroupId,
            @BodyParam("application/json") WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> deleteVMGroup(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("vmGroupId") String vmGroupId,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/virtualMachines")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkVirtualMachinesList>> listVirtualMachines(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkVirtualMachineInner>> getVirtualMachine(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("virtualMachineId") String virtualMachineId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsServices")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkDnsServicesList>> listDnsServices(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkDnsServiceInner>> getDnsService(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dnsServiceId") String dnsServiceId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createDnsService(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dnsServiceId") String dnsServiceId,
            @BodyParam("application/json") WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Patch(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateDnsService(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dnsServiceId") String dnsServiceId,
            @BodyParam("application/json") WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> deleteDnsService(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("dnsServiceId") String dnsServiceId,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsZones")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkDnsZonesList>> listDnsZones(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkDnsZoneInner>> getDnsZone(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dnsZoneId") String dnsZoneId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createDnsZone(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dnsZoneId") String dnsZoneId,
            @BodyParam("application/json") WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Patch(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> updateDnsZone(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("dnsZoneId") String dnsZoneId,
            @BodyParam("application/json") WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> deleteDnsZone(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("dnsZoneId") String dnsZoneId,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/publicIPs")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkPublicIPsList>> listPublicIPs(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<WorkloadNetworkPublicIpInner>> getPublicIp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("publicIPId") String publicIpId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}")
        @ExpectedResponses({200, 201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createPublicIp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("privateCloudName") String privateCloudName,
            @PathParam("publicIPId") String publicIpId,
            @BodyParam("application/json") WorkloadNetworkPublicIpInner workloadNetworkPublicIp,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Delete(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
                + "/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> deletePublicIp(
            @HostParam("$host") String endpoint,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @QueryParam("api-version") String apiVersion,
            @PathParam("publicIPId") String publicIpId,
            @PathParam("privateCloudName") String privateCloudName,
            @HeaderParam("Accept") String accept,
            Context context);

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

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

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

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

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

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

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

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

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

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

    /**
     * Get a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param workloadNetworkName Name for the workload network in the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 private cloud workload network along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkInner>> getWithResponseAsync(
        String resourceGroupName, String privateCloudName, WorkloadNetworkName workloadNetworkName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (workloadNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter workloadNetworkName 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(),
                            privateCloudName,
                            workloadNetworkName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param workloadNetworkName Name for the workload network in the private cloud.
     * @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 private cloud workload network along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkInner>> getWithResponseAsync(
        String resourceGroupName, String privateCloudName, WorkloadNetworkName workloadNetworkName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (workloadNetworkName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter workloadNetworkName 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(),
                privateCloudName,
                workloadNetworkName,
                accept,
                context);
    }

    /**
     * Get a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param workloadNetworkName Name for the workload network in the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkInner> getAsync(
        String resourceGroupName, String privateCloudName, WorkloadNetworkName workloadNetworkName) {
        return getWithResponseAsync(resourceGroupName, privateCloudName, workloadNetworkName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param workloadNetworkName Name for the workload network in the private cloud.
     * @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 private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkInner> getWithResponse(
        String resourceGroupName, String privateCloudName, WorkloadNetworkName workloadNetworkName, Context context) {
        return getWithResponseAsync(resourceGroupName, privateCloudName, workloadNetworkName, context).block();
    }

    /**
     * Get a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param workloadNetworkName Name for the workload network in the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkInner get(
        String resourceGroupName, String privateCloudName, WorkloadNetworkName workloadNetworkName) {
        return getWithResponse(resourceGroupName, privateCloudName, workloadNetworkName, Context.NONE).getValue();
    }

    /**
     * List of workload networks in a private cloud.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of workload networks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkInner>> listSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName 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(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of workload networks in a private cloud.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of workload networks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkInner>> listSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName 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(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of workload networks in a private cloud.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of workload networks as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkInner> listAsync(String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listNextSinglePageAsync(nextLink));
    }

    /**
     * List of workload networks in a private cloud.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of workload networks as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkInner> listAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of workload networks in a private cloud.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of workload networks as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkInner> list(String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of workload networks in a private cloud.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of workload networks as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkInner> list(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * List of segments in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Segments along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkSegmentInner>> listSegmentsSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listSegments(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkSegmentInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of segments in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Segments along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkSegmentInner>> listSegmentsSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listSegments(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of segments in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Segments as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkSegmentInner> listSegmentsAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listSegmentsSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listSegmentsNextSinglePageAsync(nextLink));
    }

    /**
     * List of segments in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Segments as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkSegmentInner> listSegmentsAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listSegmentsSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listSegmentsNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of segments in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Segments as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkSegmentInner> listSegments(String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listSegmentsAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of segments in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Segments as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkSegmentInner> listSegments(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listSegmentsAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 segment by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkSegmentInner>> getSegmentWithResponseAsync(
        String resourceGroupName, String privateCloudName, String segmentId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getSegment(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            segmentId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @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 segment by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkSegmentInner>> getSegmentWithResponseAsync(
        String resourceGroupName, String privateCloudName, String segmentId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getSegment(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                segmentId,
                accept,
                context);
    }

    /**
     * Get a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 segment by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkSegmentInner> getSegmentAsync(
        String resourceGroupName, String privateCloudName, String segmentId) {
        return getSegmentWithResponseAsync(resourceGroupName, privateCloudName, segmentId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @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 segment by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkSegmentInner> getSegmentWithResponse(
        String resourceGroupName, String privateCloudName, String segmentId, Context context) {
        return getSegmentWithResponseAsync(resourceGroupName, privateCloudName, segmentId, context).block();
    }

    /**
     * Get a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 segment by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkSegmentInner getSegment(String resourceGroupName, String privateCloudName, String segmentId) {
        return getSegmentWithResponse(resourceGroupName, privateCloudName, segmentId, Context.NONE).getValue();
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Segment along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createSegmentsWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        if (workloadNetworkSegment == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkSegment is required and cannot be null."));
        } else {
            workloadNetworkSegment.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createSegments(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            segmentId,
                            workloadNetworkSegment,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createSegmentsWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        if (workloadNetworkSegment == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkSegment is required and cannot be null."));
        } else {
            workloadNetworkSegment.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createSegments(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                segmentId,
                workloadNetworkSegment,
                accept,
                context);
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginCreateSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createSegmentsWithResponseAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment);
        return this
            .client
            .<WorkloadNetworkSegmentInner, WorkloadNetworkSegmentInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkSegmentInner.class,
                WorkloadNetworkSegmentInner.class,
                this.client.getContext());
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginCreateSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createSegmentsWithResponseAsync(
                resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context);
        return this
            .client
            .<WorkloadNetworkSegmentInner, WorkloadNetworkSegmentInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkSegmentInner.class,
                WorkloadNetworkSegmentInner.class,
                context);
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginCreateSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        return this
            .beginCreateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment)
            .getSyncPoller();
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginCreateSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        return this
            .beginCreateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context)
            .getSyncPoller();
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Segment on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkSegmentInner> createSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        return beginCreateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkSegmentInner> createSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        return beginCreateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkSegmentInner createSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        return createSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment).block();
    }

    /**
     * Create a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkSegmentInner createSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        return createSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context)
            .block();
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Segment along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateSegmentsWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        if (workloadNetworkSegment == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkSegment is required and cannot be null."));
        } else {
            workloadNetworkSegment.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateSegments(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            segmentId,
                            workloadNetworkSegment,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateSegmentsWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        if (workloadNetworkSegment == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkSegment is required and cannot be null."));
        } else {
            workloadNetworkSegment.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateSegments(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                segmentId,
                workloadNetworkSegment,
                accept,
                context);
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginUpdateSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateSegmentsWithResponseAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment);
        return this
            .client
            .<WorkloadNetworkSegmentInner, WorkloadNetworkSegmentInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkSegmentInner.class,
                WorkloadNetworkSegmentInner.class,
                this.client.getContext());
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginUpdateSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateSegmentsWithResponseAsync(
                resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context);
        return this
            .client
            .<WorkloadNetworkSegmentInner, WorkloadNetworkSegmentInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkSegmentInner.class,
                WorkloadNetworkSegmentInner.class,
                context);
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginUpdateSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        return this
            .beginUpdateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment)
            .getSyncPoller();
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkSegmentInner>, WorkloadNetworkSegmentInner> beginUpdateSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        return this
            .beginUpdateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context)
            .getSyncPoller();
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Segment on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkSegmentInner> updateSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        return beginUpdateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkSegmentInner> updateSegmentsAsync(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        return beginUpdateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkSegmentInner updateSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment) {
        return updateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment).block();
    }

    /**
     * Create or update a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @param workloadNetworkSegment NSX Segment.
     * @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 nSX Segment.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkSegmentInner updateSegments(
        String resourceGroupName,
        String privateCloudName,
        String segmentId,
        WorkloadNetworkSegmentInner workloadNetworkSegment,
        Context context) {
        return updateSegmentsAsync(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment, context)
            .block();
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>>> deleteSegmentWithResponseAsync(
        String resourceGroupName, String privateCloudName, String segmentId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .deleteSegment(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            segmentId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @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>>> deleteSegmentWithResponseAsync(
        String resourceGroupName, String privateCloudName, String segmentId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (segmentId == null) {
            return Mono.error(new IllegalArgumentException("Parameter segmentId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .deleteSegment(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                segmentId,
                accept,
                context);
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteSegmentAsync(
        String resourceGroupName, String privateCloudName, String segmentId) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteSegmentWithResponseAsync(resourceGroupName, privateCloudName, segmentId);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @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> beginDeleteSegmentAsync(
        String resourceGroupName, String privateCloudName, String segmentId, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteSegmentWithResponseAsync(resourceGroupName, privateCloudName, segmentId, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteSegment(
        String resourceGroupName, String privateCloudName, String segmentId) {
        return this.beginDeleteSegmentAsync(resourceGroupName, privateCloudName, segmentId).getSyncPoller();
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @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> beginDeleteSegment(
        String resourceGroupName, String privateCloudName, String segmentId, Context context) {
        return this.beginDeleteSegmentAsync(resourceGroupName, privateCloudName, segmentId, context).getSyncPoller();
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> deleteSegmentAsync(String resourceGroupName, String privateCloudName, String segmentId) {
        return beginDeleteSegmentAsync(resourceGroupName, privateCloudName, segmentId)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @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> deleteSegmentAsync(
        String resourceGroupName, String privateCloudName, String segmentId, Context context) {
        return beginDeleteSegmentAsync(resourceGroupName, privateCloudName, segmentId, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 deleteSegment(String resourceGroupName, String privateCloudName, String segmentId) {
        deleteSegmentAsync(resourceGroupName, privateCloudName, segmentId).block();
    }

    /**
     * Delete a segment by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param segmentId NSX Segment identifier. Generally the same as the Segment's display name.
     * @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 deleteSegment(String resourceGroupName, String privateCloudName, String segmentId, Context context) {
        deleteSegmentAsync(resourceGroupName, privateCloudName, segmentId, context).block();
    }

    /**
     * List dhcp in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX dhcp entities along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDhcpInner>> listDhcpSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listDhcp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkDhcpInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List dhcp in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX dhcp entities along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDhcpInner>> listDhcpSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listDhcp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List dhcp in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX dhcp entities as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkDhcpInner> listDhcpAsync(String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listDhcpSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listDhcpNextSinglePageAsync(nextLink));
    }

    /**
     * List dhcp in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX dhcp entities as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkDhcpInner> listDhcpAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listDhcpSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listDhcpNextSinglePageAsync(nextLink, context));
    }

    /**
     * List dhcp in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX dhcp entities as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkDhcpInner> listDhcp(String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listDhcpAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List dhcp in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX dhcp entities as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkDhcpInner> listDhcp(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listDhcpAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return dhcp by id in a private cloud workload network along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkDhcpInner>> getDhcpWithResponseAsync(
        String resourceGroupName, String dhcpId, String privateCloudName) {
        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 (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getDhcp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            dhcpId,
                            privateCloudName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param privateCloudName Name of the private cloud.
     * @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 dhcp by id in a private cloud workload network along with {@link Response} on successful completion of
     *     {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkDhcpInner>> getDhcpWithResponseAsync(
        String resourceGroupName, String dhcpId, String privateCloudName, 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 (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getDhcp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                dhcpId,
                privateCloudName,
                accept,
                context);
    }

    /**
     * Get dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return dhcp by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDhcpInner> getDhcpAsync(
        String resourceGroupName, String dhcpId, String privateCloudName) {
        return getDhcpWithResponseAsync(resourceGroupName, dhcpId, privateCloudName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param privateCloudName Name of the private cloud.
     * @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 dhcp by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkDhcpInner> getDhcpWithResponse(
        String resourceGroupName, String dhcpId, String privateCloudName, Context context) {
        return getDhcpWithResponseAsync(resourceGroupName, dhcpId, privateCloudName, context).block();
    }

    /**
     * Get dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return dhcp by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDhcpInner getDhcp(String resourceGroupName, String dhcpId, String privateCloudName) {
        return getDhcpWithResponse(resourceGroupName, dhcpId, privateCloudName, Context.NONE).getValue();
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DHCP along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createDhcpWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        if (workloadNetworkDhcp == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter workloadNetworkDhcp is required and cannot be null."));
        } else {
            workloadNetworkDhcp.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createDhcp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dhcpId,
                            workloadNetworkDhcp,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createDhcpWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        if (workloadNetworkDhcp == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter workloadNetworkDhcp is required and cannot be null."));
        } else {
            workloadNetworkDhcp.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createDhcp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dhcpId,
                workloadNetworkDhcp,
                accept,
                context);
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginCreateDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createDhcpWithResponseAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp);
        return this
            .client
            .<WorkloadNetworkDhcpInner, WorkloadNetworkDhcpInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDhcpInner.class,
                WorkloadNetworkDhcpInner.class,
                this.client.getContext());
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginCreateDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createDhcpWithResponseAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context);
        return this
            .client
            .<WorkloadNetworkDhcpInner, WorkloadNetworkDhcpInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDhcpInner.class,
                WorkloadNetworkDhcpInner.class,
                context);
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginCreateDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        return this
            .beginCreateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp)
            .getSyncPoller();
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginCreateDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        return this
            .beginCreateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context)
            .getSyncPoller();
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DHCP on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDhcpInner> createDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        return beginCreateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDhcpInner> createDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        return beginCreateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDhcpInner createDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        return createDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp).block();
    }

    /**
     * Create dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDhcpInner createDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        return createDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context).block();
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DHCP along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateDhcpWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        if (workloadNetworkDhcp == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter workloadNetworkDhcp is required and cannot be null."));
        } else {
            workloadNetworkDhcp.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateDhcp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dhcpId,
                            workloadNetworkDhcp,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateDhcpWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        if (workloadNetworkDhcp == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter workloadNetworkDhcp is required and cannot be null."));
        } else {
            workloadNetworkDhcp.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateDhcp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dhcpId,
                workloadNetworkDhcp,
                accept,
                context);
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginUpdateDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateDhcpWithResponseAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp);
        return this
            .client
            .<WorkloadNetworkDhcpInner, WorkloadNetworkDhcpInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDhcpInner.class,
                WorkloadNetworkDhcpInner.class,
                this.client.getContext());
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginUpdateDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateDhcpWithResponseAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context);
        return this
            .client
            .<WorkloadNetworkDhcpInner, WorkloadNetworkDhcpInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDhcpInner.class,
                WorkloadNetworkDhcpInner.class,
                context);
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginUpdateDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        return this
            .beginUpdateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp)
            .getSyncPoller();
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDhcpInner>, WorkloadNetworkDhcpInner> beginUpdateDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        return this
            .beginUpdateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context)
            .getSyncPoller();
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DHCP on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDhcpInner> updateDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        return beginUpdateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDhcpInner> updateDhcpAsync(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        return beginUpdateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDhcpInner updateDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp) {
        return updateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp).block();
    }

    /**
     * Create or update dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @param workloadNetworkDhcp NSX DHCP.
     * @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 nSX DHCP.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDhcpInner updateDhcp(
        String resourceGroupName,
        String privateCloudName,
        String dhcpId,
        WorkloadNetworkDhcpInner workloadNetworkDhcp,
        Context context) {
        return updateDhcpAsync(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp, context).block();
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>>> deleteDhcpWithResponseAsync(
        String resourceGroupName, String privateCloudName, String dhcpId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .deleteDhcp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dhcpId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @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>>> deleteDhcpWithResponseAsync(
        String resourceGroupName, String privateCloudName, String dhcpId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dhcpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dhcpId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .deleteDhcp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dhcpId,
                accept,
                context);
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteDhcpAsync(
        String resourceGroupName, String privateCloudName, String dhcpId) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteDhcpWithResponseAsync(resourceGroupName, privateCloudName, dhcpId);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @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> beginDeleteDhcpAsync(
        String resourceGroupName, String privateCloudName, String dhcpId, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteDhcpWithResponseAsync(resourceGroupName, privateCloudName, dhcpId, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteDhcp(
        String resourceGroupName, String privateCloudName, String dhcpId) {
        return this.beginDeleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId).getSyncPoller();
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @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> beginDeleteDhcp(
        String resourceGroupName, String privateCloudName, String dhcpId, Context context) {
        return this.beginDeleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId, context).getSyncPoller();
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> deleteDhcpAsync(String resourceGroupName, String privateCloudName, String dhcpId) {
        return beginDeleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @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> deleteDhcpAsync(
        String resourceGroupName, String privateCloudName, String dhcpId, Context context) {
        return beginDeleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 deleteDhcp(String resourceGroupName, String privateCloudName, String dhcpId) {
        deleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId).block();
    }

    /**
     * Delete dhcp by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dhcpId NSX DHCP identifier. Generally the same as the DHCP display name.
     * @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 deleteDhcp(String resourceGroupName, String privateCloudName, String dhcpId, Context context) {
        deleteDhcpAsync(resourceGroupName, privateCloudName, dhcpId, context).block();
    }

    /**
     * List of gateways in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Gateways along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkGatewayInner>> listGatewaysSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listGateways(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkGatewayInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of gateways in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Gateways along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkGatewayInner>> listGatewaysSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listGateways(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of gateways in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Gateways as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkGatewayInner> listGatewaysAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listGatewaysSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listGatewaysNextSinglePageAsync(nextLink));
    }

    /**
     * List of gateways in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Gateways as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkGatewayInner> listGatewaysAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listGatewaysSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listGatewaysNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of gateways in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Gateways as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkGatewayInner> listGateways(String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listGatewaysAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of gateways in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Gateways as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkGatewayInner> listGateways(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listGatewaysAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a gateway by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param gatewayId NSX Gateway identifier. Generally the same as the Gateway's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 gateway by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkGatewayInner>> getGatewayWithResponseAsync(
        String resourceGroupName, String privateCloudName, String gatewayId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (gatewayId == null) {
            return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getGateway(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            gatewayId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a gateway by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param gatewayId NSX Gateway identifier. Generally the same as the Gateway's display name.
     * @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 gateway by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkGatewayInner>> getGatewayWithResponseAsync(
        String resourceGroupName, String privateCloudName, String gatewayId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (gatewayId == null) {
            return Mono.error(new IllegalArgumentException("Parameter gatewayId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getGateway(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                gatewayId,
                accept,
                context);
    }

    /**
     * Get a gateway by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param gatewayId NSX Gateway identifier. Generally the same as the Gateway's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 gateway by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkGatewayInner> getGatewayAsync(
        String resourceGroupName, String privateCloudName, String gatewayId) {
        return getGatewayWithResponseAsync(resourceGroupName, privateCloudName, gatewayId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a gateway by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param gatewayId NSX Gateway identifier. Generally the same as the Gateway's display name.
     * @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 gateway by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkGatewayInner> getGatewayWithResponse(
        String resourceGroupName, String privateCloudName, String gatewayId, Context context) {
        return getGatewayWithResponseAsync(resourceGroupName, privateCloudName, gatewayId, context).block();
    }

    /**
     * Get a gateway by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param gatewayId NSX Gateway identifier. Generally the same as the Gateway's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 gateway by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkGatewayInner getGateway(String resourceGroupName, String privateCloudName, String gatewayId) {
        return getGatewayWithResponse(resourceGroupName, privateCloudName, gatewayId, Context.NONE).getValue();
    }

    /**
     * List of port mirroring profiles in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Port Mirroring along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPortMirroringInner>> listPortMirroringSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listPortMirroring(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkPortMirroringInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of port mirroring profiles in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Port Mirroring along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPortMirroringInner>> listPortMirroringSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listPortMirroring(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of port mirroring profiles in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Port Mirroring as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkPortMirroringInner> listPortMirroringAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listPortMirroringSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listPortMirroringNextSinglePageAsync(nextLink));
    }

    /**
     * List of port mirroring profiles in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Port Mirroring as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkPortMirroringInner> listPortMirroringAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listPortMirroringSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listPortMirroringNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of port mirroring profiles in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Port Mirroring as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkPortMirroringInner> listPortMirroring(
        String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listPortMirroringAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of port mirroring profiles in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Port Mirroring as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkPortMirroringInner> listPortMirroring(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listPortMirroringAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 port mirroring profile by id in a private cloud workload network along with {@link Response} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkPortMirroringInner>> getPortMirroringWithResponseAsync(
        String resourceGroupName, String privateCloudName, String portMirroringId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getPortMirroring(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            portMirroringId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @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 port mirroring profile by id in a private cloud workload network along with {@link Response} on
     *     successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkPortMirroringInner>> getPortMirroringWithResponseAsync(
        String resourceGroupName, String privateCloudName, String portMirroringId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getPortMirroring(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                portMirroringId,
                accept,
                context);
    }

    /**
     * Get a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 port mirroring profile by id in a private cloud workload network on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPortMirroringInner> getPortMirroringAsync(
        String resourceGroupName, String privateCloudName, String portMirroringId) {
        return getPortMirroringWithResponseAsync(resourceGroupName, privateCloudName, portMirroringId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @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 port mirroring profile by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkPortMirroringInner> getPortMirroringWithResponse(
        String resourceGroupName, String privateCloudName, String portMirroringId, Context context) {
        return getPortMirroringWithResponseAsync(resourceGroupName, privateCloudName, portMirroringId, context).block();
    }

    /**
     * Get a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 port mirroring profile by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPortMirroringInner getPortMirroring(
        String resourceGroupName, String privateCloudName, String portMirroringId) {
        return getPortMirroringWithResponse(resourceGroupName, privateCloudName, portMirroringId, Context.NONE)
            .getValue();
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Port Mirroring along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createPortMirroringWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        if (workloadNetworkPortMirroring == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkPortMirroring is required and cannot be null."));
        } else {
            workloadNetworkPortMirroring.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createPortMirroring(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            portMirroringId,
                            workloadNetworkPortMirroring,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createPortMirroringWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        if (workloadNetworkPortMirroring == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkPortMirroring is required and cannot be null."));
        } else {
            workloadNetworkPortMirroring.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createPortMirroring(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                portMirroringId,
                workloadNetworkPortMirroring,
                accept,
                context);
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginCreatePortMirroringAsync(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createPortMirroringWithResponseAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring);
        return this
            .client
            .<WorkloadNetworkPortMirroringInner, WorkloadNetworkPortMirroringInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkPortMirroringInner.class,
                WorkloadNetworkPortMirroringInner.class,
                this.client.getContext());
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginCreatePortMirroringAsync(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
            Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createPortMirroringWithResponseAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context);
        return this
            .client
            .<WorkloadNetworkPortMirroringInner, WorkloadNetworkPortMirroringInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkPortMirroringInner.class,
                WorkloadNetworkPortMirroringInner.class,
                context);
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginCreatePortMirroring(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        return this
            .beginCreatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring)
            .getSyncPoller();
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginCreatePortMirroring(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
            Context context) {
        return this
            .beginCreatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context)
            .getSyncPoller();
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Port Mirroring on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPortMirroringInner> createPortMirroringAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        return beginCreatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPortMirroringInner> createPortMirroringAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
        Context context) {
        return beginCreatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPortMirroringInner createPortMirroring(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        return createPortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring)
            .block();
    }

    /**
     * Create a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPortMirroringInner createPortMirroring(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
        Context context) {
        return createPortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context)
            .block();
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Port Mirroring along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updatePortMirroringWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        if (workloadNetworkPortMirroring == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkPortMirroring is required and cannot be null."));
        } else {
            workloadNetworkPortMirroring.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updatePortMirroring(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            portMirroringId,
                            workloadNetworkPortMirroring,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updatePortMirroringWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        if (workloadNetworkPortMirroring == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkPortMirroring is required and cannot be null."));
        } else {
            workloadNetworkPortMirroring.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updatePortMirroring(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                portMirroringId,
                workloadNetworkPortMirroring,
                accept,
                context);
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginUpdatePortMirroringAsync(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updatePortMirroringWithResponseAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring);
        return this
            .client
            .<WorkloadNetworkPortMirroringInner, WorkloadNetworkPortMirroringInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkPortMirroringInner.class,
                WorkloadNetworkPortMirroringInner.class,
                this.client.getContext());
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginUpdatePortMirroringAsync(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
            Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updatePortMirroringWithResponseAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context);
        return this
            .client
            .<WorkloadNetworkPortMirroringInner, WorkloadNetworkPortMirroringInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkPortMirroringInner.class,
                WorkloadNetworkPortMirroringInner.class,
                context);
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginUpdatePortMirroring(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        return this
            .beginUpdatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring)
            .getSyncPoller();
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkPortMirroringInner>, WorkloadNetworkPortMirroringInner>
        beginUpdatePortMirroring(
            String resourceGroupName,
            String privateCloudName,
            String portMirroringId,
            WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
            Context context) {
        return this
            .beginUpdatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context)
            .getSyncPoller();
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Port Mirroring on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPortMirroringInner> updatePortMirroringAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        return beginUpdatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPortMirroringInner> updatePortMirroringAsync(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
        Context context) {
        return beginUpdatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPortMirroringInner updatePortMirroring(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring) {
        return updatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring)
            .block();
    }

    /**
     * Create or update a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param workloadNetworkPortMirroring NSX port mirroring.
     * @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 nSX Port Mirroring.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPortMirroringInner updatePortMirroring(
        String resourceGroupName,
        String privateCloudName,
        String portMirroringId,
        WorkloadNetworkPortMirroringInner workloadNetworkPortMirroring,
        Context context) {
        return updatePortMirroringAsync(
                resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring, context)
            .block();
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>>> deletePortMirroringWithResponseAsync(
        String resourceGroupName, String portMirroringId, String privateCloudName) {
        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 (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .deletePortMirroring(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            portMirroringId,
                            privateCloudName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @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>>> deletePortMirroringWithResponseAsync(
        String resourceGroupName, String portMirroringId, String privateCloudName, 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 (portMirroringId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter portMirroringId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .deletePortMirroring(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                portMirroringId,
                privateCloudName,
                accept,
                context);
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeletePortMirroringAsync(
        String resourceGroupName, String portMirroringId, String privateCloudName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deletePortMirroringWithResponseAsync(resourceGroupName, portMirroringId, privateCloudName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeletePortMirroringAsync(
        String resourceGroupName, String portMirroringId, String privateCloudName, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deletePortMirroringWithResponseAsync(resourceGroupName, portMirroringId, privateCloudName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeletePortMirroring(
        String resourceGroupName, String portMirroringId, String privateCloudName) {
        return this.beginDeletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName).getSyncPoller();
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeletePortMirroring(
        String resourceGroupName, String portMirroringId, String privateCloudName, Context context) {
        return this
            .beginDeletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName, context)
            .getSyncPoller();
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> deletePortMirroringAsync(
        String resourceGroupName, String portMirroringId, String privateCloudName) {
        return beginDeletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @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> deletePortMirroringAsync(
        String resourceGroupName, String portMirroringId, String privateCloudName, Context context) {
        return beginDeletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 deletePortMirroring(String resourceGroupName, String portMirroringId, String privateCloudName) {
        deletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName).block();
    }

    /**
     * Delete a port mirroring profile by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param portMirroringId NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name.
     * @param privateCloudName Name of the private cloud.
     * @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 deletePortMirroring(
        String resourceGroupName, String portMirroringId, String privateCloudName, Context context) {
        deletePortMirroringAsync(resourceGroupName, portMirroringId, privateCloudName, context).block();
    }

    /**
     * List of vm groups in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX VM Groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVMGroupInner>> listVMGroupsSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listVMGroups(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkVMGroupInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of vm groups in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX VM Groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVMGroupInner>> listVMGroupsSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listVMGroups(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of vm groups in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX VM Groups as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkVMGroupInner> listVMGroupsAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listVMGroupsSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listVMGroupsNextSinglePageAsync(nextLink));
    }

    /**
     * List of vm groups in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX VM Groups as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkVMGroupInner> listVMGroupsAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listVMGroupsSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listVMGroupsNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of vm groups in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX VM Groups as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkVMGroupInner> listVMGroups(String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listVMGroupsAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of vm groups in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX VM Groups as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkVMGroupInner> listVMGroups(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listVMGroupsAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 vm group by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkVMGroupInner>> getVMGroupWithResponseAsync(
        String resourceGroupName, String privateCloudName, String vmGroupId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getVMGroup(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            vmGroupId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @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 vm group by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkVMGroupInner>> getVMGroupWithResponseAsync(
        String resourceGroupName, String privateCloudName, String vmGroupId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getVMGroup(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                vmGroupId,
                accept,
                context);
    }

    /**
     * Get a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 vm group by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkVMGroupInner> getVMGroupAsync(
        String resourceGroupName, String privateCloudName, String vmGroupId) {
        return getVMGroupWithResponseAsync(resourceGroupName, privateCloudName, vmGroupId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @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 vm group by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkVMGroupInner> getVMGroupWithResponse(
        String resourceGroupName, String privateCloudName, String vmGroupId, Context context) {
        return getVMGroupWithResponseAsync(resourceGroupName, privateCloudName, vmGroupId, context).block();
    }

    /**
     * Get a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 vm group by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkVMGroupInner getVMGroup(String resourceGroupName, String privateCloudName, String vmGroupId) {
        return getVMGroupWithResponse(resourceGroupName, privateCloudName, vmGroupId, Context.NONE).getValue();
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createVMGroupWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        if (workloadNetworkVMGroup == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkVMGroup is required and cannot be null."));
        } else {
            workloadNetworkVMGroup.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createVMGroup(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            vmGroupId,
                            workloadNetworkVMGroup,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createVMGroupWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        if (workloadNetworkVMGroup == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkVMGroup is required and cannot be null."));
        } else {
            workloadNetworkVMGroup.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createVMGroup(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                vmGroupId,
                workloadNetworkVMGroup,
                accept,
                context);
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginCreateVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createVMGroupWithResponseAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup);
        return this
            .client
            .<WorkloadNetworkVMGroupInner, WorkloadNetworkVMGroupInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkVMGroupInner.class,
                WorkloadNetworkVMGroupInner.class,
                this.client.getContext());
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginCreateVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createVMGroupWithResponseAsync(
                resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context);
        return this
            .client
            .<WorkloadNetworkVMGroupInner, WorkloadNetworkVMGroupInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkVMGroupInner.class,
                WorkloadNetworkVMGroupInner.class,
                context);
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginCreateVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        return this
            .beginCreateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup)
            .getSyncPoller();
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginCreateVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        return this
            .beginCreateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context)
            .getSyncPoller();
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkVMGroupInner> createVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        return beginCreateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkVMGroupInner> createVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        return beginCreateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkVMGroupInner createVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        return createVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup).block();
    }

    /**
     * Create a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkVMGroupInner createVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        return createVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context)
            .block();
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateVMGroupWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        if (workloadNetworkVMGroup == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkVMGroup is required and cannot be null."));
        } else {
            workloadNetworkVMGroup.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateVMGroup(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            vmGroupId,
                            workloadNetworkVMGroup,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateVMGroupWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        if (workloadNetworkVMGroup == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkVMGroup is required and cannot be null."));
        } else {
            workloadNetworkVMGroup.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateVMGroup(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                vmGroupId,
                workloadNetworkVMGroup,
                accept,
                context);
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginUpdateVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateVMGroupWithResponseAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup);
        return this
            .client
            .<WorkloadNetworkVMGroupInner, WorkloadNetworkVMGroupInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkVMGroupInner.class,
                WorkloadNetworkVMGroupInner.class,
                this.client.getContext());
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginUpdateVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateVMGroupWithResponseAsync(
                resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context);
        return this
            .client
            .<WorkloadNetworkVMGroupInner, WorkloadNetworkVMGroupInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkVMGroupInner.class,
                WorkloadNetworkVMGroupInner.class,
                context);
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginUpdateVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        return this
            .beginUpdateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup)
            .getSyncPoller();
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkVMGroupInner>, WorkloadNetworkVMGroupInner> beginUpdateVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        return this
            .beginUpdateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context)
            .getSyncPoller();
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkVMGroupInner> updateVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        return beginUpdateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkVMGroupInner> updateVMGroupAsync(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        return beginUpdateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkVMGroupInner updateVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup) {
        return updateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup).block();
    }

    /**
     * Create or update a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param workloadNetworkVMGroup NSX VM Group.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX VM Group.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkVMGroupInner updateVMGroup(
        String resourceGroupName,
        String privateCloudName,
        String vmGroupId,
        WorkloadNetworkVMGroupInner workloadNetworkVMGroup,
        Context context) {
        return updateVMGroupAsync(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup, context)
            .block();
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>>> deleteVMGroupWithResponseAsync(
        String resourceGroupName, String vmGroupId, String privateCloudName) {
        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 (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .deleteVMGroup(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            vmGroupId,
                            privateCloudName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @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>>> deleteVMGroupWithResponseAsync(
        String resourceGroupName, String vmGroupId, String privateCloudName, 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 (vmGroupId == null) {
            return Mono.error(new IllegalArgumentException("Parameter vmGroupId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .deleteVMGroup(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                vmGroupId,
                privateCloudName,
                accept,
                context);
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteVMGroupAsync(
        String resourceGroupName, String vmGroupId, String privateCloudName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteVMGroupWithResponseAsync(resourceGroupName, vmGroupId, privateCloudName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeleteVMGroupAsync(
        String resourceGroupName, String vmGroupId, String privateCloudName, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteVMGroupWithResponseAsync(resourceGroupName, vmGroupId, privateCloudName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteVMGroup(
        String resourceGroupName, String vmGroupId, String privateCloudName) {
        return this.beginDeleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName).getSyncPoller();
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeleteVMGroup(
        String resourceGroupName, String vmGroupId, String privateCloudName, Context context) {
        return this.beginDeleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName, context).getSyncPoller();
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> deleteVMGroupAsync(String resourceGroupName, String vmGroupId, String privateCloudName) {
        return beginDeleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> deleteVMGroupAsync(
        String resourceGroupName, String vmGroupId, String privateCloudName, Context context) {
        return beginDeleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 deleteVMGroup(String resourceGroupName, String vmGroupId, String privateCloudName) {
        deleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName).block();
    }

    /**
     * Delete a vm group by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param vmGroupId NSX VM Group identifier. Generally the same as the VM Group's display name.
     * @param privateCloudName Name of the private cloud.
     * @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 deleteVMGroup(String resourceGroupName, String vmGroupId, String privateCloudName, Context context) {
        deleteVMGroupAsync(resourceGroupName, vmGroupId, privateCloudName, context).block();
    }

    /**
     * List of virtual machines in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Virtual Machines along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVirtualMachineInner>> listVirtualMachinesSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listVirtualMachines(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkVirtualMachineInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of virtual machines in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Virtual Machines along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVirtualMachineInner>> listVirtualMachinesSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listVirtualMachines(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of virtual machines in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Virtual Machines as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkVirtualMachineInner> listVirtualMachinesAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listVirtualMachinesSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listVirtualMachinesNextSinglePageAsync(nextLink));
    }

    /**
     * List of virtual machines in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Virtual Machines as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkVirtualMachineInner> listVirtualMachinesAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listVirtualMachinesSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listVirtualMachinesNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of virtual machines in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Virtual Machines as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkVirtualMachineInner> listVirtualMachines(
        String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listVirtualMachinesAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of virtual machines in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Virtual Machines as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkVirtualMachineInner> listVirtualMachines(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listVirtualMachinesAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a virtual machine by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param virtualMachineId Virtual Machine identifier.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 virtual machine by id in a private cloud workload network along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkVirtualMachineInner>> getVirtualMachineWithResponseAsync(
        String resourceGroupName, String privateCloudName, String virtualMachineId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (virtualMachineId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter virtualMachineId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getVirtualMachine(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            virtualMachineId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a virtual machine by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param virtualMachineId Virtual Machine identifier.
     * @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 virtual machine by id in a private cloud workload network along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkVirtualMachineInner>> getVirtualMachineWithResponseAsync(
        String resourceGroupName, String privateCloudName, String virtualMachineId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (virtualMachineId == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter virtualMachineId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getVirtualMachine(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                virtualMachineId,
                accept,
                context);
    }

    /**
     * Get a virtual machine by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param virtualMachineId Virtual Machine identifier.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 virtual machine by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkVirtualMachineInner> getVirtualMachineAsync(
        String resourceGroupName, String privateCloudName, String virtualMachineId) {
        return getVirtualMachineWithResponseAsync(resourceGroupName, privateCloudName, virtualMachineId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a virtual machine by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param virtualMachineId Virtual Machine identifier.
     * @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 virtual machine by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkVirtualMachineInner> getVirtualMachineWithResponse(
        String resourceGroupName, String privateCloudName, String virtualMachineId, Context context) {
        return getVirtualMachineWithResponseAsync(resourceGroupName, privateCloudName, virtualMachineId, context)
            .block();
    }

    /**
     * Get a virtual machine by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param virtualMachineId Virtual Machine identifier.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 virtual machine by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkVirtualMachineInner getVirtualMachine(
        String resourceGroupName, String privateCloudName, String virtualMachineId) {
        return getVirtualMachineWithResponse(resourceGroupName, privateCloudName, virtualMachineId, Context.NONE)
            .getValue();
    }

    /**
     * List of DNS services in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Services along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsServiceInner>> listDnsServicesSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listDnsServices(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkDnsServiceInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of DNS services in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Services along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsServiceInner>> listDnsServicesSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listDnsServices(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of DNS services in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Services as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkDnsServiceInner> listDnsServicesAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listDnsServicesSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listDnsServicesNextSinglePageAsync(nextLink));
    }

    /**
     * List of DNS services in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Services as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkDnsServiceInner> listDnsServicesAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listDnsServicesSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listDnsServicesNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of DNS services in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Services as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkDnsServiceInner> listDnsServices(
        String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listDnsServicesAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of DNS services in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Services as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkDnsServiceInner> listDnsServices(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listDnsServicesAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS service by id in a private cloud workload network along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkDnsServiceInner>> getDnsServiceWithResponseAsync(
        String resourceGroupName, String privateCloudName, String dnsServiceId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getDnsService(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dnsServiceId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS service by id in a private cloud workload network along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkDnsServiceInner>> getDnsServiceWithResponseAsync(
        String resourceGroupName, String privateCloudName, String dnsServiceId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getDnsService(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dnsServiceId,
                accept,
                context);
    }

    /**
     * Get a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS service by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsServiceInner> getDnsServiceAsync(
        String resourceGroupName, String privateCloudName, String dnsServiceId) {
        return getDnsServiceWithResponseAsync(resourceGroupName, privateCloudName, dnsServiceId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS service by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkDnsServiceInner> getDnsServiceWithResponse(
        String resourceGroupName, String privateCloudName, String dnsServiceId, Context context) {
        return getDnsServiceWithResponseAsync(resourceGroupName, privateCloudName, dnsServiceId, context).block();
    }

    /**
     * Get a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS service by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsServiceInner getDnsService(
        String resourceGroupName, String privateCloudName, String dnsServiceId) {
        return getDnsServiceWithResponse(resourceGroupName, privateCloudName, dnsServiceId, Context.NONE).getValue();
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Service along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createDnsServiceWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        if (workloadNetworkDnsService == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkDnsService is required and cannot be null."));
        } else {
            workloadNetworkDnsService.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createDnsService(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dnsServiceId,
                            workloadNetworkDnsService,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createDnsServiceWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        if (workloadNetworkDnsService == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkDnsService is required and cannot be null."));
        } else {
            workloadNetworkDnsService.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createDnsService(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dnsServiceId,
                workloadNetworkDnsService,
                accept,
                context);
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner>
        beginCreateDnsServiceAsync(
            String resourceGroupName,
            String privateCloudName,
            String dnsServiceId,
            WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createDnsServiceWithResponseAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService);
        return this
            .client
            .<WorkloadNetworkDnsServiceInner, WorkloadNetworkDnsServiceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsServiceInner.class,
                WorkloadNetworkDnsServiceInner.class,
                this.client.getContext());
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner>
        beginCreateDnsServiceAsync(
            String resourceGroupName,
            String privateCloudName,
            String dnsServiceId,
            WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
            Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createDnsServiceWithResponseAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context);
        return this
            .client
            .<WorkloadNetworkDnsServiceInner, WorkloadNetworkDnsServiceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsServiceInner.class,
                WorkloadNetworkDnsServiceInner.class,
                context);
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner> beginCreateDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        return this
            .beginCreateDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService)
            .getSyncPoller();
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner> beginCreateDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        Context context) {
        return this
            .beginCreateDnsServiceAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context)
            .getSyncPoller();
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Service on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsServiceInner> createDnsServiceAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        return beginCreateDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsServiceInner> createDnsServiceAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        Context context) {
        return beginCreateDnsServiceAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsServiceInner createDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        return createDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService)
            .block();
    }

    /**
     * Create a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsServiceInner createDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        Context context) {
        return createDnsServiceAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context)
            .block();
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Service along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateDnsServiceWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        if (workloadNetworkDnsService == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkDnsService is required and cannot be null."));
        } else {
            workloadNetworkDnsService.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateDnsService(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dnsServiceId,
                            workloadNetworkDnsService,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateDnsServiceWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        if (workloadNetworkDnsService == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter workloadNetworkDnsService is required and cannot be null."));
        } else {
            workloadNetworkDnsService.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateDnsService(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dnsServiceId,
                workloadNetworkDnsService,
                accept,
                context);
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner>
        beginUpdateDnsServiceAsync(
            String resourceGroupName,
            String privateCloudName,
            String dnsServiceId,
            WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateDnsServiceWithResponseAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService);
        return this
            .client
            .<WorkloadNetworkDnsServiceInner, WorkloadNetworkDnsServiceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsServiceInner.class,
                WorkloadNetworkDnsServiceInner.class,
                this.client.getContext());
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner>
        beginUpdateDnsServiceAsync(
            String resourceGroupName,
            String privateCloudName,
            String dnsServiceId,
            WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
            Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateDnsServiceWithResponseAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context);
        return this
            .client
            .<WorkloadNetworkDnsServiceInner, WorkloadNetworkDnsServiceInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsServiceInner.class,
                WorkloadNetworkDnsServiceInner.class,
                context);
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner> beginUpdateDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        return this
            .beginUpdateDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService)
            .getSyncPoller();
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsServiceInner>, WorkloadNetworkDnsServiceInner> beginUpdateDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        Context context) {
        return this
            .beginUpdateDnsServiceAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context)
            .getSyncPoller();
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Service on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsServiceInner> updateDnsServiceAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        return beginUpdateDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsServiceInner> updateDnsServiceAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        Context context) {
        return beginUpdateDnsServiceAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsServiceInner updateDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService) {
        return updateDnsServiceAsync(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService)
            .block();
    }

    /**
     * Create or update a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param workloadNetworkDnsService NSX DNS Service.
     * @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 nSX DNS Service.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsServiceInner updateDnsService(
        String resourceGroupName,
        String privateCloudName,
        String dnsServiceId,
        WorkloadNetworkDnsServiceInner workloadNetworkDnsService,
        Context context) {
        return updateDnsServiceAsync(
                resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService, context)
            .block();
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>>> deleteDnsServiceWithResponseAsync(
        String resourceGroupName, String dnsServiceId, String privateCloudName) {
        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 (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .deleteDnsService(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            dnsServiceId,
                            privateCloudName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @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>>> deleteDnsServiceWithResponseAsync(
        String resourceGroupName, String dnsServiceId, String privateCloudName, 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 (dnsServiceId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsServiceId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .deleteDnsService(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                dnsServiceId,
                privateCloudName,
                accept,
                context);
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteDnsServiceAsync(
        String resourceGroupName, String dnsServiceId, String privateCloudName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteDnsServiceWithResponseAsync(resourceGroupName, dnsServiceId, privateCloudName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeleteDnsServiceAsync(
        String resourceGroupName, String dnsServiceId, String privateCloudName, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteDnsServiceWithResponseAsync(resourceGroupName, dnsServiceId, privateCloudName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteDnsService(
        String resourceGroupName, String dnsServiceId, String privateCloudName) {
        return this.beginDeleteDnsServiceAsync(resourceGroupName, dnsServiceId, privateCloudName).getSyncPoller();
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeleteDnsService(
        String resourceGroupName, String dnsServiceId, String privateCloudName, Context context) {
        return this
            .beginDeleteDnsServiceAsync(resourceGroupName, dnsServiceId, privateCloudName, context)
            .getSyncPoller();
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> deleteDnsServiceAsync(String resourceGroupName, String dnsServiceId, String privateCloudName) {
        return beginDeleteDnsServiceAsync(resourceGroupName, dnsServiceId, privateCloudName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> deleteDnsServiceAsync(
        String resourceGroupName, String dnsServiceId, String privateCloudName, Context context) {
        return beginDeleteDnsServiceAsync(resourceGroupName, dnsServiceId, privateCloudName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 deleteDnsService(String resourceGroupName, String dnsServiceId, String privateCloudName) {
        deleteDnsServiceAsync(resourceGroupName, dnsServiceId, privateCloudName).block();
    }

    /**
     * Delete a DNS service by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsServiceId NSX DNS Service identifier. Generally the same as the DNS Service's display name.
     * @param privateCloudName Name of the private cloud.
     * @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 deleteDnsService(
        String resourceGroupName, String dnsServiceId, String privateCloudName, Context context) {
        deleteDnsServiceAsync(resourceGroupName, dnsServiceId, privateCloudName, context).block();
    }

    /**
     * List of DNS zones in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Zones along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsZoneInner>> listDnsZonesSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listDnsZones(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkDnsZoneInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of DNS zones in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Zones along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsZoneInner>> listDnsZonesSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listDnsZones(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of DNS zones in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Zones as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkDnsZoneInner> listDnsZonesAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listDnsZonesSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listDnsZonesNextSinglePageAsync(nextLink));
    }

    /**
     * List of DNS zones in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Zones as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkDnsZoneInner> listDnsZonesAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listDnsZonesSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listDnsZonesNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of DNS zones in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Zones as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkDnsZoneInner> listDnsZones(String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listDnsZonesAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of DNS zones in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX DNS Zones as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkDnsZoneInner> listDnsZones(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listDnsZonesAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS zone by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkDnsZoneInner>> getDnsZoneWithResponseAsync(
        String resourceGroupName, String privateCloudName, String dnsZoneId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getDnsZone(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dnsZoneId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS zone by id in a private cloud workload network along with {@link Response} on successful completion
     *     of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkDnsZoneInner>> getDnsZoneWithResponseAsync(
        String resourceGroupName, String privateCloudName, String dnsZoneId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getDnsZone(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dnsZoneId,
                accept,
                context);
    }

    /**
     * Get a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS zone by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsZoneInner> getDnsZoneAsync(
        String resourceGroupName, String privateCloudName, String dnsZoneId) {
        return getDnsZoneWithResponseAsync(resourceGroupName, privateCloudName, dnsZoneId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS zone by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkDnsZoneInner> getDnsZoneWithResponse(
        String resourceGroupName, String privateCloudName, String dnsZoneId, Context context) {
        return getDnsZoneWithResponseAsync(resourceGroupName, privateCloudName, dnsZoneId, context).block();
    }

    /**
     * Get a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a DNS zone by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsZoneInner getDnsZone(String resourceGroupName, String privateCloudName, String dnsZoneId) {
        return getDnsZoneWithResponse(resourceGroupName, privateCloudName, dnsZoneId, Context.NONE).getValue();
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Zone along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createDnsZoneWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        if (workloadNetworkDnsZone == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkDnsZone is required and cannot be null."));
        } else {
            workloadNetworkDnsZone.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createDnsZone(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dnsZoneId,
                            workloadNetworkDnsZone,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createDnsZoneWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        if (workloadNetworkDnsZone == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkDnsZone is required and cannot be null."));
        } else {
            workloadNetworkDnsZone.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createDnsZone(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dnsZoneId,
                workloadNetworkDnsZone,
                accept,
                context);
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginCreateDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createDnsZoneWithResponseAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone);
        return this
            .client
            .<WorkloadNetworkDnsZoneInner, WorkloadNetworkDnsZoneInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsZoneInner.class,
                WorkloadNetworkDnsZoneInner.class,
                this.client.getContext());
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginCreateDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createDnsZoneWithResponseAsync(
                resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context);
        return this
            .client
            .<WorkloadNetworkDnsZoneInner, WorkloadNetworkDnsZoneInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsZoneInner.class,
                WorkloadNetworkDnsZoneInner.class,
                context);
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginCreateDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        return this
            .beginCreateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone)
            .getSyncPoller();
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginCreateDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        return this
            .beginCreateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context)
            .getSyncPoller();
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Zone on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsZoneInner> createDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        return beginCreateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsZoneInner> createDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        return beginCreateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsZoneInner createDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        return createDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone).block();
    }

    /**
     * Create a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsZoneInner createDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        return createDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context)
            .block();
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Zone along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateDnsZoneWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        if (workloadNetworkDnsZone == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkDnsZone is required and cannot be null."));
        } else {
            workloadNetworkDnsZone.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updateDnsZone(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            dnsZoneId,
                            workloadNetworkDnsZone,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> updateDnsZoneWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        if (workloadNetworkDnsZone == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkDnsZone is required and cannot be null."));
        } else {
            workloadNetworkDnsZone.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updateDnsZone(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                dnsZoneId,
                workloadNetworkDnsZone,
                accept,
                context);
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginUpdateDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateDnsZoneWithResponseAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone);
        return this
            .client
            .<WorkloadNetworkDnsZoneInner, WorkloadNetworkDnsZoneInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsZoneInner.class,
                WorkloadNetworkDnsZoneInner.class,
                this.client.getContext());
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginUpdateDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            updateDnsZoneWithResponseAsync(
                resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context);
        return this
            .client
            .<WorkloadNetworkDnsZoneInner, WorkloadNetworkDnsZoneInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkDnsZoneInner.class,
                WorkloadNetworkDnsZoneInner.class,
                context);
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginUpdateDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        return this
            .beginUpdateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone)
            .getSyncPoller();
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkDnsZoneInner>, WorkloadNetworkDnsZoneInner> beginUpdateDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        return this
            .beginUpdateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context)
            .getSyncPoller();
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Zone on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsZoneInner> updateDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        return beginUpdateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkDnsZoneInner> updateDnsZoneAsync(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        return beginUpdateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsZoneInner updateDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone) {
        return updateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone).block();
    }

    /**
     * Create or update a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param workloadNetworkDnsZone NSX DNS Zone.
     * @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 nSX DNS Zone.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkDnsZoneInner updateDnsZone(
        String resourceGroupName,
        String privateCloudName,
        String dnsZoneId,
        WorkloadNetworkDnsZoneInner workloadNetworkDnsZone,
        Context context) {
        return updateDnsZoneAsync(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone, context)
            .block();
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>>> deleteDnsZoneWithResponseAsync(
        String resourceGroupName, String dnsZoneId, String privateCloudName) {
        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 (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .deleteDnsZone(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            dnsZoneId,
                            privateCloudName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @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>>> deleteDnsZoneWithResponseAsync(
        String resourceGroupName, String dnsZoneId, String privateCloudName, 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 (dnsZoneId == null) {
            return Mono.error(new IllegalArgumentException("Parameter dnsZoneId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .deleteDnsZone(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                dnsZoneId,
                privateCloudName,
                accept,
                context);
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteDnsZoneAsync(
        String resourceGroupName, String dnsZoneId, String privateCloudName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteDnsZoneWithResponseAsync(resourceGroupName, dnsZoneId, privateCloudName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeleteDnsZoneAsync(
        String resourceGroupName, String dnsZoneId, String privateCloudName, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteDnsZoneWithResponseAsync(resourceGroupName, dnsZoneId, privateCloudName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeleteDnsZone(
        String resourceGroupName, String dnsZoneId, String privateCloudName) {
        return this.beginDeleteDnsZoneAsync(resourceGroupName, dnsZoneId, privateCloudName).getSyncPoller();
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeleteDnsZone(
        String resourceGroupName, String dnsZoneId, String privateCloudName, Context context) {
        return this.beginDeleteDnsZoneAsync(resourceGroupName, dnsZoneId, privateCloudName, context).getSyncPoller();
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> deleteDnsZoneAsync(String resourceGroupName, String dnsZoneId, String privateCloudName) {
        return beginDeleteDnsZoneAsync(resourceGroupName, dnsZoneId, privateCloudName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> deleteDnsZoneAsync(
        String resourceGroupName, String dnsZoneId, String privateCloudName, Context context) {
        return beginDeleteDnsZoneAsync(resourceGroupName, dnsZoneId, privateCloudName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 deleteDnsZone(String resourceGroupName, String dnsZoneId, String privateCloudName) {
        deleteDnsZoneAsync(resourceGroupName, dnsZoneId, privateCloudName).block();
    }

    /**
     * Delete a DNS zone by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param dnsZoneId NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
     * @param privateCloudName Name of the private cloud.
     * @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 deleteDnsZone(String resourceGroupName, String dnsZoneId, String privateCloudName, Context context) {
        deleteDnsZoneAsync(resourceGroupName, dnsZoneId, privateCloudName, context).block();
    }

    /**
     * List of Public IP Blocks in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Public IP Blocks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPublicIpInner>> listPublicIPsSinglePageAsync(
        String resourceGroupName, String privateCloudName) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listPublicIPs(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            accept,
                            context))
            .<PagedResponse<WorkloadNetworkPublicIpInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * List of Public IP Blocks in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Public IP Blocks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPublicIpInner>> listPublicIPsSinglePageAsync(
        String resourceGroupName, String privateCloudName, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listPublicIPs(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * List of Public IP Blocks in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Public IP Blocks as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkPublicIpInner> listPublicIPsAsync(
        String resourceGroupName, String privateCloudName) {
        return new PagedFlux<>(
            () -> listPublicIPsSinglePageAsync(resourceGroupName, privateCloudName),
            nextLink -> listPublicIPsNextSinglePageAsync(nextLink));
    }

    /**
     * List of Public IP Blocks in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Public IP Blocks as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<WorkloadNetworkPublicIpInner> listPublicIPsAsync(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedFlux<>(
            () -> listPublicIPsSinglePageAsync(resourceGroupName, privateCloudName, context),
            nextLink -> listPublicIPsNextSinglePageAsync(nextLink, context));
    }

    /**
     * List of Public IP Blocks in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Public IP Blocks as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkPublicIpInner> listPublicIPs(
        String resourceGroupName, String privateCloudName) {
        return new PagedIterable<>(listPublicIPsAsync(resourceGroupName, privateCloudName));
    }

    /**
     * List of Public IP Blocks in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of NSX Public IP Blocks as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<WorkloadNetworkPublicIpInner> listPublicIPs(
        String resourceGroupName, String privateCloudName, Context context) {
        return new PagedIterable<>(listPublicIPsAsync(resourceGroupName, privateCloudName, context));
    }

    /**
     * Get a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Public IP Block by id in a private cloud workload network along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkPublicIpInner>> getPublicIpWithResponseAsync(
        String resourceGroupName, String privateCloudName, String publicIpId) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (publicIpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter publicIpId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .getPublicIp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            publicIpId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @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 Public IP Block by id in a private cloud workload network along with {@link Response} on successful
     *     completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<WorkloadNetworkPublicIpInner>> getPublicIpWithResponseAsync(
        String resourceGroupName, String privateCloudName, String publicIpId, 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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (publicIpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter publicIpId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .getPublicIp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                publicIpId,
                accept,
                context);
    }

    /**
     * Get a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Public IP Block by id in a private cloud workload network on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPublicIpInner> getPublicIpAsync(
        String resourceGroupName, String privateCloudName, String publicIpId) {
        return getPublicIpWithResponseAsync(resourceGroupName, privateCloudName, publicIpId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @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 Public IP Block by id in a private cloud workload network along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<WorkloadNetworkPublicIpInner> getPublicIpWithResponse(
        String resourceGroupName, String privateCloudName, String publicIpId, Context context) {
        return getPublicIpWithResponseAsync(resourceGroupName, privateCloudName, publicIpId, context).block();
    }

    /**
     * Get a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 Public IP Block by id in a private cloud workload network.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPublicIpInner getPublicIp(
        String resourceGroupName, String privateCloudName, String publicIpId) {
        return getPublicIpWithResponse(resourceGroupName, privateCloudName, publicIpId, Context.NONE).getValue();
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Public IP Block along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createPublicIpWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp) {
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (publicIpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter publicIpId is required and cannot be null."));
        }
        if (workloadNetworkPublicIp == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkPublicIp is required and cannot be null."));
        } else {
            workloadNetworkPublicIp.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createPublicIp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            privateCloudName,
                            publicIpId,
                            workloadNetworkPublicIp,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @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 nSX Public IP Block along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createPublicIpWithResponseAsync(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp,
        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 (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        if (publicIpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter publicIpId is required and cannot be null."));
        }
        if (workloadNetworkPublicIp == null) {
            return Mono
                .error(
                    new IllegalArgumentException("Parameter workloadNetworkPublicIp is required and cannot be null."));
        } else {
            workloadNetworkPublicIp.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createPublicIp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                privateCloudName,
                publicIpId,
                workloadNetworkPublicIp,
                accept,
                context);
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Public IP Block.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkPublicIpInner>, WorkloadNetworkPublicIpInner> beginCreatePublicIpAsync(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createPublicIpWithResponseAsync(resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp);
        return this
            .client
            .<WorkloadNetworkPublicIpInner, WorkloadNetworkPublicIpInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkPublicIpInner.class,
                WorkloadNetworkPublicIpInner.class,
                this.client.getContext());
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @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 nSX Public IP Block.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<WorkloadNetworkPublicIpInner>, WorkloadNetworkPublicIpInner> beginCreatePublicIpAsync(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp,
        Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createPublicIpWithResponseAsync(
                resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp, context);
        return this
            .client
            .<WorkloadNetworkPublicIpInner, WorkloadNetworkPublicIpInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                WorkloadNetworkPublicIpInner.class,
                WorkloadNetworkPublicIpInner.class,
                context);
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 nSX Public IP Block.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkPublicIpInner>, WorkloadNetworkPublicIpInner> beginCreatePublicIp(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp) {
        return this
            .beginCreatePublicIpAsync(resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp)
            .getSyncPoller();
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @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 nSX Public IP Block.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<WorkloadNetworkPublicIpInner>, WorkloadNetworkPublicIpInner> beginCreatePublicIp(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp,
        Context context) {
        return this
            .beginCreatePublicIpAsync(resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp, context)
            .getSyncPoller();
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Public IP Block on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPublicIpInner> createPublicIpAsync(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp) {
        return beginCreatePublicIpAsync(resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @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 nSX Public IP Block on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<WorkloadNetworkPublicIpInner> createPublicIpAsync(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp,
        Context context) {
        return beginCreatePublicIpAsync(
                resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return nSX Public IP Block.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPublicIpInner createPublicIp(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp) {
        return createPublicIpAsync(resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp).block();
    }

    /**
     * Create a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param privateCloudName Name of the private cloud.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param workloadNetworkPublicIp NSX Public IP Block.
     * @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 nSX Public IP Block.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public WorkloadNetworkPublicIpInner createPublicIp(
        String resourceGroupName,
        String privateCloudName,
        String publicIpId,
        WorkloadNetworkPublicIpInner workloadNetworkPublicIp,
        Context context) {
        return createPublicIpAsync(resourceGroupName, privateCloudName, publicIpId, workloadNetworkPublicIp, context)
            .block();
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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>>> deletePublicIpWithResponseAsync(
        String resourceGroupName, String publicIpId, String privateCloudName) {
        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 (publicIpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter publicIpId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .deletePublicIp(
                            this.client.getEndpoint(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            this.client.getApiVersion(),
                            publicIpId,
                            privateCloudName,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @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>>> deletePublicIpWithResponseAsync(
        String resourceGroupName, String publicIpId, String privateCloudName, 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 (publicIpId == null) {
            return Mono.error(new IllegalArgumentException("Parameter publicIpId is required and cannot be null."));
        }
        if (privateCloudName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateCloudName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .deletePublicIp(
                this.client.getEndpoint(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                this.client.getApiVersion(),
                publicIpId,
                privateCloudName,
                accept,
                context);
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeletePublicIpAsync(
        String resourceGroupName, String publicIpId, String privateCloudName) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deletePublicIpWithResponseAsync(resourceGroupName, publicIpId, privateCloudName);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeletePublicIpAsync(
        String resourceGroupName, String publicIpId, String privateCloudName, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deletePublicIpWithResponseAsync(resourceGroupName, publicIpId, privateCloudName, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> beginDeletePublicIp(
        String resourceGroupName, String publicIpId, String privateCloudName) {
        return this.beginDeletePublicIpAsync(resourceGroupName, publicIpId, privateCloudName).getSyncPoller();
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> beginDeletePublicIp(
        String resourceGroupName, String publicIpId, String privateCloudName, Context context) {
        return this.beginDeletePublicIpAsync(resourceGroupName, publicIpId, privateCloudName, context).getSyncPoller();
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> deletePublicIpAsync(String resourceGroupName, String publicIpId, String privateCloudName) {
        return beginDeletePublicIpAsync(resourceGroupName, publicIpId, privateCloudName)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @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> deletePublicIpAsync(
        String resourceGroupName, String publicIpId, String privateCloudName, Context context) {
        return beginDeletePublicIpAsync(resourceGroupName, publicIpId, privateCloudName, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 deletePublicIp(String resourceGroupName, String publicIpId, String privateCloudName) {
        deletePublicIpAsync(resourceGroupName, publicIpId, privateCloudName).block();
    }

    /**
     * Delete a Public IP Block by id in a private cloud workload network.
     *
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param publicIpId NSX Public IP Block identifier. Generally the same as the Public IP Block's display name.
     * @param privateCloudName Name of the private cloud.
     * @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 deletePublicIp(String resourceGroupName, String publicIpId, String privateCloudName, Context context) {
        deletePublicIpAsync(resourceGroupName, publicIpId, privateCloudName, 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 a list of workload networks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkInner>> 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<WorkloadNetworkInner>>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 a list of workload networks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkInner>> listNextSinglePageAsync(String nextLink, Context context) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX Segments along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkSegmentInner>> listSegmentsNextSinglePageAsync(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.listSegmentsNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkSegmentInner>>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 a list of NSX Segments along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkSegmentInner>> listSegmentsNextSinglePageAsync(
        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
            .listSegmentsNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX dhcp entities along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDhcpInner>> listDhcpNextSinglePageAsync(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.listDhcpNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkDhcpInner>>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 a list of NSX dhcp entities along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDhcpInner>> listDhcpNextSinglePageAsync(
        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
            .listDhcpNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX Gateways along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkGatewayInner>> listGatewaysNextSinglePageAsync(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.listGatewaysNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkGatewayInner>>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 a list of NSX Gateways along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkGatewayInner>> listGatewaysNextSinglePageAsync(
        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
            .listGatewaysNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX Port Mirroring along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPortMirroringInner>> listPortMirroringNextSinglePageAsync(
        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.listPortMirroringNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkPortMirroringInner>>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 a list of NSX Port Mirroring along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPortMirroringInner>> listPortMirroringNextSinglePageAsync(
        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
            .listPortMirroringNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX VM Groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVMGroupInner>> listVMGroupsNextSinglePageAsync(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.listVMGroupsNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkVMGroupInner>>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 a list of NSX VM Groups along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVMGroupInner>> listVMGroupsNextSinglePageAsync(
        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
            .listVMGroupsNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX Virtual Machines along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVirtualMachineInner>> listVirtualMachinesNextSinglePageAsync(
        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.listVirtualMachinesNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkVirtualMachineInner>>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 a list of NSX Virtual Machines along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkVirtualMachineInner>> listVirtualMachinesNextSinglePageAsync(
        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
            .listVirtualMachinesNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX DNS Services along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsServiceInner>> listDnsServicesNextSinglePageAsync(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.listDnsServicesNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkDnsServiceInner>>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 a list of NSX DNS Services along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsServiceInner>> listDnsServicesNextSinglePageAsync(
        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
            .listDnsServicesNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX DNS Zones along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsZoneInner>> listDnsZonesNextSinglePageAsync(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.listDnsZonesNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkDnsZoneInner>>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 a list of NSX DNS Zones along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkDnsZoneInner>> listDnsZonesNextSinglePageAsync(
        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
            .listDnsZonesNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The URL to get the next list of items
     *     <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 a list of NSX Public IP Blocks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPublicIpInner>> listPublicIPsNextSinglePageAsync(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.listPublicIPsNext(nextLink, this.client.getEndpoint(), accept, context))
            .<PagedResponse<WorkloadNetworkPublicIpInner>>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 a list of NSX Public IP Blocks along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<WorkloadNetworkPublicIpInner>> listPublicIPsNextSinglePageAsync(
        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
            .listPublicIPsNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(),
                        res.getStatusCode(),
                        res.getHeaders(),
                        res.getValue().value(),
                        res.getValue().nextLink(),
                        null));
    }
}
