
com.azure.resourcemanager.datafactory.implementation.DatasetsClientImpl Maven / Gradle / Ivy
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.datafactory.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.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.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.resourcemanager.datafactory.fluent.DatasetsClient;
import com.azure.resourcemanager.datafactory.fluent.models.DatasetResourceInner;
import com.azure.resourcemanager.datafactory.models.DatasetListResponse;
import reactor.core.publisher.Mono;
/**
* An instance of this class provides access to all the operations defined in DatasetsClient.
*/
public final class DatasetsClientImpl implements DatasetsClient {
/**
* The proxy service used to perform REST calls.
*/
private final DatasetsService service;
/**
* The service client containing this operation class.
*/
private final DataFactoryManagementClientImpl client;
/**
* Initializes an instance of DatasetsClientImpl.
*
* @param client the instance of the service client containing this operation class.
*/
DatasetsClientImpl(DataFactoryManagementClientImpl client) {
this.service = RestProxy.create(DatasetsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for DataFactoryManagementClientDatasets to be used by the proxy service
* to perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "DataFactoryManagemen")
public interface DatasetsService {
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByFactory(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("factoryName") String factoryName,
@QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> createOrUpdate(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("factoryName") String factoryName,
@PathParam("datasetName") String datasetName, @QueryParam("api-version") String apiVersion,
@HeaderParam("If-Match") String ifMatch, @BodyParam("application/json") DatasetResourceInner dataset,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}")
@ExpectedResponses({ 200, 304 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("factoryName") String factoryName,
@PathParam("datasetName") String datasetName, @QueryParam("api-version") String apiVersion,
@HeaderParam("If-None-Match") String ifNoneMatch, @HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/datasets/{datasetName}")
@ExpectedResponses({ 200, 204 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> delete(@HostParam("$host") String endpoint,
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName, @PathParam("factoryName") String factoryName,
@PathParam("datasetName") String datasetName, @QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept, Context context);
@Headers({ "Content-Type: application/json" })
@Get("{nextLink}")
@ExpectedResponses({ 200 })
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByFactoryNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint,
@HeaderParam("Accept") String accept, Context context);
}
/**
* Lists datasets.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @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 list of dataset resources along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByFactorySinglePageAsync(String resourceGroupName,
String factoryName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listByFactory(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, factoryName, this.client.getApiVersion(), 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()));
}
/**
* Lists datasets.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @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 list of dataset resources along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByFactorySinglePageAsync(String resourceGroupName,
String factoryName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByFactory(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, factoryName,
this.client.getApiVersion(), accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().value(), res.getValue().nextLink(), null));
}
/**
* Lists datasets.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @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 list of dataset resources as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByFactoryAsync(String resourceGroupName, String factoryName) {
return new PagedFlux<>(() -> listByFactorySinglePageAsync(resourceGroupName, factoryName),
nextLink -> listByFactoryNextSinglePageAsync(nextLink));
}
/**
* Lists datasets.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @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 list of dataset resources as paginated response with {@link PagedFlux}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux listByFactoryAsync(String resourceGroupName, String factoryName,
Context context) {
return new PagedFlux<>(() -> listByFactorySinglePageAsync(resourceGroupName, factoryName, context),
nextLink -> listByFactoryNextSinglePageAsync(nextLink, context));
}
/**
* Lists datasets.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @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 list of dataset resources as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByFactory(String resourceGroupName, String factoryName) {
return new PagedIterable<>(listByFactoryAsync(resourceGroupName, factoryName));
}
/**
* Lists datasets.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @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 list of dataset resources as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listByFactory(String resourceGroupName, String factoryName,
Context context) {
return new PagedIterable<>(listByFactoryAsync(resourceGroupName, factoryName, context));
}
/**
* Creates or updates a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param dataset Dataset resource definition.
* @param ifMatch ETag of the dataset 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 ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dataset resource type along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String resourceGroupName,
String factoryName, String datasetName, DatasetResourceInner dataset, String ifMatch) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
if (datasetName == null) {
return Mono.error(new IllegalArgumentException("Parameter datasetName is required and cannot be null."));
}
if (dataset == null) {
return Mono.error(new IllegalArgumentException("Parameter dataset is required and cannot be null."));
} else {
dataset.validate();
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, factoryName, datasetName, this.client.getApiVersion(), ifMatch, dataset, accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Creates or updates a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param dataset Dataset resource definition.
* @param ifMatch ETag of the dataset 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 ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dataset resource type along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> createOrUpdateWithResponseAsync(String resourceGroupName,
String factoryName, String datasetName, DatasetResourceInner dataset, String ifMatch, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
if (datasetName == null) {
return Mono.error(new IllegalArgumentException("Parameter datasetName is required and cannot be null."));
}
if (dataset == null) {
return Mono.error(new IllegalArgumentException("Parameter dataset is required and cannot be null."));
} else {
dataset.validate();
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.createOrUpdate(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
factoryName, datasetName, this.client.getApiVersion(), ifMatch, dataset, accept, context);
}
/**
* Creates or updates a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param dataset Dataset resource definition.
* @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 dataset resource type on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono createOrUpdateAsync(String resourceGroupName, String factoryName,
String datasetName, DatasetResourceInner dataset) {
final String ifMatch = null;
return createOrUpdateWithResponseAsync(resourceGroupName, factoryName, datasetName, dataset, ifMatch)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Creates or updates a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param dataset Dataset resource definition.
* @param ifMatch ETag of the dataset 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 ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dataset resource type along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response createOrUpdateWithResponse(String resourceGroupName, String factoryName,
String datasetName, DatasetResourceInner dataset, String ifMatch, Context context) {
return createOrUpdateWithResponseAsync(resourceGroupName, factoryName, datasetName, dataset, ifMatch, context)
.block();
}
/**
* Creates or updates a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param dataset Dataset resource definition.
* @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 dataset resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatasetResourceInner createOrUpdate(String resourceGroupName, String factoryName, String datasetName,
DatasetResourceInner dataset) {
final String ifMatch = null;
return createOrUpdateWithResponse(resourceGroupName, factoryName, datasetName, dataset, ifMatch, Context.NONE)
.getValue();
}
/**
* Gets a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param ifNoneMatch ETag of the dataset 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 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 dataset along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String factoryName,
String datasetName, String ifNoneMatch) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
if (datasetName == null) {
return Mono.error(new IllegalArgumentException("Parameter datasetName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, factoryName, datasetName, this.client.getApiVersion(), ifNoneMatch, accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Gets a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param ifNoneMatch ETag of the dataset 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 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 dataset along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> getWithResponseAsync(String resourceGroupName, String factoryName,
String datasetName, String ifNoneMatch, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
if (datasetName == null) {
return Mono.error(new IllegalArgumentException("Parameter datasetName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, factoryName,
datasetName, this.client.getApiVersion(), ifNoneMatch, accept, context);
}
/**
* Gets a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @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 dataset on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono getAsync(String resourceGroupName, String factoryName, String datasetName) {
final String ifNoneMatch = null;
return getWithResponseAsync(resourceGroupName, factoryName, datasetName, ifNoneMatch)
.flatMap(res -> Mono.justOrEmpty(res.getValue()));
}
/**
* Gets a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @param ifNoneMatch ETag of the dataset 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 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 dataset along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response getWithResponse(String resourceGroupName, String factoryName,
String datasetName, String ifNoneMatch, Context context) {
return getWithResponseAsync(resourceGroupName, factoryName, datasetName, ifNoneMatch, context).block();
}
/**
* Gets a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @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 dataset.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatasetResourceInner get(String resourceGroupName, String factoryName, String datasetName) {
final String ifNoneMatch = null;
return getWithResponse(resourceGroupName, factoryName, datasetName, ifNoneMatch, Context.NONE).getValue();
}
/**
* Deletes a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @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 factoryName,
String datasetName) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
if (datasetName == null) {
return Mono.error(new IllegalArgumentException("Parameter datasetName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(),
resourceGroupName, factoryName, datasetName, this.client.getApiVersion(), accept, context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}
/**
* Deletes a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @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 factoryName,
String datasetName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono.error(
new IllegalArgumentException("Parameter this.client.getEndpoint() 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 (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
if (datasetName == null) {
return Mono.error(new IllegalArgumentException("Parameter datasetName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName,
factoryName, datasetName, this.client.getApiVersion(), accept, context);
}
/**
* Deletes a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @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 factoryName, String datasetName) {
return deleteWithResponseAsync(resourceGroupName, factoryName, datasetName).flatMap(ignored -> Mono.empty());
}
/**
* Deletes a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @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}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response deleteWithResponse(String resourceGroupName, String factoryName, String datasetName,
Context context) {
return deleteWithResponseAsync(resourceGroupName, factoryName, datasetName, context).block();
}
/**
* Deletes a dataset.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param datasetName The dataset name.
* @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 factoryName, String datasetName) {
deleteWithResponse(resourceGroupName, factoryName, datasetName, Context.NONE);
}
/**
* 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 a list of dataset resources along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByFactoryNextSinglePageAsync(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.listByFactoryNext(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 a list of dataset resources along with {@link PagedResponse} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono> listByFactoryNextSinglePageAsync(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.listByFactoryNext(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