SqlPoolsClient.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.SqlPoolsImpl;
import com.azure.analytics.synapse.artifacts.models.ErrorContractException;
import com.azure.analytics.synapse.artifacts.models.SqlPool;
import com.azure.analytics.synapse.artifacts.models.SqlPoolInfoListResult;
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 SqlPoolsClient {
    private final SqlPoolsImpl serviceClient;

    /**
     * Initializes an instance of SqlPools client.
     *
     * @param serviceClient the service client implementation.
     */
    SqlPoolsClient(SqlPoolsImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * List Sql Pools.
     *
     * @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 sQL pool collection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SqlPoolInfoListResult list() {
        return this.serviceClient.list();
    }

    /**
     * List Sql Pools.
     *
     * @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 sQL pool collection.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<SqlPoolInfoListResult> listWithResponse(Context context) {
        return this.serviceClient.listWithResponse(context);
    }

    /**
     * Get Sql Pool.
     *
     * @param sqlPoolName The Sql Pool 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 sql Pool.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public SqlPool get(String sqlPoolName) {
        return this.serviceClient.get(sqlPoolName);
    }

    /**
     * Get Sql Pool.
     *
     * @param sqlPoolName The Sql Pool name.
     * @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 sql Pool.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<SqlPool> getWithResponse(String sqlPoolName, Context context) {
        return this.serviceClient.getWithResponse(sqlPoolName, context);
    }
}