// 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.artifacts.implementation;

import com.azure.analytics.synapse.artifacts.models.CloudErrorException;
import com.azure.analytics.synapse.artifacts.models.EditTablesRequest;
import com.azure.analytics.synapse.artifacts.models.LinkConnectionDetailedStatus;
import com.azure.analytics.synapse.artifacts.models.LinkConnectionListResponse;
import com.azure.analytics.synapse.artifacts.models.LinkConnectionQueryTableStatus;
import com.azure.analytics.synapse.artifacts.models.LinkConnectionResource;
import com.azure.analytics.synapse.artifacts.models.LinkTableListResponse;
import com.azure.analytics.synapse.artifacts.models.QueryTableStatusRequest;
import com.azure.analytics.synapse.artifacts.models.UpdateLandingZoneCredential;
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.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.util.Context;
import com.azure.core.util.FluxUtil;
import reactor.core.publisher.Mono;

/** An instance of this class provides access to all the operations defined in LinkConnections. */
public final class LinkConnectionsImpl {
    /** The proxy service used to perform REST calls. */
    private final LinkConnectionsService service;

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

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

    /**
     * The interface defining all the services for ArtifactsClientLinkConnections to be used by the proxy service to
     * perform REST calls.
     */
    @Host("{endpoint}")
    @ServiceInterface(name = "ArtifactsClientLinkC")
    public interface LinkConnectionsService {
        @Get("/linkconnections")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<LinkConnectionListResponse>> listByWorkspace(
                @HostParam("endpoint") String endpoint,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Put("/linkconnections/{linkConnectionName}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<LinkConnectionResource>> createOrUpdate(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") LinkConnectionResource linkConnection,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/linkconnections/{linkConnectionName}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<LinkConnectionResource>> get(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Delete("/linkconnections/{linkConnectionName}")
        @ExpectedResponses({200, 204})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> delete(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/linkconnections/{linkConnectionName}/edittables")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> editTables(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") EditTablesRequest editTablesRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/linkconnections/{linkConnectionName}/start")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> start(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/linkconnections/{linkConnectionName}/stop")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> stop(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/linkconnections/{linkConnectionName}/detailedstatus")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<LinkConnectionDetailedStatus>> getDetailedStatus(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/linkconnections/{linkConnectionName}/linktables")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<LinkTableListResponse>> listLinkTables(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/linkconnections/{linkConnectionName}/querytablestatus")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<LinkConnectionQueryTableStatus>> queryTableStatus(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") QueryTableStatusRequest queryTableStatusRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/linkconnections/{linkConnectionName}/updateLandingZoneCredential")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> updateLandingZoneCredential(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") UpdateLandingZoneCredential updateLandingZoneCredentialRequest,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/linkconnections/{linkConnectionName}/pause")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> pause(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/linkconnections/{linkConnectionName}/resume")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<Void>> resume(
                @HostParam("endpoint") String endpoint,
                @PathParam("linkConnectionName") String linkConnectionName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorException.class)
        Mono<Response<LinkConnectionListResponse>> listByWorkspaceNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                @HeaderParam("Accept") String accept,
                Context context);
    }

    /**
     * List link connections.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<LinkConnectionResource>> listByWorkspaceSinglePageAsync() {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context -> service.listByWorkspace(this.client.getEndpoint(), apiVersion, accept, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * List link connections.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<LinkConnectionResource>> listByWorkspaceSinglePageAsync(Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.listByWorkspace(this.client.getEndpoint(), apiVersion, accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * List link connections.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<LinkConnectionResource> listByWorkspaceAsync() {
        return new PagedFlux<>(
                () -> listByWorkspaceSinglePageAsync(), nextLink -> listByWorkspaceNextSinglePageAsync(nextLink));
    }

    /**
     * List link connections.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<LinkConnectionResource> listByWorkspaceAsync(Context context) {
        return new PagedFlux<>(
                () -> listByWorkspaceSinglePageAsync(context),
                nextLink -> listByWorkspaceNextSinglePageAsync(nextLink, context));
    }

    /**
     * List link connections.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<LinkConnectionResource> listByWorkspaceSinglePage() {
        return listByWorkspaceSinglePageAsync().block();
    }

    /**
     * List link connections.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<LinkConnectionResource> listByWorkspaceSinglePage(Context context) {
        return listByWorkspaceSinglePageAsync(context).block();
    }

    /**
     * List link connections.
     *
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<LinkConnectionResource> listByWorkspace() {
        return new PagedIterable<>(listByWorkspaceAsync());
    }

    /**
     * List link connections.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<LinkConnectionResource> listByWorkspace(Context context) {
        return new PagedIterable<>(listByWorkspaceAsync(context));
    }

    /**
     * Creates or updates a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param linkConnection Link connection resource definition.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionResource>> createOrUpdateWithResponseAsync(
            String linkConnectionName, LinkConnectionResource linkConnection) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.createOrUpdate(
                                this.client.getEndpoint(),
                                linkConnectionName,
                                apiVersion,
                                linkConnection,
                                accept,
                                context));
    }

    /**
     * Creates or updates a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param linkConnection Link connection resource definition.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionResource>> createOrUpdateWithResponseAsync(
            String linkConnectionName, LinkConnectionResource linkConnection, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.createOrUpdate(
                this.client.getEndpoint(), linkConnectionName, apiVersion, linkConnection, accept, context);
    }

    /**
     * Creates or updates a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param linkConnection Link connection resource definition.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionResource> createOrUpdateAsync(
            String linkConnectionName, LinkConnectionResource linkConnection) {
        return createOrUpdateWithResponseAsync(linkConnectionName, linkConnection)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates or updates a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param linkConnection Link connection resource definition.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionResource> createOrUpdateAsync(
            String linkConnectionName, LinkConnectionResource linkConnection, Context context) {
        return createOrUpdateWithResponseAsync(linkConnectionName, linkConnection, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Creates or updates a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param linkConnection Link connection resource definition.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<LinkConnectionResource> createOrUpdateWithResponse(
            String linkConnectionName, LinkConnectionResource linkConnection, Context context) {
        return createOrUpdateWithResponseAsync(linkConnectionName, linkConnection, context).block();
    }

    /**
     * Creates or updates a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param linkConnection Link connection resource definition.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public LinkConnectionResource createOrUpdate(String linkConnectionName, LinkConnectionResource linkConnection) {
        return createOrUpdateWithResponse(linkConnectionName, linkConnection, Context.NONE).getValue();
    }

    /**
     * Get a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 connection along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionResource>> getWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.get(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * Get a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 connection along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionResource>> getWithResponseAsync(String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.get(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * Get a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 connection on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionResource> getAsync(String linkConnectionName) {
        return getWithResponseAsync(linkConnectionName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 connection on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionResource> getAsync(String linkConnectionName, Context context) {
        return getWithResponseAsync(linkConnectionName, context).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 connection along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<LinkConnectionResource> getWithResponse(String linkConnectionName, Context context) {
        return getWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * Get a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public LinkConnectionResource get(String linkConnectionName) {
        return getWithResponse(linkConnectionName, Context.NONE).getValue();
    }

    /**
     * Delete a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> deleteWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.delete(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * Delete a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> deleteWithResponseAsync(String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.delete(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * Delete a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> deleteAsync(String linkConnectionName) {
        return deleteWithResponseAsync(linkConnectionName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Delete a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> deleteAsync(String linkConnectionName, Context context) {
        return deleteWithResponseAsync(linkConnectionName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Delete a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> deleteWithResponse(String linkConnectionName, Context context) {
        return deleteWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * Delete a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 linkConnectionName) {
        deleteWithResponse(linkConnectionName, Context.NONE);
    }

    /**
     * Edit tables for a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param editTablesRequest Edit tables request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> editTablesWithResponseAsync(
            String linkConnectionName, EditTablesRequest editTablesRequest) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.editTables(
                                this.client.getEndpoint(),
                                linkConnectionName,
                                apiVersion,
                                editTablesRequest,
                                accept,
                                context));
    }

    /**
     * Edit tables for a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param editTablesRequest Edit tables request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> editTablesWithResponseAsync(
            String linkConnectionName, EditTablesRequest editTablesRequest, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.editTables(
                this.client.getEndpoint(), linkConnectionName, apiVersion, editTablesRequest, accept, context);
    }

    /**
     * Edit tables for a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param editTablesRequest Edit tables request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> editTablesAsync(String linkConnectionName, EditTablesRequest editTablesRequest) {
        return editTablesWithResponseAsync(linkConnectionName, editTablesRequest).flatMap(ignored -> Mono.empty());
    }

    /**
     * Edit tables for a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param editTablesRequest Edit tables request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> editTablesAsync(String linkConnectionName, EditTablesRequest editTablesRequest, Context context) {
        return editTablesWithResponseAsync(linkConnectionName, editTablesRequest, context)
                .flatMap(ignored -> Mono.empty());
    }

    /**
     * Edit tables for a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param editTablesRequest Edit tables request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> editTablesWithResponse(
            String linkConnectionName, EditTablesRequest editTablesRequest, Context context) {
        return editTablesWithResponseAsync(linkConnectionName, editTablesRequest, context).block();
    }

    /**
     * Edit tables for a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param editTablesRequest Edit tables request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 editTables(String linkConnectionName, EditTablesRequest editTablesRequest) {
        editTablesWithResponse(linkConnectionName, editTablesRequest, Context.NONE);
    }

    /**
     * Start a link connection. It may take a few minutes from Starting to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> startWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.start(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * Start a link connection. It may take a few minutes from Starting to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> startWithResponseAsync(String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.start(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * Start a link connection. It may take a few minutes from Starting to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> startAsync(String linkConnectionName) {
        return startWithResponseAsync(linkConnectionName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Start a link connection. It may take a few minutes from Starting to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> startAsync(String linkConnectionName, Context context) {
        return startWithResponseAsync(linkConnectionName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Start a link connection. It may take a few minutes from Starting to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> startWithResponse(String linkConnectionName, Context context) {
        return startWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * Start a link connection. It may take a few minutes from Starting to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 start(String linkConnectionName) {
        startWithResponse(linkConnectionName, Context.NONE);
    }

    /**
     * Stop a link connection. It may take a few minutes from Stopping to stopped, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> stopWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.stop(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * Stop a link connection. It may take a few minutes from Stopping to stopped, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> stopWithResponseAsync(String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.stop(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * Stop a link connection. It may take a few minutes from Stopping to stopped, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> stopAsync(String linkConnectionName) {
        return stopWithResponseAsync(linkConnectionName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Stop a link connection. It may take a few minutes from Stopping to stopped, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> stopAsync(String linkConnectionName, Context context) {
        return stopWithResponseAsync(linkConnectionName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Stop a link connection. It may take a few minutes from Stopping to stopped, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> stopWithResponse(String linkConnectionName, Context context) {
        return stopWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * Stop a link connection. It may take a few minutes from Stopping to stopped, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 stop(String linkConnectionName) {
        stopWithResponse(linkConnectionName, Context.NONE);
    }

    /**
     * Get the detailed status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the detailed status of a link connection along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionDetailedStatus>> getDetailedStatusWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getDetailedStatus(
                                this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * Get the detailed status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the detailed status of a link connection along with {@link Response} on successful completion of {@link
     *     Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionDetailedStatus>> getDetailedStatusWithResponseAsync(
            String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.getDetailedStatus(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * Get the detailed status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the detailed status of a link connection on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionDetailedStatus> getDetailedStatusAsync(String linkConnectionName) {
        return getDetailedStatusWithResponseAsync(linkConnectionName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get the detailed status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the detailed status of a link connection on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionDetailedStatus> getDetailedStatusAsync(String linkConnectionName, Context context) {
        return getDetailedStatusWithResponseAsync(linkConnectionName, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Get the detailed status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the detailed status of a link connection along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<LinkConnectionDetailedStatus> getDetailedStatusWithResponse(
            String linkConnectionName, Context context) {
        return getDetailedStatusWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * Get the detailed status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the detailed status of a link connection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public LinkConnectionDetailedStatus getDetailedStatus(String linkConnectionName) {
        return getDetailedStatusWithResponse(linkConnectionName, Context.NONE).getValue();
    }

    /**
     * List the link tables of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkTableListResponse>> listLinkTablesWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.listLinkTables(
                                this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * List the link tables of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkTableListResponse>> listLinkTablesWithResponseAsync(
            String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.listLinkTables(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * List the link tables of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkTableListResponse> listLinkTablesAsync(String linkConnectionName) {
        return listLinkTablesWithResponseAsync(linkConnectionName).flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * List the link tables of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkTableListResponse> listLinkTablesAsync(String linkConnectionName, Context context) {
        return listLinkTablesWithResponseAsync(linkConnectionName, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * List the link tables of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<LinkTableListResponse> listLinkTablesWithResponse(String linkConnectionName, Context context) {
        return listLinkTablesWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * List the link tables of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public LinkTableListResponse listLinkTables(String linkConnectionName) {
        return listLinkTablesWithResponse(linkConnectionName, Context.NONE).getValue();
    }

    /**
     * Query the link table status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param queryTableStatusRequest Query table status request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionQueryTableStatus>> queryTableStatusWithResponseAsync(
            String linkConnectionName, QueryTableStatusRequest queryTableStatusRequest) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.queryTableStatus(
                                this.client.getEndpoint(),
                                linkConnectionName,
                                apiVersion,
                                queryTableStatusRequest,
                                accept,
                                context));
    }

    /**
     * Query the link table status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param queryTableStatusRequest Query table status request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<LinkConnectionQueryTableStatus>> queryTableStatusWithResponseAsync(
            String linkConnectionName, QueryTableStatusRequest queryTableStatusRequest, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.queryTableStatus(
                this.client.getEndpoint(), linkConnectionName, apiVersion, queryTableStatusRequest, accept, context);
    }

    /**
     * Query the link table status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param queryTableStatusRequest Query table status request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionQueryTableStatus> queryTableStatusAsync(
            String linkConnectionName, QueryTableStatusRequest queryTableStatusRequest) {
        return queryTableStatusWithResponseAsync(linkConnectionName, queryTableStatusRequest)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Query the link table status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param queryTableStatusRequest Query table status request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<LinkConnectionQueryTableStatus> queryTableStatusAsync(
            String linkConnectionName, QueryTableStatusRequest queryTableStatusRequest, Context context) {
        return queryTableStatusWithResponseAsync(linkConnectionName, queryTableStatusRequest, context)
                .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Query the link table status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param queryTableStatusRequest Query table status request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<LinkConnectionQueryTableStatus> queryTableStatusWithResponse(
            String linkConnectionName, QueryTableStatusRequest queryTableStatusRequest, Context context) {
        return queryTableStatusWithResponseAsync(linkConnectionName, queryTableStatusRequest, context).block();
    }

    /**
     * Query the link table status of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param queryTableStatusRequest Query table status request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public LinkConnectionQueryTableStatus queryTableStatus(
            String linkConnectionName, QueryTableStatusRequest queryTableStatusRequest) {
        return queryTableStatusWithResponse(linkConnectionName, queryTableStatusRequest, Context.NONE).getValue();
    }

    /**
     * Update landing zone credential of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param updateLandingZoneCredentialRequest update landing zone credential request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> updateLandingZoneCredentialWithResponseAsync(
            String linkConnectionName, UpdateLandingZoneCredential updateLandingZoneCredentialRequest) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.updateLandingZoneCredential(
                                this.client.getEndpoint(),
                                linkConnectionName,
                                apiVersion,
                                updateLandingZoneCredentialRequest,
                                accept,
                                context));
    }

    /**
     * Update landing zone credential of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param updateLandingZoneCredentialRequest update landing zone credential request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> updateLandingZoneCredentialWithResponseAsync(
            String linkConnectionName,
            UpdateLandingZoneCredential updateLandingZoneCredentialRequest,
            Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.updateLandingZoneCredential(
                this.client.getEndpoint(),
                linkConnectionName,
                apiVersion,
                updateLandingZoneCredentialRequest,
                accept,
                context);
    }

    /**
     * Update landing zone credential of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param updateLandingZoneCredentialRequest update landing zone credential request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> updateLandingZoneCredentialAsync(
            String linkConnectionName, UpdateLandingZoneCredential updateLandingZoneCredentialRequest) {
        return updateLandingZoneCredentialWithResponseAsync(linkConnectionName, updateLandingZoneCredentialRequest)
                .flatMap(ignored -> Mono.empty());
    }

    /**
     * Update landing zone credential of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param updateLandingZoneCredentialRequest update landing zone credential request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> updateLandingZoneCredentialAsync(
            String linkConnectionName,
            UpdateLandingZoneCredential updateLandingZoneCredentialRequest,
            Context context) {
        return updateLandingZoneCredentialWithResponseAsync(
                        linkConnectionName, updateLandingZoneCredentialRequest, context)
                .flatMap(ignored -> Mono.empty());
    }

    /**
     * Update landing zone credential of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param updateLandingZoneCredentialRequest update landing zone credential request.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> updateLandingZoneCredentialWithResponse(
            String linkConnectionName,
            UpdateLandingZoneCredential updateLandingZoneCredentialRequest,
            Context context) {
        return updateLandingZoneCredentialWithResponseAsync(
                        linkConnectionName, updateLandingZoneCredentialRequest, context)
                .block();
    }

    /**
     * Update landing zone credential of a link connection.
     *
     * @param linkConnectionName The link connection name.
     * @param updateLandingZoneCredentialRequest update landing zone credential request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 updateLandingZoneCredential(
            String linkConnectionName, UpdateLandingZoneCredential updateLandingZoneCredentialRequest) {
        updateLandingZoneCredentialWithResponse(linkConnectionName, updateLandingZoneCredentialRequest, Context.NONE);
    }

    /**
     * Pause a link connection. It may take a few minutes from Pausing to Paused, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> pauseWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.pause(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * Pause a link connection. It may take a few minutes from Pausing to Paused, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> pauseWithResponseAsync(String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.pause(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * Pause a link connection. It may take a few minutes from Pausing to Paused, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> pauseAsync(String linkConnectionName) {
        return pauseWithResponseAsync(linkConnectionName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Pause a link connection. It may take a few minutes from Pausing to Paused, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> pauseAsync(String linkConnectionName, Context context) {
        return pauseWithResponseAsync(linkConnectionName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Pause a link connection. It may take a few minutes from Pausing to Paused, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> pauseWithResponse(String linkConnectionName, Context context) {
        return pauseWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * Pause a link connection. It may take a few minutes from Pausing to Paused, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 pause(String linkConnectionName) {
        pauseWithResponse(linkConnectionName, Context.NONE);
    }

    /**
     * Resume a link connection. It may take a few minutes from Resuming to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> resumeWithResponseAsync(String linkConnectionName) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context -> service.resume(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context));
    }

    /**
     * Resume a link connection. It may take a few minutes from Resuming to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Response<Void>> resumeWithResponseAsync(String linkConnectionName, Context context) {
        final String apiVersion = "2022-12-01-preview";
        final String accept = "application/json";
        return service.resume(this.client.getEndpoint(), linkConnectionName, apiVersion, accept, context);
    }

    /**
     * Resume a link connection. It may take a few minutes from Resuming to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> resumeAsync(String linkConnectionName) {
        return resumeWithResponseAsync(linkConnectionName).flatMap(ignored -> Mono.empty());
    }

    /**
     * Resume a link connection. It may take a few minutes from Resuming to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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)
    public Mono<Void> resumeAsync(String linkConnectionName, Context context) {
        return resumeWithResponseAsync(linkConnectionName, context).flatMap(ignored -> Mono.empty());
    }

    /**
     * Resume a link connection. It may take a few minutes from Resuming to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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> resumeWithResponse(String linkConnectionName, Context context) {
        return resumeWithResponseAsync(linkConnectionName, context).block();
    }

    /**
     * Resume a link connection. It may take a few minutes from Resuming to Running, monitor the status with
     * LinkConnection_GetDetailedStatus.
     *
     * @param linkConnectionName The link connection name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorException 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 resume(String linkConnectionName) {
        resumeWithResponse(linkConnectionName, Context.NONE);
    }

    /**
     * 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 CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<LinkConnectionResource>> listByWorkspaceNextSinglePageAsync(String nextLink) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context -> service.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * 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 CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<LinkConnectionResource>> listByWorkspaceNextSinglePageAsync(
            String nextLink, Context context) {
        final String accept = "application/json";
        return service.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        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 CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<LinkConnectionResource> listByWorkspaceNextSinglePage(String nextLink) {
        return listByWorkspaceNextSinglePageAsync(nextLink).block();
    }

    /**
     * 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 CloudErrorException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response body along with {@link PagedResponse}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public PagedResponse<LinkConnectionResource> listByWorkspaceNextSinglePage(String nextLink, Context context) {
        return listByWorkspaceNextSinglePageAsync(nextLink, context).block();
    }
}
