All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.storagecache.implementation.ImportJobsClientImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for StorageCache Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Managed Lustre provides a fully managed Lustre® file system, integrated with Blob storage, for use on demand. These operations create and manage Azure Managed Lustre file systems. Package tag package-2024-03.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.storagecache.implementation;

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.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
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.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.polling.PollerFlux;
import com.azure.core.util.polling.SyncPoller;
import com.azure.resourcemanager.storagecache.fluent.ImportJobsClient;
import com.azure.resourcemanager.storagecache.fluent.models.ImportJobInner;
import com.azure.resourcemanager.storagecache.models.ImportJobUpdate;
import com.azure.resourcemanager.storagecache.models.ImportJobsListResult;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

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

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

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

    /**
     * The interface defining all the services for StorageCacheManagementClientImportJobs to be used by the proxy
     * service to perform REST calls.
     */
    @Host("{$host}")
    @ServiceInterface(name = "StorageCacheManageme")
    public interface ImportJobsService {
        @Headers({ "Content-Type: application/json" })
        @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}")
        @ExpectedResponses({ 202, 204 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> delete(@HostParam("$host") String endpoint,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("amlFilesystemName") String amlFilesystemName, @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId, @PathParam("importJobName") String importJobName,
            @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> get(@HostParam("$host") String endpoint,
            @PathParam("resourceGroupName") String resourceGroupName,
            @PathParam("amlFilesystemName") String amlFilesystemName, @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId, @PathParam("importJobName") String importJobName,
            @HeaderParam("Accept") String accept, Context context);

        @Headers({ "Content-Type: application/json" })
        @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}")
        @ExpectedResponses({ 200, 201 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> createOrUpdate(@HostParam("$host") String endpoint,
            @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("amlFilesystemName") String amlFilesystemName, @PathParam("importJobName") String importJobName,
            @BodyParam("application/json") ImportJobInner importJob, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs/{importJobName}")
        @ExpectedResponses({ 200, 202 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono>> update(@HostParam("$host") String endpoint,
            @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("amlFilesystemName") String amlFilesystemName, @PathParam("importJobName") String importJobName,
            @BodyParam("application/json") ImportJobUpdate importJob, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageCache/amlFilesystems/{amlFilesystemName}/importJobs")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listByAmlFilesystem(@HostParam("$host") String endpoint,
            @PathParam("resourceGroupName") String resourceGroupName, @QueryParam("api-version") String apiVersion,
            @PathParam("subscriptionId") String subscriptionId,
            @PathParam("amlFilesystemName") String amlFilesystemName, @HeaderParam("Accept") String accept,
            Context context);

        @Headers({ "Content-Type: application/json" })
        @Get("{nextLink}")
        @ExpectedResponses({ 200 })
        @UnexpectedResponseExceptionType(ManagementException.class)
        Mono> listByAmlFilesystemNext(
            @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
            @HeaderParam("Accept") String accept, Context context);
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> deleteWithResponseAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.delete(this.client.getEndpoint(), resourceGroupName, amlFilesystemName,
                this.client.getApiVersion(), this.client.getSubscriptionId(), importJobName, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> deleteWithResponseAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.delete(this.client.getEndpoint(), resourceGroupName, amlFilesystemName,
            this.client.getApiVersion(), this.client.getSubscriptionId(), importJobName, accept, context);
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName) {
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            this.client.getContext());
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = deleteWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class,
            context);
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, Void> beginDelete(String resourceGroupName, String amlFilesystemName,
        String importJobName) {
        return this.beginDeleteAsync(resourceGroupName, amlFilesystemName, importJobName).getSyncPoller();
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of long-running operation.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, Void> beginDelete(String resourceGroupName, String amlFilesystemName,
        String importJobName, Context context) {
        return this.beginDeleteAsync(resourceGroupName, amlFilesystemName, importJobName, context).getSyncPoller();
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono deleteAsync(String resourceGroupName, String amlFilesystemName, String importJobName) {
        return beginDeleteAsync(resourceGroupName, amlFilesystemName, importJobName).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return A {@link Mono} that completes when a successful response is received.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono deleteAsync(String resourceGroupName, String amlFilesystemName, String importJobName,
        Context context) {
        return beginDeleteAsync(resourceGroupName, amlFilesystemName, importJobName, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException 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 resourceGroupName, String amlFilesystemName, String importJobName) {
        deleteAsync(resourceGroupName, amlFilesystemName, importJobName).block();
    }

    /**
     * Schedules an import job for deletion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException 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 resourceGroupName, String amlFilesystemName, String importJobName, Context context) {
        deleteAsync(resourceGroupName, amlFilesystemName, importJobName, context).block();
    }

    /**
     * Returns an import job.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getWithResponseAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.get(this.client.getEndpoint(), resourceGroupName, amlFilesystemName,
                this.client.getApiVersion(), this.client.getSubscriptionId(), importJobName, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Returns an import job.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> getWithResponseAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.get(this.client.getEndpoint(), resourceGroupName, amlFilesystemName, this.client.getApiVersion(),
            this.client.getSubscriptionId(), importJobName, accept, context);
    }

    /**
     * Returns an import job.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono getAsync(String resourceGroupName, String amlFilesystemName, String importJobName) {
        return getWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName)
            .flatMap(res -> Mono.justOrEmpty(res.getValue()));
    }

    /**
     * Returns an import job.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance along with {@link Response}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response getWithResponse(String resourceGroupName, String amlFilesystemName,
        String importJobName, Context context) {
        return getWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName, context).block();
    }

    /**
     * Returns an import job.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ImportJobInner get(String resourceGroupName, String amlFilesystemName, String importJobName) {
        return getWithResponse(resourceGroupName, amlFilesystemName, importJobName, Context.NONE).getValue();
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobInner importJob) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        if (importJob == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJob is required and cannot be null."));
        } else {
            importJob.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), resourceGroupName,
                this.client.getApiVersion(), this.client.getSubscriptionId(), amlFilesystemName, importJobName,
                importJob, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobInner importJob, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        if (importJob == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJob is required and cannot be null."));
        } else {
            importJob.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.createOrUpdate(this.client.getEndpoint(), resourceGroupName, this.client.getApiVersion(),
            this.client.getSubscriptionId(), amlFilesystemName, importJobName, importJob, accept, context);
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, ImportJobInner> beginCreateOrUpdateAsync(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobInner importJob) {
        Mono>> mono
            = createOrUpdateWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName, importJob);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            ImportJobInner.class, ImportJobInner.class, this.client.getContext());
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, ImportJobInner> beginCreateOrUpdateAsync(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobInner importJob, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = createOrUpdateWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            ImportJobInner.class, ImportJobInner.class, context);
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, ImportJobInner> beginCreateOrUpdate(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobInner importJob) {
        return this.beginCreateOrUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob)
            .getSyncPoller();
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, ImportJobInner> beginCreateOrUpdate(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobInner importJob, Context context) {
        return this.beginCreateOrUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context)
            .getSyncPoller();
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName, ImportJobInner importJob) {
        return beginCreateOrUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono createOrUpdateAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName, ImportJobInner importJob, Context context) {
        return beginCreateOrUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ImportJobInner createOrUpdate(String resourceGroupName, String amlFilesystemName, String importJobName,
        ImportJobInner importJob) {
        return createOrUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob).block();
    }

    /**
     * Create or update an import job. Import jobs are automatically deleted 72 hours after completion.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ImportJobInner createOrUpdate(String resourceGroupName, String amlFilesystemName, String importJobName,
        ImportJobInner importJob, Context context) {
        return createOrUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context).block();
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> updateWithResponseAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName, ImportJobUpdate importJob) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        if (importJob == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJob is required and cannot be null."));
        } else {
            importJob.validate();
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.update(this.client.getEndpoint(), resourceGroupName, this.client.getApiVersion(),
                    this.client.getSubscriptionId(), amlFilesystemName, importJobName, importJob, accept, context))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance along with {@link Response} on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono>> updateWithResponseAsync(String resourceGroupName, String amlFilesystemName,
        String importJobName, ImportJobUpdate importJob, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        if (importJobName == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJobName is required and cannot be null."));
        }
        if (importJob == null) {
            return Mono.error(new IllegalArgumentException("Parameter importJob is required and cannot be null."));
        } else {
            importJob.validate();
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.update(this.client.getEndpoint(), resourceGroupName, this.client.getApiVersion(),
            this.client.getSubscriptionId(), amlFilesystemName, importJobName, importJob, accept, context);
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, ImportJobInner> beginUpdateAsync(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobUpdate importJob) {
        Mono>> mono
            = updateWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName, importJob);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            ImportJobInner.class, ImportJobInner.class, this.client.getContext());
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link PollerFlux} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    private PollerFlux, ImportJobInner> beginUpdateAsync(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobUpdate importJob, Context context) {
        context = this.client.mergeContext(context);
        Mono>> mono
            = updateWithResponseAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context);
        return this.client.getLroResult(mono, this.client.getHttpPipeline(),
            ImportJobInner.class, ImportJobInner.class, context);
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, ImportJobInner> beginUpdate(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobUpdate importJob) {
        return this.beginUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob).getSyncPoller();
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the {@link SyncPoller} for polling of an import job instance.
     */
    @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
    public SyncPoller, ImportJobInner> beginUpdate(String resourceGroupName,
        String amlFilesystemName, String importJobName, ImportJobUpdate importJob, Context context) {
        return this.beginUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context)
            .getSyncPoller();
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String amlFilesystemName, String importJobName,
        ImportJobUpdate importJob) {
        return beginUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance on successful completion of {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono updateAsync(String resourceGroupName, String amlFilesystemName, String importJobName,
        ImportJobUpdate importJob, Context context) {
        return beginUpdateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context).last()
            .flatMap(this.client::getLroFinalResultOrError);
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ImportJobInner update(String resourceGroupName, String amlFilesystemName, String importJobName,
        ImportJobUpdate importJob) {
        return updateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob).block();
    }

    /**
     * Update an import job instance.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param importJobName Name for the import job. Allows alphanumerics, underscores, and hyphens. Start and end with
     * alphanumeric.
     * @param importJob Object containing the user-selectable properties of the import job. If read-only properties are
     * included, they must match the existing values of those properties.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an import job instance.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    public ImportJobInner update(String resourceGroupName, String amlFilesystemName, String importJobName,
        ImportJobUpdate importJob, Context context) {
        return updateAsync(resourceGroupName, amlFilesystemName, importJobName, importJob, context).block();
    }

    /**
     * Returns all import jobs the user has access to under an AML File System.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByAmlFilesystemSinglePageAsync(String resourceGroupName,
        String amlFilesystemName) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(context -> service.listByAmlFilesystem(this.client.getEndpoint(), resourceGroupName,
                this.client.getApiVersion(), this.client.getSubscriptionId(), amlFilesystemName, accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
                res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Returns all import jobs the user has access to under an AML File System.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByAmlFilesystemSinglePageAsync(String resourceGroupName,
        String amlFilesystemName, Context context) {
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        if (resourceGroupName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
        }
        if (this.client.getSubscriptionId() == null) {
            return Mono.error(new IllegalArgumentException(
                "Parameter this.client.getSubscriptionId() is required and cannot be null."));
        }
        if (amlFilesystemName == null) {
            return Mono
                .error(new IllegalArgumentException("Parameter amlFilesystemName is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service
            .listByAmlFilesystem(this.client.getEndpoint(), resourceGroupName, this.client.getApiVersion(),
                this.client.getSubscriptionId(), amlFilesystemName, accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }

    /**
     * Returns all import jobs the user has access to under an AML File System.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByAmlFilesystemAsync(String resourceGroupName, String amlFilesystemName) {
        return new PagedFlux<>(() -> listByAmlFilesystemSinglePageAsync(resourceGroupName, amlFilesystemName),
            nextLink -> listByAmlFilesystemNextSinglePageAsync(nextLink));
    }

    /**
     * Returns all import jobs the user has access to under an AML File System.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs as paginated response with {@link PagedFlux}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    private PagedFlux listByAmlFilesystemAsync(String resourceGroupName, String amlFilesystemName,
        Context context) {
        return new PagedFlux<>(() -> listByAmlFilesystemSinglePageAsync(resourceGroupName, amlFilesystemName, context),
            nextLink -> listByAmlFilesystemNextSinglePageAsync(nextLink, context));
    }

    /**
     * Returns all import jobs the user has access to under an AML File System.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByAmlFilesystem(String resourceGroupName, String amlFilesystemName) {
        return new PagedIterable<>(listByAmlFilesystemAsync(resourceGroupName, amlFilesystemName));
    }

    /**
     * Returns all import jobs the user has access to under an AML File System.
     * 
     * @param resourceGroupName The name of the resource group. The name is case insensitive.
     * @param amlFilesystemName Name for the AML file system. Allows alphanumerics, underscores, and hyphens. Start and
     * end with alphanumeric.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs as paginated response with {@link PagedIterable}.
     */
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable listByAmlFilesystem(String resourceGroupName, String amlFilesystemName,
        Context context) {
        return new PagedIterable<>(listByAmlFilesystemAsync(resourceGroupName, amlFilesystemName, context));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByAmlFilesystemNextSinglePageAsync(String nextLink) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        return FluxUtil
            .withContext(
                context -> service.listByAmlFilesystemNext(nextLink, this.client.getEndpoint(), accept, context))
            .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(),
                res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null))
            .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
    }

    /**
     * Get the next page of items.
     * 
     * @param nextLink The URL to get the next list of items.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return result of the request to list import jobs along with {@link PagedResponse} on successful completion of
     * {@link Mono}.
     */
    @ServiceMethod(returns = ReturnType.SINGLE)
    private Mono> listByAmlFilesystemNextSinglePageAsync(String nextLink,
        Context context) {
        if (nextLink == null) {
            return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
        }
        if (this.client.getEndpoint() == null) {
            return Mono.error(
                new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));
        }
        final String accept = "application/json";
        context = this.client.mergeContext(context);
        return service.listByAmlFilesystemNext(nextLink, this.client.getEndpoint(), accept, context)
            .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
                res.getValue().value(), res.getValue().nextLink(), null));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy