SqlPoolsAsyncClient.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 reactor.core.publisher.Mono;

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

    /**
     * Initializes an instance of SqlPools client.
     *
     * @param serviceClient the service client implementation.
     */
    SqlPoolsAsyncClient(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 Mono<Response<SqlPoolInfoListResult>> listWithResponse() {
        return this.serviceClient.listWithResponseAsync();
    }

    /**
     * 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 Mono<SqlPoolInfoListResult> list() {
        return this.serviceClient.listAsync();
    }

    /**
     * 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 Mono<Response<SqlPool>> getWithResponse(String sqlPoolName) {
        return this.serviceClient.getWithResponseAsync(sqlPoolName);
    }

    /**
     * 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 Mono<SqlPool> get(String sqlPoolName) {
        return this.serviceClient.getAsync(sqlPoolName);
    }
}