DataFlowsImpl.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.implementation;

import com.azure.analytics.synapse.artifacts.models.ArtifactRenameRequest;
import com.azure.analytics.synapse.artifacts.models.CloudErrorAutoGeneratedException;
import com.azure.analytics.synapse.artifacts.models.DataFlowListResponse;
import com.azure.analytics.synapse.artifacts.models.DataFlowResource;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import reactor.core.publisher.Mono;

/** An instance of this class provides access to all the operations defined in DataFlows. */
public final class DataFlowsImpl {
    /** The proxy service used to perform REST calls. */
    private final DataFlowsService service;

    /** The service client containing this operation class. */
    private final ArtifactsClientImpl client;

    /**
     * Initializes an instance of DataFlowsImpl.
     *
     * @param client the instance of the service client containing this operation class.
     */
    DataFlowsImpl(ArtifactsClientImpl client) {
        this.service =
                RestProxy.create(DataFlowsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
        this.client = client;
    }

    /**
     * The interface defining all the services for ArtifactsClientDataFlows to be used by the proxy service to perform
     * REST calls.
     */
    @Host("{endpoint}")
    @ServiceInterface(name = "ArtifactsClientDataF")
    private interface DataFlowsService {
        @Put("/dataflows/{dataFlowName}")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
        Mono<Response<DataFlowResource>> createOrUpdateDataFlow(
                @HostParam("endpoint") String endpoint,
                @PathParam("dataFlowName") String dataFlowName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("If-Match") String ifMatch,
                @BodyParam("application/json") DataFlowResource dataFlow,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/dataflows/{dataFlowName}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
        Mono<Response<DataFlowResource>> getDataFlow(
                @HostParam("endpoint") String endpoint,
                @PathParam("dataFlowName") String dataFlowName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("If-None-Match") String ifNoneMatch,
                @HeaderParam("Accept") String accept,
                Context context);

        @Delete("/dataflows/{dataFlowName}")
        @ExpectedResponses({200, 202, 204})
        @UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
        Mono<Response<Void>> deleteDataFlow(
                @HostParam("endpoint") String endpoint,
                @PathParam("dataFlowName") String dataFlowName,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Post("/dataflows/{dataFlowName}/rename")
        @ExpectedResponses({200, 202})
        @UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
        Mono<Response<Void>> renameDataFlow(
                @HostParam("endpoint") String endpoint,
                @PathParam("dataFlowName") String dataFlowName,
                @QueryParam("api-version") String apiVersion,
                @BodyParam("application/json") ArtifactRenameRequest request,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("/dataflows")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
        Mono<Response<DataFlowListResponse>> getDataFlowsByWorkspace(
                @HostParam("endpoint") String endpoint,
                @QueryParam("api-version") String apiVersion,
                @HeaderParam("Accept") String accept,
                Context context);

        @Get("{nextLink}")
        @ExpectedResponses({200})
        @UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
        Mono<Response<DataFlowListResponse>> getDataFlowsByWorkspaceNext(
                @PathParam(value = "nextLink", encoded = true) String nextLink,
                @HostParam("endpoint") String endpoint,
                @HeaderParam("Accept") String accept,
                Context context);
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow resource definition.
     * @param ifMatch ETag of the data flow 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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<DataFlowResource>> createOrUpdateDataFlowWithResponseAsync(
            String dataFlowName, DataFlowResource dataFlow, String ifMatch) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.createOrUpdateDataFlow(
                                this.client.getEndpoint(),
                                dataFlowName,
                                apiVersion,
                                ifMatch,
                                dataFlow,
                                accept,
                                context));
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow resource definition.
     * @param ifMatch ETag of the data flow entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @param context The context to associate with this operation.
     * @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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<DataFlowResource>> createOrUpdateDataFlowWithResponseAsync(
            String dataFlowName, DataFlowResource dataFlow, String ifMatch, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.createOrUpdateDataFlow(
                this.client.getEndpoint(), dataFlowName, apiVersion, ifMatch, dataFlow, accept, context);
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow resource definition.
     * @param ifMatch ETag of the data flow 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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<DataFlowResource> createOrUpdateDataFlowAsync(
            String dataFlowName, DataFlowResource dataFlow, String ifMatch) {
        return createOrUpdateDataFlowWithResponseAsync(dataFlowName, dataFlow, ifMatch)
                .flatMap(
                        (Response<DataFlowResource> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow 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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<DataFlowResource> createOrUpdateDataFlowAsync(String dataFlowName, DataFlowResource dataFlow) {
        final String ifMatch = null;
        return createOrUpdateDataFlowWithResponseAsync(dataFlowName, dataFlow, ifMatch)
                .flatMap(
                        (Response<DataFlowResource> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow resource definition.
     * @param ifMatch ETag of the data flow entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @param context The context to associate with this operation.
     * @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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<DataFlowResource> createOrUpdateDataFlowAsync(
            String dataFlowName, DataFlowResource dataFlow, String ifMatch, Context context) {
        return createOrUpdateDataFlowWithResponseAsync(dataFlowName, dataFlow, ifMatch, context)
                .flatMap(
                        (Response<DataFlowResource> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow resource definition.
     * @param ifMatch ETag of the data flow 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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DataFlowResource createOrUpdateDataFlow(String dataFlowName, DataFlowResource dataFlow, String ifMatch) {
        return createOrUpdateDataFlowAsync(dataFlowName, dataFlow, ifMatch).block();
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow 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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DataFlowResource createOrUpdateDataFlow(String dataFlowName, DataFlowResource dataFlow) {
        final String ifMatch = null;
        return createOrUpdateDataFlowAsync(dataFlowName, dataFlow, ifMatch).block();
    }

    /**
     * Creates or updates a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param dataFlow Data flow resource definition.
     * @param ifMatch ETag of the data flow entity. Should only be specified for update, for which it should match
     *     existing entity or can be * for unconditional update.
     * @param context The context to associate with this operation.
     * @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 data flow resource type.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<DataFlowResource> createOrUpdateDataFlowWithResponse(
            String dataFlowName, DataFlowResource dataFlow, String ifMatch, Context context) {
        return createOrUpdateDataFlowWithResponseAsync(dataFlowName, dataFlow, ifMatch, context).block();
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param ifNoneMatch ETag of the data flow 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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<DataFlowResource>> getDataFlowWithResponseAsync(String dataFlowName, String ifNoneMatch) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.getDataFlow(
                                this.client.getEndpoint(), dataFlowName, apiVersion, ifNoneMatch, accept, context));
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param ifNoneMatch ETag of the data flow 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.
     * @param context The context to associate with this operation.
     * @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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<Response<DataFlowResource>> getDataFlowWithResponseAsync(
            String dataFlowName, String ifNoneMatch, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.getDataFlow(this.client.getEndpoint(), dataFlowName, apiVersion, ifNoneMatch, accept, context);
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param ifNoneMatch ETag of the data flow 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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<DataFlowResource> getDataFlowAsync(String dataFlowName, String ifNoneMatch) {
        return getDataFlowWithResponseAsync(dataFlowName, ifNoneMatch)
                .flatMap(
                        (Response<DataFlowResource> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow 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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<DataFlowResource> getDataFlowAsync(String dataFlowName) {
        final String ifNoneMatch = null;
        return getDataFlowWithResponseAsync(dataFlowName, ifNoneMatch)
                .flatMap(
                        (Response<DataFlowResource> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param ifNoneMatch ETag of the data flow 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.
     * @param context The context to associate with this operation.
     * @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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<DataFlowResource> getDataFlowAsync(String dataFlowName, String ifNoneMatch, Context context) {
        return getDataFlowWithResponseAsync(dataFlowName, ifNoneMatch, context)
                .flatMap(
                        (Response<DataFlowResource> res) -> {
                            if (res.getValue() != null) {
                                return Mono.just(res.getValue());
                            } else {
                                return Mono.empty();
                            }
                        });
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param ifNoneMatch ETag of the data flow 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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DataFlowResource getDataFlow(String dataFlowName, String ifNoneMatch) {
        return getDataFlowAsync(dataFlowName, ifNoneMatch).block();
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow 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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public DataFlowResource getDataFlow(String dataFlowName) {
        final String ifNoneMatch = null;
        return getDataFlowAsync(dataFlowName, ifNoneMatch).block();
    }

    /**
     * Gets a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param ifNoneMatch ETag of the data flow 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.
     * @param context The context to associate with this operation.
     * @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 data flow.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<DataFlowResource> getDataFlowWithResponse(
            String dataFlowName, String ifNoneMatch, Context context) {
        return getDataFlowWithResponseAsync(dataFlowName, ifNoneMatch, context).block();
    }

    /**
     * Deletes a data flow.
     *
     * @param dataFlowName The data flow 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>> deleteDataFlowWithResponseAsync(String dataFlowName) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.deleteDataFlow(this.client.getEndpoint(), dataFlowName, apiVersion, accept, context));
    }

    /**
     * Deletes a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param context The context to associate with this operation.
     * @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>> deleteDataFlowWithResponseAsync(String dataFlowName, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.deleteDataFlow(this.client.getEndpoint(), dataFlowName, apiVersion, accept, context);
    }

    /**
     * Deletes a data flow.
     *
     * @param dataFlowName The data flow 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> deleteDataFlowAsync(String dataFlowName) {
        return deleteDataFlowWithResponseAsync(dataFlowName).flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Deletes a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param context The context to associate with this operation.
     * @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> deleteDataFlowAsync(String dataFlowName, Context context) {
        return deleteDataFlowWithResponseAsync(dataFlowName, context).flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Deletes a data flow.
     *
     * @param dataFlowName The data flow 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.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void deleteDataFlow(String dataFlowName) {
        deleteDataFlowAsync(dataFlowName).block();
    }

    /**
     * Deletes a data flow.
     *
     * @param dataFlowName The data flow name.
     * @param context The context to associate with this operation.
     * @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 response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> deleteDataFlowWithResponse(String dataFlowName, Context context) {
        return deleteDataFlowWithResponseAsync(dataFlowName, context).block();
    }

    /**
     * Renames a dataflow.
     *
     * @param dataFlowName The data flow 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>> renameDataFlowWithResponseAsync(String dataFlowName, ArtifactRenameRequest request) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                context ->
                        service.renameDataFlow(
                                this.client.getEndpoint(), dataFlowName, apiVersion, request, accept, context));
    }

    /**
     * Renames a dataflow.
     *
     * @param dataFlowName The data flow name.
     * @param request proposed new name.
     * @param context The context to associate with this operation.
     * @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>> renameDataFlowWithResponseAsync(
            String dataFlowName, ArtifactRenameRequest request, Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.renameDataFlow(this.client.getEndpoint(), dataFlowName, apiVersion, request, accept, context);
    }

    /**
     * Renames a dataflow.
     *
     * @param dataFlowName The data flow 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> renameDataFlowAsync(String dataFlowName, ArtifactRenameRequest request) {
        return renameDataFlowWithResponseAsync(dataFlowName, request).flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Renames a dataflow.
     *
     * @param dataFlowName The data flow name.
     * @param request proposed new name.
     * @param context The context to associate with this operation.
     * @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> renameDataFlowAsync(String dataFlowName, ArtifactRenameRequest request, Context context) {
        return renameDataFlowWithResponseAsync(dataFlowName, request, context)
                .flatMap((Response<Void> res) -> Mono.empty());
    }

    /**
     * Renames a dataflow.
     *
     * @param dataFlowName The data flow 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.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public void renameDataFlow(String dataFlowName, ArtifactRenameRequest request) {
        renameDataFlowAsync(dataFlowName, request).block();
    }

    /**
     * Renames a dataflow.
     *
     * @param dataFlowName The data flow name.
     * @param request proposed new name.
     * @param context The context to associate with this operation.
     * @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 response.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> renameDataFlowWithResponse(
            String dataFlowName, ArtifactRenameRequest request, Context context) {
        return renameDataFlowWithResponseAsync(dataFlowName, request, context).block();
    }

    /**
     * Lists data flows.
     *
     * @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 data flow resources.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<DataFlowResource>> getDataFlowsByWorkspaceSinglePageAsync() {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context ->
                                service.getDataFlowsByWorkspace(this.client.getEndpoint(), apiVersion, accept, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Lists data flows.
     *
     * @param context The context to associate with this operation.
     * @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 list of data flow resources.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<DataFlowResource>> getDataFlowsByWorkspaceSinglePageAsync(Context context) {
        final String apiVersion = "2020-12-01";
        final String accept = "application/json";
        return service.getDataFlowsByWorkspace(this.client.getEndpoint(), apiVersion, accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Lists data flows.
     *
     * @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 data flow resources.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<DataFlowResource> getDataFlowsByWorkspaceAsync() {
        return new PagedFlux<>(
                () -> getDataFlowsByWorkspaceSinglePageAsync(),
                nextLink -> getDataFlowsByWorkspaceNextSinglePageAsync(nextLink));
    }

    /**
     * Lists data flows.
     *
     * @param context The context to associate with this operation.
     * @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 list of data flow resources.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedFlux<DataFlowResource> getDataFlowsByWorkspaceAsync(Context context) {
        return new PagedFlux<>(
                () -> getDataFlowsByWorkspaceSinglePageAsync(context),
                nextLink -> getDataFlowsByWorkspaceNextSinglePageAsync(nextLink, context));
    }

    /**
     * Lists data flows.
     *
     * @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 data flow resources.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<DataFlowResource> getDataFlowsByWorkspace() {
        return new PagedIterable<>(getDataFlowsByWorkspaceAsync());
    }

    /**
     * Lists data flows.
     *
     * @param context The context to associate with this operation.
     * @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 list of data flow resources.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<DataFlowResource> getDataFlowsByWorkspace(Context context) {
        return new PagedIterable<>(getDataFlowsByWorkspaceAsync(context));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The nextLink parameter.
     * @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 list of data flow resources.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<DataFlowResource>> getDataFlowsByWorkspaceNextSinglePageAsync(String nextLink) {
        final String accept = "application/json";
        return FluxUtil.withContext(
                        context ->
                                service.getDataFlowsByWorkspaceNext(
                                        nextLink, this.client.getEndpoint(), accept, context))
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }

    /**
     * Get the next page of items.
     *
     * @param nextLink The nextLink parameter.
     * @param context The context to associate with this operation.
     * @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 list of data flow resources.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Mono<PagedResponse<DataFlowResource>> getDataFlowsByWorkspaceNextSinglePageAsync(
            String nextLink, Context context) {
        final String accept = "application/json";
        return service.getDataFlowsByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)
                .map(
                        res ->
                                new PagedResponseBase<>(
                                        res.getRequest(),
                                        res.getStatusCode(),
                                        res.getHeaders(),
                                        res.getValue().getValue(),
                                        res.getValue().getNextLink(),
                                        null));
    }
}