Google Cloud Dataproc v1 API - Class JobControllerClient (5.8.0)

public abstract class JobControllerClient

Reference documentation and code samples for the Google Cloud Dataproc v1 API class JobControllerClient.

JobController client wrapper, for convenient use.

Inheritance

object > JobControllerClient

Derived Types

Namespace

Google.Cloud.Dataproc.V1

Assembly

Google.Cloud.Dataproc.V1.dll

Remarks

The JobController provides methods to manage jobs.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the JobController service, which is a host of "dataproc.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default JobController scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

The default JobController scopes are:

GrpcClient

public virtual JobController.JobControllerClient GrpcClient { get; }

The underlying gRPC JobController client

Property Value
TypeDescription
JobControllerJobControllerClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
TypeDescription
IAMPolicyClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

SubmitJobAsOperationOperationsClient

public virtual OperationsClient SubmitJobAsOperationOperationsClient { get; }

The long-running operations client for SubmitJobAsOperation.

Property Value
TypeDescription
OperationsClient

Methods

CancelJob(CancelJobRequest, CallSettings)

public virtual Job CancelJob(CancelJobRequest request, CallSettings callSettings = null)

Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list or regions/{region}/jobs.get.

Parameters
NameDescription
requestCancelJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Job

The RPC response.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
CancelJobRequest request = new CancelJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
Job response = jobControllerClient.CancelJob(request);

CancelJob(string, string, string, CallSettings)

public virtual Job CancelJob(string projectId, string region, string jobId, CallSettings callSettings = null)

Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list or regions/{region}/jobs.get.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Job

The RPC response.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
Job response = jobControllerClient.CancelJob(projectId, region, jobId);

CancelJobAsync(CancelJobRequest, CallSettings)

public virtual Task<Job> CancelJobAsync(CancelJobRequest request, CallSettings callSettings = null)

Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list or regions/{region}/jobs.get.

Parameters
NameDescription
requestCancelJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
CancelJobRequest request = new CancelJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
Job response = await jobControllerClient.CancelJobAsync(request);

CancelJobAsync(CancelJobRequest, CancellationToken)

public virtual Task<Job> CancelJobAsync(CancelJobRequest request, CancellationToken cancellationToken)

Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list or regions/{region}/jobs.get.

Parameters
NameDescription
requestCancelJobRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
CancelJobRequest request = new CancelJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
Job response = await jobControllerClient.CancelJobAsync(request);

CancelJobAsync(string, string, string, CallSettings)

public virtual Task<Job> CancelJobAsync(string projectId, string region, string jobId, CallSettings callSettings = null)

Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list or regions/{region}/jobs.get.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
Job response = await jobControllerClient.CancelJobAsync(projectId, region, jobId);

CancelJobAsync(string, string, string, CancellationToken)

public virtual Task<Job> CancelJobAsync(string projectId, string region, string jobId, CancellationToken cancellationToken)

Starts a job cancellation request. To access the job resource after cancellation, call regions/{region}/jobs.list or regions/{region}/jobs.get.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
Job response = await jobControllerClient.CancelJobAsync(projectId, region, jobId);

Create()

public static JobControllerClient Create()

Synchronously creates a JobControllerClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use JobControllerClientBuilder.

Returns
TypeDescription
JobControllerClient

The created JobControllerClient.

CreateAsync(CancellationToken)

public static Task<JobControllerClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a JobControllerClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use JobControllerClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskJobControllerClient

The task representing the created JobControllerClient.

DeleteJob(DeleteJobRequest, CallSettings)

public virtual void DeleteJob(DeleteJobRequest request, CallSettings callSettings = null)

Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.

Parameters
NameDescription
requestDeleteJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
DeleteJobRequest request = new DeleteJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
jobControllerClient.DeleteJob(request);

DeleteJob(string, string, string, CallSettings)

public virtual void DeleteJob(string projectId, string region, string jobId, CallSettings callSettings = null)

Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
jobControllerClient.DeleteJob(projectId, region, jobId);

DeleteJobAsync(DeleteJobRequest, CallSettings)

public virtual Task DeleteJobAsync(DeleteJobRequest request, CallSettings callSettings = null)

Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.

Parameters
NameDescription
requestDeleteJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
DeleteJobRequest request = new DeleteJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
await jobControllerClient.DeleteJobAsync(request);

DeleteJobAsync(DeleteJobRequest, CancellationToken)

public virtual Task DeleteJobAsync(DeleteJobRequest request, CancellationToken cancellationToken)

Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.

Parameters
NameDescription
requestDeleteJobRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
DeleteJobRequest request = new DeleteJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
await jobControllerClient.DeleteJobAsync(request);

DeleteJobAsync(string, string, string, CallSettings)

public virtual Task DeleteJobAsync(string projectId, string region, string jobId, CallSettings callSettings = null)

Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
await jobControllerClient.DeleteJobAsync(projectId, region, jobId);

DeleteJobAsync(string, string, string, CancellationToken)

public virtual Task DeleteJobAsync(string projectId, string region, string jobId, CancellationToken cancellationToken)

Deletes the job from the project. If the job is active, the delete fails, and the response returns FAILED_PRECONDITION.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
await jobControllerClient.DeleteJobAsync(projectId, region, jobId);

GetJob(GetJobRequest, CallSettings)

public virtual Job GetJob(GetJobRequest request, CallSettings callSettings = null)

Gets the resource representation for a job in a project.

Parameters
NameDescription
requestGetJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Job

The RPC response.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
GetJobRequest request = new GetJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
Job response = jobControllerClient.GetJob(request);

GetJob(string, string, string, CallSettings)

public virtual Job GetJob(string projectId, string region, string jobId, CallSettings callSettings = null)

Gets the resource representation for a job in a project.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Job

The RPC response.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
Job response = jobControllerClient.GetJob(projectId, region, jobId);

GetJobAsync(GetJobRequest, CallSettings)

public virtual Task<Job> GetJobAsync(GetJobRequest request, CallSettings callSettings = null)

Gets the resource representation for a job in a project.

Parameters
NameDescription
requestGetJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
GetJobRequest request = new GetJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
Job response = await jobControllerClient.GetJobAsync(request);

GetJobAsync(GetJobRequest, CancellationToken)

public virtual Task<Job> GetJobAsync(GetJobRequest request, CancellationToken cancellationToken)

Gets the resource representation for a job in a project.

Parameters
NameDescription
requestGetJobRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
GetJobRequest request = new GetJobRequest
{
    ProjectId = "",
    JobId = "",
    Region = "",
};
// Make the request
Job response = await jobControllerClient.GetJobAsync(request);

GetJobAsync(string, string, string, CallSettings)

public virtual Task<Job> GetJobAsync(string projectId, string region, string jobId, CallSettings callSettings = null)

Gets the resource representation for a job in a project.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
Job response = await jobControllerClient.GetJobAsync(projectId, region, jobId);

GetJobAsync(string, string, string, CancellationToken)

public virtual Task<Job> GetJobAsync(string projectId, string region, string jobId, CancellationToken cancellationToken)

Gets the resource representation for a job in a project.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

jobIdstring

Required. The job ID.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskJob

A Task containing the RPC response.

Example
// Create client
JobControllerClient jobControllerClient = await JobControllerClient.CreateAsync();
// Initialize request argument(s)
string projectId = "";
string region = "";
string jobId = "";
// Make the request
Job response = await jobControllerClient.GetJobAsync(projectId, region, jobId);

ListJobs(ListJobsRequest, CallSettings)

public virtual PagedEnumerable<ListJobsResponse, Job> ListJobs(ListJobsRequest request, CallSettings callSettings = null)

Lists regions/{region}/jobs in a project.

Parameters
NameDescription
requestListJobsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListJobsResponseJob

A pageable sequence of Job resources.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
ListJobsRequest request = new ListJobsRequest
{
    ProjectId = "",
    ClusterName = "",
    JobStateMatcher = ListJobsRequest.Types.JobStateMatcher.All,
    Region = "",
    Filter = "",
};
// Make the request
PagedEnumerable<ListJobsResponse, Job> response = jobControllerClient.ListJobs(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Job item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Job item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Job> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Job item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListJobs(string, string, string, int?, CallSettings)

public virtual PagedEnumerable<ListJobsResponse, Job> ListJobs(string projectId, string region, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists regions/{region}/jobs in a project.

Parameters
NameDescription
projectIdstring

Required. The ID of the Google Cloud Platform project that the job belongs to.

regionstring

Required. The Dataproc region in which to handle the request.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListJobsResponseJob

A pageable sequence of Job resources.

Example
// Create client
JobControllerClient jobControllerClient = JobControllerClient.Create();
// Initialize request argument(s)
string projectId = "";
string region = "";
// Make the request
PagedEnumerable<ListJobsResponse, Job> response = jobControllerClient.ListJobs(projectId, region);

// Iterate over all response items, lazily performing RPCs as required
foreach (Job item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Job item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Job> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Job item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListJobs(string, string, string, string, int?, CallSettings)

public virtual PagedEnumerable<ListJobsResponse, Job> ListJobs(string projectId, string region, string filte