SparkJobDefinitionsImpl.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.analytics.synapse.artifacts.implementation;
import com.azure.analytics.synapse.artifacts.models.ArtifactRenameRequest;
import com.azure.analytics.synapse.artifacts.models.CloudErrorAutoGeneratedException;
import com.azure.analytics.synapse.artifacts.models.SparkBatchJob;
import com.azure.analytics.synapse.artifacts.models.SparkJobDefinitionResource;
import com.azure.analytics.synapse.artifacts.models.SparkJobDefinitionsListResponse;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Post;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in SparkJobDefinitions. */
public final class SparkJobDefinitionsImpl {
/** The proxy service used to perform REST calls. */
private final SparkJobDefinitionsService service;
/** The service client containing this operation class. */
private final ArtifactsClientImpl client;
/**
* Initializes an instance of SparkJobDefinitionsImpl.
*
* @param client the instance of the service client containing this operation class.
*/
SparkJobDefinitionsImpl(ArtifactsClientImpl client) {
this.service =
RestProxy.create(
SparkJobDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for ArtifactsClientSparkJobDefinitions to be used by the proxy service to
* perform REST calls.
*/
@Host("{endpoint}")
@ServiceInterface(name = "ArtifactsClientSpark")
private interface SparkJobDefinitionsService {
@Get("/sparkJobDefinitions")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<SparkJobDefinitionsListResponse>> getSparkJobDefinitionsByWorkspace(
@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept,
Context context);
@Put("/sparkJobDefinitions/{sparkJobDefinitionName}")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<SparkJobDefinitionResource>> createOrUpdateSparkJobDefinition(
@HostParam("endpoint") String endpoint,
@PathParam("sparkJobDefinitionName") String sparkJobDefinitionName,
@QueryParam("api-version") String apiVersion,
@HeaderParam("If-Match") String ifMatch,
@BodyParam("application/json") SparkJobDefinitionResource sparkJobDefinition,
@HeaderParam("Accept") String accept,
Context context);
@Get("/sparkJobDefinitions/{sparkJobDefinitionName}")
@ExpectedResponses({200, 304})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<SparkJobDefinitionResource>> getSparkJobDefinition(
@HostParam("endpoint") String endpoint,
@PathParam("sparkJobDefinitionName") String sparkJobDefinitionName,
@QueryParam("api-version") String apiVersion,
@HeaderParam("If-None-Match") String ifNoneMatch,
@HeaderParam("Accept") String accept,
Context context);
@Delete("/sparkJobDefinitions/{sparkJobDefinitionName}")
@ExpectedResponses({200, 202, 204})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<Void>> deleteSparkJobDefinition(
@HostParam("endpoint") String endpoint,
@PathParam("sparkJobDefinitionName") String sparkJobDefinitionName,
@QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept,
Context context);
@Post("/sparkJobDefinitions/{sparkJobDefinitionName}/execute")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<SparkBatchJob>> executeSparkJobDefinition(
@HostParam("endpoint") String endpoint,
@PathParam("sparkJobDefinitionName") String sparkJobDefinitionName,
@QueryParam("api-version") String apiVersion,
@HeaderParam("Accept") String accept,
Context context);
@Post("/sparkJobDefinitions/{sparkJobDefinitionName}/rename")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<Void>> renameSparkJobDefinition(
@HostParam("endpoint") String endpoint,
@PathParam("sparkJobDefinitionName") String sparkJobDefinitionName,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") ArtifactRenameRequest request,
@HeaderParam("Accept") String accept,
Context context);
@Post("/debugSparkJobDefinition")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<SparkBatchJob>> debugSparkJobDefinition(
@HostParam("endpoint") String endpoint,
@QueryParam("api-version") String apiVersion,
@BodyParam("application/json") SparkJobDefinitionResource sparkJobDefinitionAzureResource,
@HeaderParam("Accept") String accept,
Context context);
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudErrorAutoGeneratedException.class)
Mono<Response<SparkJobDefinitionsListResponse>> getSparkJobDefinitionsByWorkspaceNext(
@PathParam(value = "nextLink", encoded = true) String nextLink,
@HostParam("endpoint") String endpoint,
@HeaderParam("Accept") String accept,
Context context);
}
/**
* Lists spark job definitions.
*
* @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 spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<SparkJobDefinitionResource>> getSparkJobDefinitionsByWorkspaceSinglePageAsync() {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.getSparkJobDefinitionsByWorkspace(
this.client.getEndpoint(), apiVersion, accept, context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Lists spark job definitions.
*
* @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 spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<SparkJobDefinitionResource>> getSparkJobDefinitionsByWorkspaceSinglePageAsync(
Context context) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return service.getSparkJobDefinitionsByWorkspace(this.client.getEndpoint(), apiVersion, accept, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Lists spark job definitions.
*
* @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 spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<SparkJobDefinitionResource> getSparkJobDefinitionsByWorkspaceAsync() {
return new PagedFlux<>(
() -> getSparkJobDefinitionsByWorkspaceSinglePageAsync(),
nextLink -> getSparkJobDefinitionsByWorkspaceNextSinglePageAsync(nextLink));
}
/**
* Lists spark job definitions.
*
* @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 spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<SparkJobDefinitionResource> getSparkJobDefinitionsByWorkspaceAsync(Context context) {
return new PagedFlux<>(
() -> getSparkJobDefinitionsByWorkspaceSinglePageAsync(context),
nextLink -> getSparkJobDefinitionsByWorkspaceNextSinglePageAsync(nextLink, context));
}
/**
* Lists spark job definitions.
*
* @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 spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<SparkJobDefinitionResource> getSparkJobDefinitionsByWorkspace() {
return new PagedIterable<>(getSparkJobDefinitionsByWorkspaceAsync());
}
/**
* Lists spark job definitions.
*
* @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 spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<SparkJobDefinitionResource> getSparkJobDefinitionsByWorkspace(Context context) {
return new PagedIterable<>(getSparkJobDefinitionsByWorkspaceAsync(context));
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition resource definition.
* @param ifMatch ETag of the Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SparkJobDefinitionResource>> createOrUpdateSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName, SparkJobDefinitionResource sparkJobDefinition, String ifMatch) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.createOrUpdateSparkJobDefinition(
this.client.getEndpoint(),
sparkJobDefinitionName,
apiVersion,
ifMatch,
sparkJobDefinition,
accept,
context));
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition resource definition.
* @param ifMatch ETag of the Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SparkJobDefinitionResource>> createOrUpdateSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName,
SparkJobDefinitionResource sparkJobDefinition,
String ifMatch,
Context context) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return service.createOrUpdateSparkJobDefinition(
this.client.getEndpoint(),
sparkJobDefinitionName,
apiVersion,
ifMatch,
sparkJobDefinition,
accept,
context);
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition resource definition.
* @param ifMatch ETag of the Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkJobDefinitionResource> createOrUpdateSparkJobDefinitionAsync(
String sparkJobDefinitionName, SparkJobDefinitionResource sparkJobDefinition, String ifMatch) {
return createOrUpdateSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, sparkJobDefinition, ifMatch)
.flatMap(
(Response<SparkJobDefinitionResource> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkJobDefinitionResource> createOrUpdateSparkJobDefinitionAsync(
String sparkJobDefinitionName, SparkJobDefinitionResource sparkJobDefinition) {
final String ifMatch = null;
return createOrUpdateSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, sparkJobDefinition, ifMatch)
.flatMap(
(Response<SparkJobDefinitionResource> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition resource definition.
* @param ifMatch ETag of the Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkJobDefinitionResource> createOrUpdateSparkJobDefinitionAsync(
String sparkJobDefinitionName,
SparkJobDefinitionResource sparkJobDefinition,
String ifMatch,
Context context) {
return createOrUpdateSparkJobDefinitionWithResponseAsync(
sparkJobDefinitionName, sparkJobDefinition, ifMatch, context)
.flatMap(
(Response<SparkJobDefinitionResource> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition resource definition.
* @param ifMatch ETag of the Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SparkJobDefinitionResource createOrUpdateSparkJobDefinition(
String sparkJobDefinitionName, SparkJobDefinitionResource sparkJobDefinition, String ifMatch) {
return createOrUpdateSparkJobDefinitionAsync(sparkJobDefinitionName, sparkJobDefinition, ifMatch).block();
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SparkJobDefinitionResource createOrUpdateSparkJobDefinition(
String sparkJobDefinitionName, SparkJobDefinitionResource sparkJobDefinition) {
final String ifMatch = null;
return createOrUpdateSparkJobDefinitionAsync(sparkJobDefinitionName, sparkJobDefinition, ifMatch).block();
}
/**
* Creates or updates a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param sparkJobDefinition Spark Job Definition resource definition.
* @param ifMatch ETag of the Spark Job Definition 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 spark job definition resource type.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<SparkJobDefinitionResource> createOrUpdateSparkJobDefinitionWithResponse(
String sparkJobDefinitionName,
SparkJobDefinitionResource sparkJobDefinition,
String ifMatch,
Context context) {
return createOrUpdateSparkJobDefinitionWithResponseAsync(
sparkJobDefinitionName, sparkJobDefinition, ifMatch, context)
.block();
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param ifNoneMatch ETag of the Spark Job Definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SparkJobDefinitionResource>> getSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName, String ifNoneMatch) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.getSparkJobDefinition(
this.client.getEndpoint(),
sparkJobDefinitionName,
apiVersion,
ifNoneMatch,
accept,
context));
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param ifNoneMatch ETag of the Spark Job Definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SparkJobDefinitionResource>> getSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName, String ifNoneMatch, Context context) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return service.getSparkJobDefinition(
this.client.getEndpoint(), sparkJobDefinitionName, apiVersion, ifNoneMatch, accept, context);
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param ifNoneMatch ETag of the Spark Job Definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkJobDefinitionResource> getSparkJobDefinitionAsync(
String sparkJobDefinitionName, String ifNoneMatch) {
return getSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, ifNoneMatch)
.flatMap(
(Response<SparkJobDefinitionResource> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkJobDefinitionResource> getSparkJobDefinitionAsync(String sparkJobDefinitionName) {
final String ifNoneMatch = null;
return getSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, ifNoneMatch)
.flatMap(
(Response<SparkJobDefinitionResource> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param ifNoneMatch ETag of the Spark Job Definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkJobDefinitionResource> getSparkJobDefinitionAsync(
String sparkJobDefinitionName, String ifNoneMatch, Context context) {
return getSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, ifNoneMatch, context)
.flatMap(
(Response<SparkJobDefinitionResource> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param ifNoneMatch ETag of the Spark Job Definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SparkJobDefinitionResource getSparkJobDefinition(String sparkJobDefinitionName, String ifNoneMatch) {
return getSparkJobDefinitionAsync(sparkJobDefinitionName, ifNoneMatch).block();
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SparkJobDefinitionResource getSparkJobDefinition(String sparkJobDefinitionName) {
final String ifNoneMatch = null;
return getSparkJobDefinitionAsync(sparkJobDefinitionName, ifNoneMatch).block();
}
/**
* Gets a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param ifNoneMatch ETag of the Spark Job Definition 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 Spark Job Definition.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<SparkJobDefinitionResource> getSparkJobDefinitionWithResponse(
String sparkJobDefinitionName, String ifNoneMatch, Context context) {
return getSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, ifNoneMatch, context).block();
}
/**
* Deletes a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> deleteSparkJobDefinitionWithResponseAsync(String sparkJobDefinitionName) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.deleteSparkJobDefinition(
this.client.getEndpoint(), sparkJobDefinitionName, apiVersion, accept, context));
}
/**
* Deletes a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> deleteSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName, Context context) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return service.deleteSparkJobDefinition(
this.client.getEndpoint(), sparkJobDefinitionName, apiVersion, accept, context);
}
/**
* Deletes a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteSparkJobDefinitionAsync(String sparkJobDefinitionName) {
return deleteSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteSparkJobDefinitionAsync(String sparkJobDefinitionName, Context context) {
return deleteSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition 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 deleteSparkJobDefinition(String sparkJobDefinitionName) {
deleteSparkJobDefinitionAsync(sparkJobDefinitionName).block();
}
/**
* Deletes a Spark Job Definition.
*
* @param sparkJobDefinitionName The spark job definition 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> deleteSparkJobDefinitionWithResponse(String sparkJobDefinitionName, Context context) {
return deleteSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, context).block();
}
/**
* Executes the spark job definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SparkBatchJob>> executeSparkJobDefinitionWithResponseAsync(String sparkJobDefinitionName) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.executeSparkJobDefinition(
this.client.getEndpoint(), sparkJobDefinitionName, apiVersion, accept, context));
}
/**
* Executes the spark job definition.
*
* @param sparkJobDefinitionName The spark job definition 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 Mono<Response<SparkBatchJob>> executeSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName, Context context) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return service.executeSparkJobDefinition(
this.client.getEndpoint(), sparkJobDefinitionName, apiVersion, accept, context);
}
/**
* Executes the spark job definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkBatchJob> executeSparkJobDefinitionAsync(String sparkJobDefinitionName) {
return executeSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName)
.flatMap(
(Response<SparkBatchJob> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Executes the spark job definition.
*
* @param sparkJobDefinitionName The spark job definition 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 Mono<SparkBatchJob> executeSparkJobDefinitionAsync(String sparkJobDefinitionName, Context context) {
return executeSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, context)
.flatMap(
(Response<SparkBatchJob> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Executes the spark job definition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SparkBatchJob executeSparkJobDefinition(String sparkJobDefinitionName) {
return executeSparkJobDefinitionAsync(sparkJobDefinitionName).block();
}
/**
* Executes the spark job definition.
*
* @param sparkJobDefinitionName The spark job definition 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<SparkBatchJob> executeSparkJobDefinitionWithResponse(
String sparkJobDefinitionName, Context context) {
return executeSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, context).block();
}
/**
* Renames a sparkJobDefinition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param request proposed new name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> renameSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName, ArtifactRenameRequest request) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.renameSparkJobDefinition(
this.client.getEndpoint(),
sparkJobDefinitionName,
apiVersion,
request,
accept,
context));
}
/**
* Renames a sparkJobDefinition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param request proposed new name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> renameSparkJobDefinitionWithResponseAsync(
String sparkJobDefinitionName, ArtifactRenameRequest request, Context context) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return service.renameSparkJobDefinition(
this.client.getEndpoint(), sparkJobDefinitionName, apiVersion, request, accept, context);
}
/**
* Renames a sparkJobDefinition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param request proposed new name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> renameSparkJobDefinitionAsync(String sparkJobDefinitionName, ArtifactRenameRequest request) {
return renameSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, request)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Renames a sparkJobDefinition.
*
* @param sparkJobDefinitionName The spark job definition name.
* @param request proposed new name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> renameSparkJobDefinitionAsync(
String sparkJobDefinitionName, ArtifactRenameRequest request, Context context) {
return renameSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, request, context)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Renames a sparkJobDefinition.
*
* @param sparkJobDefinitionName The spark job definition 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 renameSparkJobDefinition(String sparkJobDefinitionName, ArtifactRenameRequest request) {
renameSparkJobDefinitionAsync(sparkJobDefinitionName, request).block();
}
/**
* Renames a sparkJobDefinition.
*
* @param sparkJobDefinitionName The spark job definition 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> renameSparkJobDefinitionWithResponse(
String sparkJobDefinitionName, ArtifactRenameRequest request, Context context) {
return renameSparkJobDefinitionWithResponseAsync(sparkJobDefinitionName, request, context).block();
}
/**
* Debug the spark job definition.
*
* @param sparkJobDefinitionAzureResource Spark Job Definition 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 the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<SparkBatchJob>> debugSparkJobDefinitionWithResponseAsync(
SparkJobDefinitionResource sparkJobDefinitionAzureResource) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.debugSparkJobDefinition(
this.client.getEndpoint(),
apiVersion,
sparkJobDefinitionAzureResource,
accept,
context));
}
/**
* Debug the spark job definition.
*
* @param sparkJobDefinitionAzureResource Spark Job Definition resource definition.
* @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 Mono<Response<SparkBatchJob>> debugSparkJobDefinitionWithResponseAsync(
SparkJobDefinitionResource sparkJobDefinitionAzureResource, Context context) {
final String apiVersion = "2020-12-01";
final String accept = "application/json";
return service.debugSparkJobDefinition(
this.client.getEndpoint(), apiVersion, sparkJobDefinitionAzureResource, accept, context);
}
/**
* Debug the spark job definition.
*
* @param sparkJobDefinitionAzureResource Spark Job Definition 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 the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SparkBatchJob> debugSparkJobDefinitionAsync(
SparkJobDefinitionResource sparkJobDefinitionAzureResource) {
return debugSparkJobDefinitionWithResponseAsync(sparkJobDefinitionAzureResource)
.flatMap(
(Response<SparkBatchJob> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Debug the spark job definition.
*
* @param sparkJobDefinitionAzureResource Spark Job Definition resource definition.
* @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 Mono<SparkBatchJob> debugSparkJobDefinitionAsync(
SparkJobDefinitionResource sparkJobDefinitionAzureResource, Context context) {
return debugSparkJobDefinitionWithResponseAsync(sparkJobDefinitionAzureResource, context)
.flatMap(
(Response<SparkBatchJob> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Debug the spark job definition.
*
* @param sparkJobDefinitionAzureResource Spark Job Definition 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 the response.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SparkBatchJob debugSparkJobDefinition(SparkJobDefinitionResource sparkJobDefinitionAzureResource) {
return debugSparkJobDefinitionAsync(sparkJobDefinitionAzureResource).block();
}
/**
* Debug the spark job definition.
*
* @param sparkJobDefinitionAzureResource Spark Job Definition resource definition.
* @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<SparkBatchJob> debugSparkJobDefinitionWithResponse(
SparkJobDefinitionResource sparkJobDefinitionAzureResource, Context context) {
return debugSparkJobDefinitionWithResponseAsync(sparkJobDefinitionAzureResource, context).block();
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<SparkJobDefinitionResource>> getSparkJobDefinitionsByWorkspaceNextSinglePageAsync(
String nextLink) {
final String accept = "application/json";
return FluxUtil.withContext(
context ->
service.getSparkJobDefinitionsByWorkspaceNext(
nextLink, this.client.getEndpoint(), accept, context))
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of spark job definitions resources.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<SparkJobDefinitionResource>> getSparkJobDefinitionsByWorkspaceNextSinglePageAsync(
String nextLink, Context context) {
final String accept = "application/json";
return service.getSparkJobDefinitionsByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().getValue(),
res.getValue().getNextLink(),
null));
}
}