KqlScriptAsyncClient.java

// 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;

import com.azure.analytics.synapse.artifacts.implementation.KqlScriptsOperationsImpl;
import com.azure.analytics.synapse.artifacts.models.ArtifactRenameRequest;
import com.azure.analytics.synapse.artifacts.models.ErrorContractException;
import com.azure.analytics.synapse.artifacts.models.KqlScriptResource;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import reactor.core.publisher.Mono;

/** Initializes a new instance of the asynchronous ArtifactsClient type. */
@ServiceClient(builder = ArtifactsClientBuilder.class, isAsync = true)
public final class KqlScriptAsyncClient {
    private final KqlScriptsOperationsImpl serviceClient;

    /**
     * Initializes an instance of KqlScriptsOperations client.
     *
     * @param serviceClient the service client implementation.
     */
    KqlScriptAsyncClient(KqlScriptsOperationsImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * Creates or updates a KQL Script.
     *
     * @param kqlScriptName KQL script name.
     * @param kqlScript KQL script.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException 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 Mono<Response<KqlScriptResource>> createOrUpdateWithResponse(
            String kqlScriptName, KqlScriptResource kqlScript) {
        return this.serviceClient.createOrUpdateWithResponseAsync(kqlScriptName, kqlScript);
    }

    /**
     * Creates or updates a KQL Script.
     *
     * @param kqlScriptName KQL script name.
     * @param kqlScript KQL script.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException 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 Mono<KqlScriptResource> createOrUpdate(String kqlScriptName, KqlScriptResource kqlScript) {
        return this.serviceClient.createOrUpdateAsync(kqlScriptName, kqlScript);
    }

    /**
     * Get KQL script by name.
     *
     * @param kqlScriptName KQL script name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return kQL script by name.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<KqlScriptResource>> getByNameWithResponse(String kqlScriptName) {
        return this.serviceClient.getByNameWithResponseAsync(kqlScriptName);
    }

    /**
     * Get KQL script by name.
     *
     * @param kqlScriptName KQL script name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return kQL script by name.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<KqlScriptResource> getByName(String kqlScriptName) {
        return this.serviceClient.getByNameAsync(kqlScriptName);
    }

    /**
     * Delete KQL script by name.
     *
     * @param kqlScriptName KQL script name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException 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>> deleteByNameWithResponse(String kqlScriptName) {
        return this.serviceClient.deleteByNameWithResponseAsync(kqlScriptName);
    }

    /**
     * Delete KQL script by name.
     *
     * @param kqlScriptName KQL script name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException 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> deleteByName(String kqlScriptName) {
        return this.serviceClient.deleteByNameAsync(kqlScriptName);
    }

    /**
     * Rename KQL script.
     *
     * @param kqlScriptName KQL script name.
     * @param renameRequest Rename request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException 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>> renameWithResponse(String kqlScriptName, ArtifactRenameRequest renameRequest) {
        return this.serviceClient.renameWithResponseAsync(kqlScriptName, renameRequest);
    }

    /**
     * Rename KQL script.
     *
     * @param kqlScriptName KQL script name.
     * @param renameRequest Rename request.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ErrorContractException 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> rename(String kqlScriptName, ArtifactRenameRequest renameRequest) {
        return this.serviceClient.renameAsync(kqlScriptName, renameRequest);
    }
}