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

package com.azure.resourcemanager.deviceupdate.implementation;

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

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

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

    /**
     * The interface defining all the services for DeviceUpdatePrivateEndpointConnectionProxies to be used by the proxy
     * service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "DeviceUpdatePrivateE")
    private interface PrivateEndpointConnectionProxiesService {
        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate"
                + "/accounts/{accountName}/privateEndpointConnectionProxies")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<PrivateEndpointConnectionProxyListResult>> listByAccount(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("accountName") String accountName,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate"
                + "/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId}"
                + "/validate")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Void>> validate(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("accountName") String accountName,
            @PathParam("privateEndpointConnectionProxyId") String privateEndpointConnectionProxyId,
            @BodyParam("application/json") PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Post(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate"
                + "/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId}"
                + "/updatePrivateEndpointProperties")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Void>> updatePrivateEndpointProperties(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("accountName") String accountName,
            @PathParam("privateEndpointConnectionProxyId") String privateEndpointConnectionProxyId,
            @BodyParam("application/json") PrivateEndpointUpdate privateEndpointUpdate,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Get(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate"
                + "/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<PrivateEndpointConnectionProxyInner>> get(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("accountName") String accountName,
            @PathParam("privateEndpointConnectionProxyId") String privateEndpointConnectionProxyId,
            @HeaderParam("Accept") String accept,
            Context context);

        @Headers({"Content-Type: application/json"})
        @Put(
            "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate"
                + "/accounts/{accountName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyId}")
        @ExpectedResponses({201})
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
            @HostParam("$host") String endpoint,
            @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("accountName") String accountName,
            @PathParam("privateEndpointConnectionProxyId") String privateEndpointConnectionProxyId,
            @BodyParam("application/json") PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
            @HeaderParam("Accept") String accept,
            Context context);

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

    /**
     * (INTERNAL - DO NOT USE) List all private endpoint connection proxies in a device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account 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 available private endpoint connection proxies for an Account (not to be used by anyone, here because
     *     of ARM requirements) along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<PrivateEndpointConnectionProxyInner>> listByAccountSinglePageAsync(
        String resourceGroupName, String accountName) {
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .listByAccount(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            accountName,
                            accept,
                            context))
            .<PagedResponse<PrivateEndpointConnectionProxyInner>>map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * (INTERNAL - DO NOT USE) List all private endpoint connection proxies in a device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account 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 available private endpoint connection proxies for an Account (not to be used by anyone, here because
     *     of ARM requirements) along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PagedResponse<PrivateEndpointConnectionProxyInner>> listByAccountSinglePageAsync(
        String resourceGroupName, String accountName, 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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listByAccount(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                accountName,
                accept,
                context)
            .map(
                res ->
                    new PagedResponseBase<>(
                        res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null));
    }

    /**
     * (INTERNAL - DO NOT USE) List all private endpoint connection proxies in a device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account 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 available private endpoint connection proxies for an Account (not to be used by anyone, here because
     *     of ARM requirements) as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<PrivateEndpointConnectionProxyInner> listByAccountAsync(
        String resourceGroupName, String accountName) {
        return new PagedFlux<>(() -> listByAccountSinglePageAsync(resourceGroupName, accountName));
    }

    /**
     * (INTERNAL - DO NOT USE) List all private endpoint connection proxies in a device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account 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 available private endpoint connection proxies for an Account (not to be used by anyone, here because
     *     of ARM requirements) as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux<PrivateEndpointConnectionProxyInner> listByAccountAsync(
        String resourceGroupName, String accountName, Context context) {
        return new PagedFlux<>(() -> listByAccountSinglePageAsync(resourceGroupName, accountName, context));
    }

    /**
     * (INTERNAL - DO NOT USE) List all private endpoint connection proxies in a device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account 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 available private endpoint connection proxies for an Account (not to be used by anyone, here because
     *     of ARM requirements) as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<PrivateEndpointConnectionProxyInner> listByAccount(
        String resourceGroupName, String accountName) {
        return new PagedIterable<>(listByAccountAsync(resourceGroupName, accountName));
    }

    /**
     * (INTERNAL - DO NOT USE) List all private endpoint connection proxies in a device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account 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 available private endpoint connection proxies for an Account (not to be used by anyone, here because
     *     of ARM requirements) as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<PrivateEndpointConnectionProxyInner> listByAccount(
        String resourceGroupName, String accountName, Context context) {
        return new PagedIterable<>(listByAccountAsync(resourceGroupName, accountName, context));
    }

    /**
     * (INTERNAL - DO NOT USE) Validates a private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void>> validateWithResponseAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        if (privateEndpointConnectionProxy == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxy is required and cannot be null."));
        } else {
            privateEndpointConnectionProxy.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .validate(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            accountName,
                            privateEndpointConnectionProxyId,
                            privateEndpointConnectionProxy,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * (INTERNAL - DO NOT USE) Validates a private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void>> validateWithResponseAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        if (privateEndpointConnectionProxy == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxy is required and cannot be null."));
        } else {
            privateEndpointConnectionProxy.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .validate(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointConnectionProxy,
                accept,
                context);
    }

    /**
     * (INTERNAL - DO NOT USE) Validates a private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> validateAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        return validateWithResponseAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointConnectionProxy)
            .flatMap(ignored -> Mono.empty());
    }

    /**
     * (INTERNAL - DO NOT USE) Validates a private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 validate(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        validateAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointConnectionProxy)
            .block();
    }

    /**
     * (INTERNAL - DO NOT USE) Validates a private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> validateWithResponse(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
        Context context) {
        return validateWithResponseAsync(
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointConnectionProxy,
                context)
            .block();
    }

    /**
     * (INTERNAL - DO NOT USE) Updates a private endpoint inside the private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointUpdate The parameters for updating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void>> updatePrivateEndpointPropertiesWithResponseAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointUpdate privateEndpointUpdate) {
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        if (privateEndpointUpdate == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateEndpointUpdate is required and cannot be null."));
        } else {
            privateEndpointUpdate.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .updatePrivateEndpointProperties(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            accountName,
                            privateEndpointConnectionProxyId,
                            privateEndpointUpdate,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * (INTERNAL - DO NOT USE) Updates a private endpoint inside the private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointUpdate The parameters for updating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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<Void>> updatePrivateEndpointPropertiesWithResponseAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointUpdate privateEndpointUpdate,
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        if (privateEndpointUpdate == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter privateEndpointUpdate is required and cannot be null."));
        } else {
            privateEndpointUpdate.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .updatePrivateEndpointProperties(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointUpdate,
                accept,
                context);
    }

    /**
     * (INTERNAL - DO NOT USE) Updates a private endpoint inside the private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointUpdate The parameters for updating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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> updatePrivateEndpointPropertiesAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointUpdate privateEndpointUpdate) {
        return updatePrivateEndpointPropertiesWithResponseAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointUpdate)
            .flatMap(ignored -> Mono.empty());
    }

    /**
     * (INTERNAL - DO NOT USE) Updates a private endpoint inside the private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointUpdate The parameters for updating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @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 updatePrivateEndpointProperties(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointUpdate privateEndpointUpdate) {
        updatePrivateEndpointPropertiesAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointUpdate)
            .block();
    }

    /**
     * (INTERNAL - DO NOT USE) Updates a private endpoint inside the private endpoint connection proxy object.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointUpdate The parameters for updating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> updatePrivateEndpointPropertiesWithResponse(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointUpdate privateEndpointUpdate,
        Context context) {
        return updatePrivateEndpointPropertiesWithResponseAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointUpdate, context)
            .block();
    }

    /**
     * (INTERNAL - DO NOT USE) Get the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<PrivateEndpointConnectionProxyInner>> getWithResponseAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .get(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            accountName,
                            privateEndpointConnectionProxyId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * (INTERNAL - DO NOT USE) Get the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<PrivateEndpointConnectionProxyInner>> getWithResponseAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId, 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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .get(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                accept,
                context);
    }

    /**
     * (INTERNAL - DO NOT USE) Get the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PrivateEndpointConnectionProxyInner> getAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * (INTERNAL - DO NOT USE) Get the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PrivateEndpointConnectionProxyInner get(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        return getAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId).block();
    }

    /**
     * (INTERNAL - DO NOT USE) Get the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<PrivateEndpointConnectionProxyInner> getWithResponse(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId, Context context) {
        return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId, context).block();
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        if (privateEndpointConnectionProxy == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxy is required and cannot be null."));
        } else {
            privateEndpointConnectionProxy.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .createOrUpdate(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            accountName,
                            privateEndpointConnectionProxyId,
                            privateEndpointConnectionProxy,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        if (privateEndpointConnectionProxy == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxy is required and cannot be null."));
        } else {
            privateEndpointConnectionProxy.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .createOrUpdate(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointConnectionProxy,
                accept,
                context);
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 private endpoint connection proxy details.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<PrivateEndpointConnectionProxyInner>, PrivateEndpointConnectionProxyInner>
        beginCreateOrUpdateAsync(
            String resourceGroupName,
            String accountName,
            String privateEndpointConnectionProxyId,
            PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            createOrUpdateWithResponseAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointConnectionProxy);
        return this
            .client
            .<PrivateEndpointConnectionProxyInner, PrivateEndpointConnectionProxyInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                PrivateEndpointConnectionProxyInner.class,
                PrivateEndpointConnectionProxyInner.class,
                this.client.getContext());
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 private endpoint connection proxy details.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<PrivateEndpointConnectionProxyInner>, PrivateEndpointConnectionProxyInner>
        beginCreateOrUpdateAsync(
            String resourceGroupName,
            String accountName,
            String privateEndpointConnectionProxyId,
            PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
            Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            createOrUpdateWithResponseAsync(
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointConnectionProxy,
                context);
        return this
            .client
            .<PrivateEndpointConnectionProxyInner, PrivateEndpointConnectionProxyInner>getLroResult(
                mono,
                this.client.getHttpPipeline(),
                PrivateEndpointConnectionProxyInner.class,
                PrivateEndpointConnectionProxyInner.class,
                context);
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 private endpoint connection proxy details.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<PrivateEndpointConnectionProxyInner>, PrivateEndpointConnectionProxyInner>
        beginCreateOrUpdate(
            String resourceGroupName,
            String accountName,
            String privateEndpointConnectionProxyId,
            PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        return beginCreateOrUpdateAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointConnectionProxy)
            .getSyncPoller();
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws 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 private endpoint connection proxy details.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<PrivateEndpointConnectionProxyInner>, PrivateEndpointConnectionProxyInner>
        beginCreateOrUpdate(
            String resourceGroupName,
            String accountName,
            String privateEndpointConnectionProxyId,
            PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
            Context context) {
        return beginCreateOrUpdateAsync(
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointConnectionProxy,
                context)
            .getSyncPoller();
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PrivateEndpointConnectionProxyInner> createOrUpdateAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        return beginCreateOrUpdateAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointConnectionProxy)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<PrivateEndpointConnectionProxyInner> createOrUpdateAsync(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
        Context context) {
        return beginCreateOrUpdateAsync(
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointConnectionProxy,
                context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PrivateEndpointConnectionProxyInner createOrUpdate(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy) {
        return createOrUpdateAsync(
                resourceGroupName, accountName, privateEndpointConnectionProxyId, privateEndpointConnectionProxy)
            .block();
    }

    /**
     * (INTERNAL - DO NOT USE) Creates or updates the specified private endpoint connection proxy resource associated
     * with the device update account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param privateEndpointConnectionProxy The parameters for creating a private endpoint connection proxy.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return private endpoint connection proxy details.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PrivateEndpointConnectionProxyInner createOrUpdate(
        String resourceGroupName,
        String accountName,
        String privateEndpointConnectionProxyId,
        PrivateEndpointConnectionProxyInner privateEndpointConnectionProxy,
        Context context) {
        return createOrUpdateAsync(
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                privateEndpointConnectionProxy,
                context)
            .block();
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context ->
                    service
                        .delete(
                            this.client.getEndpoint(),
                            this.client.getApiVersion(),
                            this.client.getSubscriptionId(),
                            resourceGroupName,
                            accountName,
                            privateEndpointConnectionProxyId,
                            accept,
                            context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId, 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 (accountName == null) {
            return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
        }
        if (privateEndpointConnectionProxyId == null) {
            return Mono
                .error(
                    new IllegalArgumentException(
                        "Parameter privateEndpointConnectionProxyId is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .delete(
                this.client.getEndpoint(),
                this.client.getApiVersion(),
                this.client.getSubscriptionId(),
                resourceGroupName,
                accountName,
                privateEndpointConnectionProxyId,
                accept,
                context);
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId);
        return this
            .client
            .<Void, Void>getLroResult(
                mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext());
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId, Context context) {
        context = this.client.mergeContext(context);
        Mono<Response<Flux<ByteBuffer>>> mono =
            deleteWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId, context);
        return this
            .client
            .<Void, Void>getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context);
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<Void>, Void> beginDelete(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId).getSyncPoller();
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller<PollResult<Void>, Void> beginDelete(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId, Context context) {
        return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId, context)
            .getSyncPoller();
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Void> deleteAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono<Void> deleteAsync(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId, Context context) {
        return beginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId, context)
            .last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionProxyId) {
        deleteAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId).block();
    }

    /**
     * (INTERNAL - DO NOT USE) Deletes the specified private endpoint connection proxy associated with the device update
     * account.
     *
     * @param resourceGroupName The resource group name.
     * @param accountName Account name.
     * @param privateEndpointConnectionProxyId The ID of the private endpoint connection proxy object.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(
        String resourceGroupName, String accountName, String privateEndpointConnectionProxyId, Context context) {
        deleteAsync(resourceGroupName, accountName, privateEndpointConnectionProxyId, context).block();
    }
}
