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

package com.azure.analytics.synapse.managedprivateendpoints;

import com.azure.analytics.synapse.managedprivateendpoints.implementation.ManagedPrivateEndpointsImpl;
import com.azure.analytics.synapse.managedprivateendpoints.models.ManagedPrivateEndpoint;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.Response;
import reactor.core.publisher.Mono;

/** Initializes a new instance of the asynchronous ManagedPrivateEndpointsClient type. */
@ServiceClient(builder = ManagedPrivateEndpointsClientBuilder.class, isAsync = true)
public final class ManagedPrivateEndpointsAsyncClient {
    private final ManagedPrivateEndpointsImpl serviceClient;

    /**
     * Initializes an instance of ManagedPrivateEndpoints client.
     *
     * @param serviceClient the service client implementation.
     */
    ManagedPrivateEndpointsAsyncClient(ManagedPrivateEndpointsImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * Get Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @param managedPrivateEndpointName Managed private endpoint name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return managed Private Endpoints.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<ManagedPrivateEndpoint>> getWithResponse(
            String managedVirtualNetworkName, String managedPrivateEndpointName) {
        return this.serviceClient.getWithResponseAsync(managedVirtualNetworkName, managedPrivateEndpointName);
    }

    /**
     * Get Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @param managedPrivateEndpointName Managed private endpoint name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return managed Private Endpoints.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<ManagedPrivateEndpoint> get(String managedVirtualNetworkName, String managedPrivateEndpointName) {
        return this.serviceClient.getAsync(managedVirtualNetworkName, managedPrivateEndpointName);
    }

    /**
     * Create Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @param managedPrivateEndpointName Managed private endpoint name.
     * @param managedPrivateEndpoint Managed private endpoint properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return managed private endpoint.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<ManagedPrivateEndpoint>> createWithResponse(
            String managedVirtualNetworkName,
            String managedPrivateEndpointName,
            ManagedPrivateEndpoint managedPrivateEndpoint) {
        return this.serviceClient.createWithResponseAsync(
                managedVirtualNetworkName, managedPrivateEndpointName, managedPrivateEndpoint);
    }

    /**
     * Create Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @param managedPrivateEndpointName Managed private endpoint name.
     * @param managedPrivateEndpoint Managed private endpoint properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return managed private endpoint.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<ManagedPrivateEndpoint> create(
            String managedVirtualNetworkName,
            String managedPrivateEndpointName,
            ManagedPrivateEndpoint managedPrivateEndpoint) {
        return this.serviceClient.createAsync(
                managedVirtualNetworkName, managedPrivateEndpointName, managedPrivateEndpoint);
    }

    /**
     * Delete Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @param managedPrivateEndpointName Managed private endpoint name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<Void>> deleteWithResponse(
            String managedVirtualNetworkName, String managedPrivateEndpointName) {
        return this.serviceClient.deleteWithResponseAsync(managedVirtualNetworkName, managedPrivateEndpointName);
    }

    /**
     * Delete Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @param managedPrivateEndpointName Managed private endpoint name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the completion.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Void> delete(String managedVirtualNetworkName, String managedPrivateEndpointName) {
        return this.serviceClient.deleteAsync(managedVirtualNetworkName, managedPrivateEndpointName);
    }

    /**
     * List Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException 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 managed private endpoints.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public Mono<PagedResponse<ManagedPrivateEndpoint>> listSinglePage(String managedVirtualNetworkName) {
        return this.serviceClient.listSinglePageAsync(managedVirtualNetworkName);
    }

    /**
     * List Managed Private Endpoints.
     *
     * @param managedVirtualNetworkName Managed virtual network name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException 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 managed private endpoints.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<ManagedPrivateEndpoint> list(String managedVirtualNetworkName) {
        return this.serviceClient.listAsync(managedVirtualNetworkName);
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The nextLink parameter.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws HttpResponseException 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 managed private endpoints.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public Mono<PagedResponse<ManagedPrivateEndpoint>> listNextSinglePage(String nextLink) {
        return this.serviceClient.listNextSinglePageAsync(nextLink);
    }
}
