MetastoreClient.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 com.azure.core.util.Context;

/** Initializes a new instance of the synchronous ArtifactsClient type. */
@ServiceClient(builder = ArtifactsClientBuilder.class)
public final class MetastoreClient {
    private final MetastoresImpl serviceClient;

    /**
     * Initializes an instance of Metastores client.
     *
     * @param serviceClient the service client implementation.
     */
    MetastoreClient(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 MetastoreRegistrationResponse register(String id, MetastoreRegisterObject registerBody) {
        return this.serviceClient.register(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.
     * @param context The context to associate with this operation.
     * @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 Response<MetastoreRegistrationResponse> registerWithResponse(
            String id, MetastoreRegisterObject registerBody, Context context) {
        return this.serviceClient.registerWithResponse(id, registerBody, context);
    }

    /**
     * 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 MetastoreRequestSuccessResponse getDatabaseOperations(String id) {
        return this.serviceClient.getDatabaseOperations(id);
    }

    /**
     * Gets status of the database.
     *
     * @param id The id parameter.
     * @param context The context to associate with this operation.
     * @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 Response<MetastoreRequestSuccessResponse> getDatabaseOperationsWithResponse(String id, Context context) {
        return this.serviceClient.getDatabaseOperationsWithResponse(id, context);
    }

    /**
     * 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 MetastoreUpdationResponse update(String id, MetastoreUpdateObject updateBody) {
        return this.serviceClient.update(id, updateBody);
    }

    /**
     * Update files in Syms.
     *
     * @param id The name of the database to be updated.
     * @param updateBody The body for the update request.
     * @param context The context to associate with this operation.
     * @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 Response<MetastoreUpdationResponse> updateWithResponse(
            String id, MetastoreUpdateObject updateBody, Context context) {
        return this.serviceClient.updateWithResponse(id, updateBody, context);
    }

    /**
     * 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.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void delete(String id) {
        this.serviceClient.delete(id);
    }

    /**
     * Remove files in Syms.
     *
     * @param id The id parameter.
     * @param context The context to associate with this operation.
     * @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 Response<Void> deleteWithResponse(String id, Context context) {
        return this.serviceClient.deleteWithResponse(id, context);
    }
}