NotebookAsyncClient.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.NotebooksImpl;
import com.azure.analytics.synapse.artifacts.models.ArtifactRenameRequest;
import com.azure.analytics.synapse.artifacts.models.CloudErrorAutoGeneratedException;
import com.azure.analytics.synapse.artifacts.models.NotebookResource;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedFlux;
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 NotebookAsyncClient {
    private final NotebooksImpl serviceClient;

    /**
     * Initializes an instance of Notebooks client.
     *
     * @param serviceClient the service client implementation.
     */
    NotebookAsyncClient(NotebooksImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * Lists Notebooks.
     *
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of Notebook resources.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<NotebookResource> getNotebooksByWorkspace() {
        return this.serviceClient.getNotebooksByWorkspaceAsync();
    }

    /**
     * Lists a summary of Notebooks.
     *
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a list of Notebook resources.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<NotebookResource> getNotebookSummaryByWorkSpace() {
        return this.serviceClient.getNotebookSummaryByWorkSpaceAsync();
    }

    /**
     * Creates or updates a Note Book.
     *
     * @param notebookName The notebook name.
     * @param notebook Note book resource definition.
     * @param ifMatch ETag of the Note book entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return notebook resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<NotebookResource>> createOrUpdateNotebookWithResponse(
            String notebookName, NotebookResource notebook, String ifMatch) {
        return this.serviceClient.createOrUpdateNotebookWithResponseAsync(notebookName, notebook, ifMatch);
    }

    /**
     * Creates or updates a Note Book.
     *
     * @param notebookName The notebook name.
     * @param notebook Note book resource definition.
     * @param ifMatch ETag of the Note book entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return notebook resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<NotebookResource> createOrUpdateNotebook(
            String notebookName, NotebookResource notebook, String ifMatch) {
        return this.serviceClient.createOrUpdateNotebookAsync(notebookName, notebook, ifMatch);
    }

    /**
     * Creates or updates a Note Book.
     *
     * @param notebookName The notebook name.
     * @param notebook Note book resource definition.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return notebook resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<NotebookResource> createOrUpdateNotebook(String notebookName, NotebookResource notebook) {
        return this.serviceClient.createOrUpdateNotebookAsync(notebookName, notebook);
    }

    /**
     * Gets a Note Book.
     *
     * @param notebookName The notebook name.
     * @param ifNoneMatch ETag of the Notebook entity. Should only be specified for get. If the ETag matches the
     *     existing entity tag, or if * was provided, then no content will be returned.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Note Book.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<NotebookResource>> getNotebookWithResponse(String notebookName, String ifNoneMatch) {
        return this.serviceClient.getNotebookWithResponseAsync(notebookName, ifNoneMatch);
    }

    /**
     * Gets a Note Book.
     *
     * @param notebookName The notebook name.
     * @param ifNoneMatch ETag of the Notebook entity. Should only be specified for get. If the ETag matches the
     *     existing entity tag, or if * was provided, then no content will be returned.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Note Book.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<NotebookResource> getNotebook(String notebookName, String ifNoneMatch) {
        return this.serviceClient.getNotebookAsync(notebookName, ifNoneMatch);
    }

    /**
     * Gets a Note Book.
     *
     * @param notebookName The notebook name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a Note Book.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<NotebookResource> getNotebook(String notebookName) {
        return this.serviceClient.getNotebookAsync(notebookName);
    }

    /**
     * Deletes a Note book.
     *
     * @param notebookName The notebook name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException 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>> deleteNotebookWithResponse(String notebookName) {
        return this.serviceClient.deleteNotebookWithResponseAsync(notebookName);
    }

    /**
     * Deletes a Note book.
     *
     * @param notebookName The notebook name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException 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> deleteNotebook(String notebookName) {
        return this.serviceClient.deleteNotebookAsync(notebookName);
    }

    /**
     * Renames a notebook.
     *
     * @param notebookName The notebook name.
     * @param request proposed new name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException 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>> renameNotebookWithResponse(String notebookName, ArtifactRenameRequest request) {
        return this.serviceClient.renameNotebookWithResponseAsync(notebookName, request);
    }

    /**
     * Renames a notebook.
     *
     * @param notebookName The notebook name.
     * @param request proposed new name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws CloudErrorAutoGeneratedException 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> renameNotebook(String notebookName, ArtifactRenameRequest request) {
        return this.serviceClient.renameNotebookAsync(notebookName, request);
    }
}