DatasetClient.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.analytics.synapse.artifacts;
import com.azure.analytics.synapse.artifacts.implementation.DatasetsImpl;
import com.azure.analytics.synapse.artifacts.models.ArtifactRenameRequest;
import com.azure.analytics.synapse.artifacts.models.CloudErrorAutoGeneratedException;
import com.azure.analytics.synapse.artifacts.models.DatasetResource;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
/** Initializes a new instance of the synchronous ArtifactsClient type. */
@ServiceClient(builder = ArtifactsClientBuilder.class)
public final class DatasetClient {
private final DatasetsImpl serviceClient;
/**
* Initializes an instance of Datasets client.
*
* @param serviceClient the service client implementation.
*/
DatasetClient(DatasetsImpl serviceClient) {
this.serviceClient = serviceClient;
}
/**
* Lists datasets.
*
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of dataset resources.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<DatasetResource> getDatasetsByWorkspace() {
return this.serviceClient.getDatasetsByWorkspace();
}
/**
* Lists datasets.
*
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of dataset resources.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<DatasetResource> getDatasetsByWorkspace(Context context) {
return this.serviceClient.getDatasetsByWorkspace(context);
}
/**
* Creates or updates a dataset.
*
* @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 CloudErrorAutoGeneratedException 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 DatasetResource createOrUpdateDataset(String datasetName, DatasetResource dataset, String ifMatch) {
return this.serviceClient.createOrUpdateDataset(datasetName, dataset, ifMatch);
}
/**
* Creates or updates a dataset.
*
* @param datasetName The dataset name.
* @param dataset Dataset resource definition.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return dataset resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatasetResource createOrUpdateDataset(String datasetName, DatasetResource dataset) {
return this.serviceClient.createOrUpdateDataset(datasetName, dataset);
}
/**
* Creates or updates a dataset.
*
* @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 CloudErrorAutoGeneratedException 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 Response<DatasetResource> createOrUpdateDatasetWithResponse(
String datasetName, DatasetResource dataset, String ifMatch, Context context) {
return this.serviceClient.createOrUpdateDatasetWithResponse(datasetName, dataset, ifMatch, context);
}
/**
* Gets a dataset.
*
* @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 CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a dataset.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatasetResource getDataset(String datasetName, String ifNoneMatch) {
return this.serviceClient.getDataset(datasetName, ifNoneMatch);
}
/**
* Gets a dataset.
*
* @param datasetName The dataset name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a dataset.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public DatasetResource getDataset(String datasetName) {
return this.serviceClient.getDataset(datasetName);
}
/**
* Gets a dataset.
*
* @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 CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a dataset.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<DatasetResource> getDatasetWithResponse(String datasetName, String ifNoneMatch, Context context) {
return this.serviceClient.getDatasetWithResponse(datasetName, ifNoneMatch, context);
}
/**
* Deletes a dataset.
*
* @param datasetName The dataset name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void deleteDataset(String datasetName) {
this.serviceClient.deleteDataset(datasetName);
}
/**
* Deletes a dataset.
*
* @param datasetName The dataset name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> deleteDatasetWithResponse(String datasetName, Context context) {
return this.serviceClient.deleteDatasetWithResponse(datasetName, context);
}
/**
* Renames a dataset.
*
* @param datasetName The dataset name.
* @param request proposed new name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void renameDataset(String datasetName, ArtifactRenameRequest request) {
this.serviceClient.renameDataset(datasetName, request);
}
/**
* Renames a dataset.
*
* @param datasetName The dataset name.
* @param request proposed new name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<Void> renameDatasetWithResponse(
String datasetName, ArtifactRenameRequest request, Context context) {
return this.serviceClient.renameDatasetWithResponse(datasetName, request, context);
}
}