MetastoreAsyncClient.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.MetastoresImpl;
import com.azure.analytics.synapse.artifacts.models.ErrorContractException;
import com.azure.analytics.synapse.artifacts.models.MetastoreRegisterObject;
import com.azure.analytics.synapse.artifacts.models.MetastoreRegistrationResponse;
import com.azure.analytics.synapse.artifacts.models.MetastoreRequestSuccessResponse;
import com.azure.analytics.synapse.artifacts.models.MetastoreUpdateObject;
import com.azure.analytics.synapse.artifacts.models.MetastoreUpdationResponse;
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 MetastoreAsyncClient {
    private final MetastoresImpl serviceClient;

    /**
     * Initializes an instance of Metastores client.
     *
     * @param serviceClient the service client implementation.
     */
    MetastoreAsyncClient(MetastoresImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * Register files in Syms.
     *
     * @param id The name of the database to be created. The name can contain only alphanumeric characters and should
     *     not exceed 24 characters.
     * @param registerBody The body for the register 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 response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MetastoreRegistrationResponse>> registerWithResponse(
            String id, MetastoreRegisterObject registerBody) {
        return this.serviceClient.registerWithResponseAsync(id, registerBody);
    }

    /**
     * Register files in Syms.
     *
     * @param id The name of the database to be created. The name can contain only alphanumeric characters and should
     *     not exceed 24 characters.
     * @param registerBody The body for the register 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 response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MetastoreRegistrationResponse> register(String id, MetastoreRegisterObject registerBody) {
        return this.serviceClient.registerAsync(id, registerBody);
    }

    /**
     * Gets status of the database.
     *
     * @param id The id parameter.
     * @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 status of the database.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MetastoreRequestSuccessResponse>> getDatabaseOperationsWithResponse(String id) {
        return this.serviceClient.getDatabaseOperationsWithResponseAsync(id);
    }

    /**
     * Gets status of the database.
     *
     * @param id The id parameter.
     * @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 status of the database.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MetastoreRequestSuccessResponse> getDatabaseOperations(String id) {
        return this.serviceClient.getDatabaseOperationsAsync(id);
    }

    /**
     * Update files in Syms.
     *
     * @param id The name of the database to be updated.
     * @param updateBody The body for the update 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 response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<MetastoreUpdationResponse>> updateWithResponse(String id, MetastoreUpdateObject updateBody) {
        return this.serviceClient.updateWithResponseAsync(id, updateBody);
    }

    /**
     * Update files in Syms.
     *
     * @param id The name of the database to be updated.
     * @param updateBody The body for the update 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 response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<MetastoreUpdationResponse> update(String id, MetastoreUpdateObject updateBody) {
        return this.serviceClient.updateAsync(id, updateBody);
    }

    /**
     * Remove files in Syms.
     *
     * @param id The id parameter.
     * @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>> deleteWithResponse(String id) {
        return this.serviceClient.deleteWithResponseAsync(id);
    }

    /**
     * Remove files in Syms.
     *
     * @param id The id parameter.
     * @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> delete(String id) {
        return this.serviceClient.deleteAsync(id);
    }
}