- 2.54.0 (latest)
- 2.53.0
- 2.52.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.41.0
- 2.40.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.29.0
- 2.28.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.6
- 2.2.9
public class JobServiceClient implements BackgroundResource
Service Description: A service handles job management, including job CRUD, enumeration and search.
This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent, job);
}
Note: close() needs to be called on the JobServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of JobServiceSettings to create(). For example:
To customize credentials:
JobServiceSettings jobServiceSettings =
JobServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings);
To customize the endpoint:
JobServiceSettings jobServiceSettings =
JobServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
JobServiceClient jobServiceClient = JobServiceClient.create(jobServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Implements
BackgroundResourceStatic Methods
create()
public static final JobServiceClient create()
Constructs an instance of JobServiceClient with default settings.
Type | Description |
JobServiceClient |
Type | Description |
IOException |
create(JobServiceSettings settings)
public static final JobServiceClient create(JobServiceSettings settings)
Constructs an instance of JobServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
Name | Description |
settings | JobServiceSettings |
Type | Description |
JobServiceClient |
Type | Description |
IOException |
create(JobServiceStub stub)
public static final JobServiceClient create(JobServiceStub stub)
Constructs an instance of JobServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(JobServiceSettings).
Name | Description |
stub | JobServiceStub |
Type | Description |
JobServiceClient |
Constructors
JobServiceClient(JobServiceSettings settings)
protected JobServiceClient(JobServiceSettings settings)
Constructs an instance of JobServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
Name | Description |
settings | JobServiceSettings |
JobServiceClient(JobServiceStub stub)
protected JobServiceClient(JobServiceStub stub)
Name | Description |
stub | JobServiceStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Name | Description |
duration | long |
unit | TimeUnit |
Type | Description |
boolean |
Type | Description |
InterruptedException |
batchCreateJobsAsync(BatchCreateJobsRequest request)
public final OperationFuture<BatchCreateJobsResponse,BatchOperationMetadata> batchCreateJobsAsync(BatchCreateJobsRequest request)
Begins executing a batch create jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchCreateJobsRequest request =
BatchCreateJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllJobs(new ArrayList<Job>())
.build();
BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(request).get();
}
Name | Description |
request | BatchCreateJobsRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<BatchCreateJobsResponse,BatchOperationMetadata> |
batchCreateJobsAsync(TenantName parent, List<Job> jobs)
public final OperationFuture<BatchCreateJobsResponse,BatchOperationMetadata> batchCreateJobsAsync(TenantName parent, List<Job> jobs)
Begins executing a batch create jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get();
}
Name | Description |
parent | TenantName Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
jobs | List<Job> Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. |
Type | Description |
OperationFuture<BatchCreateJobsResponse,BatchOperationMetadata> |
batchCreateJobsAsync(String parent, List<Job> jobs)
public final OperationFuture<BatchCreateJobsResponse,BatchOperationMetadata> batchCreateJobsAsync(String parent, List<Job> jobs)
Begins executing a batch create jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
List<Job> jobs = new ArrayList<>();
BatchCreateJobsResponse response = jobServiceClient.batchCreateJobsAsync(parent, jobs).get();
}
Name | Description |
parent | String Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
jobs | List<Job> Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. |
Type | Description |
OperationFuture<BatchCreateJobsResponse,BatchOperationMetadata> |
batchCreateJobsCallable()
public final UnaryCallable<BatchCreateJobsRequest,Operation> batchCreateJobsCallable()
Begins executing a batch create jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchCreateJobsRequest request =
BatchCreateJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllJobs(new ArrayList<Job>())
.build();
ApiFuture<Operation> future = jobServiceClient.batchCreateJobsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<BatchCreateJobsRequest,Operation> |
batchCreateJobsOperationCallable()
public final OperationCallable<BatchCreateJobsRequest,BatchCreateJobsResponse,BatchOperationMetadata> batchCreateJobsOperationCallable()
Begins executing a batch create jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchCreateJobsRequest request =
BatchCreateJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllJobs(new ArrayList<Job>())
.build();
OperationFuture
Type | Description |
OperationCallable<BatchCreateJobsRequest,BatchCreateJobsResponse,BatchOperationMetadata> |
batchDeleteJobsAsync(BatchDeleteJobsRequest request)
public final OperationFuture<BatchDeleteJobsResponse,BatchOperationMetadata> batchDeleteJobsAsync(BatchDeleteJobsRequest request)
Begins executing a batch delete jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchDeleteJobsRequest request =
BatchDeleteJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllNames(new ArrayList<String>())
.build();
BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(request).get();
}
Name | Description |
request | BatchDeleteJobsRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<BatchDeleteJobsResponse,BatchOperationMetadata> |
batchDeleteJobsAsync(TenantName parent, List<String> names)
public final OperationFuture<BatchDeleteJobsResponse,BatchOperationMetadata> batchDeleteJobsAsync(TenantName parent, List<String> names)
Begins executing a batch delete jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
List<String> names = new ArrayList<>();
BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(parent, names).get();
}
Name | Description |
parent | TenantName Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". The parent of all of the jobs specified in |
names | List<String> The names of the jobs to delete. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. |
Type | Description |
OperationFuture<BatchDeleteJobsResponse,BatchOperationMetadata> |
batchDeleteJobsAsync(String parent, List<String> names)
public final OperationFuture<BatchDeleteJobsResponse,BatchOperationMetadata> batchDeleteJobsAsync(String parent, List<String> names)
Begins executing a batch delete jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
List<String> names = new ArrayList<>();
BatchDeleteJobsResponse response = jobServiceClient.batchDeleteJobsAsync(parent, names).get();
}
Name | Description |
parent | String Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". The parent of all of the jobs specified in |
names | List<String> The names of the jobs to delete. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. |
Type | Description |
OperationFuture<BatchDeleteJobsResponse,BatchOperationMetadata> |
batchDeleteJobsCallable()
public final UnaryCallable<BatchDeleteJobsRequest,Operation> batchDeleteJobsCallable()
Begins executing a batch delete jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchDeleteJobsRequest request =
BatchDeleteJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllNames(new ArrayList<String>())
.build();
ApiFuture<Operation> future = jobServiceClient.batchDeleteJobsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<BatchDeleteJobsRequest,Operation> |
batchDeleteJobsOperationCallable()
public final OperationCallable<BatchDeleteJobsRequest,BatchDeleteJobsResponse,BatchOperationMetadata> batchDeleteJobsOperationCallable()
Begins executing a batch delete jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchDeleteJobsRequest request =
BatchDeleteJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllNames(new ArrayList<String>())
.build();
OperationFuture
Type | Description |
OperationCallable<BatchDeleteJobsRequest,BatchDeleteJobsResponse,BatchOperationMetadata> |
batchUpdateJobsAsync(BatchUpdateJobsRequest request)
public final OperationFuture<BatchUpdateJobsResponse,BatchOperationMetadata> batchUpdateJobsAsync(BatchUpdateJobsRequest request)
Begins executing a batch update jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchUpdateJobsRequest request =
BatchUpdateJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllJobs(new ArrayList<Job>())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(request).get();
}
Name | Description |
request | BatchUpdateJobsRequest The request object containing all of the parameters for the API call. |
Type | Description |
OperationFuture<BatchUpdateJobsResponse,BatchOperationMetadata> |
batchUpdateJobsAsync(TenantName parent, List<Job> jobs)
public final OperationFuture<BatchUpdateJobsResponse,BatchOperationMetadata> batchUpdateJobsAsync(TenantName parent, List<Job> jobs)
Begins executing a batch update jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get();
}
Name | Description |
parent | TenantName Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
jobs | List<Job> Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. |
Type | Description |
OperationFuture<BatchUpdateJobsResponse,BatchOperationMetadata> |
batchUpdateJobsAsync(String parent, List<Job> jobs)
public final OperationFuture<BatchUpdateJobsResponse,BatchOperationMetadata> batchUpdateJobsAsync(String parent, List<Job> jobs)
Begins executing a batch update jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
List<Job> jobs = new ArrayList<>();
BatchUpdateJobsResponse response = jobServiceClient.batchUpdateJobsAsync(parent, jobs).get();
}
Name | Description |
parent | String Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
jobs | List<Job> Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. |
Type | Description |
OperationFuture<BatchUpdateJobsResponse,BatchOperationMetadata> |
batchUpdateJobsCallable()
public final UnaryCallable<BatchUpdateJobsRequest,Operation> batchUpdateJobsCallable()
Begins executing a batch update jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchUpdateJobsRequest request =
BatchUpdateJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllJobs(new ArrayList<Job>())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Operation> future = jobServiceClient.batchUpdateJobsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
Type | Description |
UnaryCallable<BatchUpdateJobsRequest,Operation> |
batchUpdateJobsOperationCallable()
public final OperationCallable<BatchUpdateJobsRequest,BatchUpdateJobsResponse,BatchOperationMetadata> batchUpdateJobsOperationCallable()
Begins executing a batch update jobs operation.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
BatchUpdateJobsRequest request =
BatchUpdateJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.addAllJobs(new ArrayList<Job>())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
OperationFuture
Type | Description |
OperationCallable<BatchUpdateJobsRequest,BatchUpdateJobsResponse,BatchOperationMetadata> |
close()
public final void close()
createJob(CreateJobRequest request)
public final Job createJob(CreateJobRequest request)
Creates a new job.
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
CreateJobRequest request =
CreateJobRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setJob(Job.newBuilder().build())
.build();
Job response = jobServiceClient.createJob(request);
}
Name | Description |
request | CreateJobRequest The request object containing all of the parameters for the API call. |
Type | Description |
Job |
createJob(TenantName parent, Job job)
public final Job createJob(TenantName parent, Job job)
Creates a new job.
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent, job);
}
Name | Description |
parent | TenantName Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
job | Job Required. The Job to be created. |
Type | Description |
Job |
createJob(String parent, Job job)
public final Job createJob(String parent, Job job)
Creates a new job.
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent, job);
}
Name | Description |
parent | String Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
job | Job Required. The Job to be created. |
Type | Description |
Job |
createJobCallable()
public final UnaryCallable<CreateJobRequest,Job> createJobCallable()
Creates a new job.
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
CreateJobRequest request =
CreateJobRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setJob(Job.newBuilder().build())
.build();
ApiFuture<Job> future = jobServiceClient.createJobCallable().futureCall(request);
// Do something.
Job response = future.get();
}
Type | Description |
UnaryCallable<CreateJobRequest,Job> |
deleteJob(DeleteJobRequest request)
public final void deleteJob(DeleteJobRequest request)
Deletes the specified job.
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
DeleteJobRequest request =
DeleteJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString())
.build();
jobServiceClient.deleteJob(request);
}
Name | Description |
request | DeleteJobRequest The request object containing all of the parameters for the API call. |
deleteJob(JobName name)
public final void deleteJob(JobName name)
Deletes the specified job.
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]");
jobServiceClient.deleteJob(name);
}
Name | Description |
name | JobName Required. The resource name of the job to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". |
deleteJob(String name)
public final void deleteJob(String name)
Deletes the specified job.
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString();
jobServiceClient.deleteJob(name);
}
Name | Description |
name | String Required. The resource name of the job to be deleted. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". |
deleteJobCallable()
public final UnaryCallable<DeleteJobRequest,Empty> deleteJobCallable()
Deletes the specified job.
Typically, the job becomes unsearchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
DeleteJobRequest request =
DeleteJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString())
.build();
ApiFuture<Empty> future = jobServiceClient.deleteJobCallable().futureCall(request);
// Do something.
future.get();
}
Type | Description |
UnaryCallable<DeleteJobRequest,Empty> |
getJob(GetJobRequest request)
public final Job getJob(GetJobRequest request)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
GetJobRequest request =
GetJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString())
.build();
Job response = jobServiceClient.getJob(request);
}
Name | Description |
request | GetJobRequest The request object containing all of the parameters for the API call. |
Type | Description |
Job |
getJob(JobName name)
public final Job getJob(JobName name)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]");
Job response = jobServiceClient.getJob(name);
}
Name | Description |
name | JobName Required. The resource name of the job to retrieve. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". |
Type | Description |
Job |
getJob(String name)
public final Job getJob(String name)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String name = JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString();
Job response = jobServiceClient.getJob(name);
}
Name | Description |
name | String Required. The resource name of the job to retrieve. The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". |
Type | Description |
Job |
getJobCallable()
public final UnaryCallable<GetJobRequest,Job> getJobCallable()
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
GetJobRequest request =
GetJobRequest.newBuilder()
.setName(JobName.of("[PROJECT]", "[TENANT]", "[JOB]").toString())
.build();
ApiFuture<Job> future = jobServiceClient.getJobCallable().futureCall(request);
// Do something.
Job response = future.get();
}
Type | Description |
UnaryCallable<GetJobRequest,Job> |
getOperationsClient()
public final OperationsClient getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
Type | Description |
OperationsClient |
getSettings()
public final JobServiceSettings getSettings()
Type | Description |
JobServiceSettings |
getStub()
public JobServiceStub getStub()
Type | Description |
JobServiceStub |
isShutdown()
public boolean isShutdown()
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Type | Description |
boolean |
listJobs(ListJobsRequest request)
public final JobServiceClient.ListJobsPagedResponse listJobs(ListJobsRequest request)
Lists jobs by filter.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
ListJobsRequest request =
ListJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setJobView(JobView.forNumber(0))
.build();
for (Job element : jobServiceClient.listJobs(request).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
request | ListJobsRequest The request object containing all of the parameters for the API call. |
Type | Description |
JobServiceClient.ListJobsPagedResponse |
listJobs(TenantName parent, String filter)
public final JobServiceClient.ListJobsPagedResponse listJobs(TenantName parent, String filter)
Lists jobs by filter.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "filter-1274492040";
for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | TenantName Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
filter | String Required. The filter string specifies the jobs to be enumerated. Supported operator: =, AND The fields eligible for filtering are:
At least one of Sample Query:
|
Type | Description |
JobServiceClient.ListJobsPagedResponse |
listJobs(String parent, String filter)
public final JobServiceClient.ListJobsPagedResponse listJobs(String parent, String filter)
Lists jobs by filter.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
String filter = "filter-1274492040";
for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
Name | Description |
parent | String Required. The resource name of the tenant under which the job is created. The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". |
filter | String Required. The filter string specifies the jobs to be enumerated. Supported operator: =, AND The fields eligible for filtering are:
At least one of Sample Query:
|
Type | Description |
JobServiceClient.ListJobsPagedResponse |
listJobsCallable()
public final UnaryCallable<ListJobsRequest,ListJobsResponse> listJobsCallable()
Lists jobs by filter.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
ListJobsRequest request =
ListJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setJobView(JobView.forNumber(0))
.build();
while (true) {
ListJobsResponse response = jobServiceClient.listJobsCallable().call(request);
for (Job element : response.getResponsesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
Type | Description |
UnaryCallable<ListJobsRequest,ListJobsResponse> |
listJobsPagedCallable()
public final UnaryCallable<ListJobsRequest,JobServiceClient.ListJobsPagedResponse> listJobsPagedCallable()
Lists jobs by filter.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
ListJobsRequest request =
ListJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setFilter("filter-1274492040")
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.setJobView(JobView.forNumber(0))
.build();
ApiFuture<Job> future = jobServiceClient.listJobsPagedCallable().futureCall(request);
// Do something.
for (Job element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
Type | Description |
UnaryCallable<ListJobsRequest,ListJobsPagedResponse> |
searchJobs(SearchJobsRequest request)
public final SearchJobsResponse searchJobs(SearchJobsRequest request)
Searches for jobs using the provided SearchJobsRequest.
This call constrains the visibility of jobs present in the database, and only returns jobs that the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
SearchJobsRequest request =
SearchJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setRequestMetadata(RequestMetadata.newBuilder().build())
.setJobQuery(JobQuery.newBuilder().build())
.setEnableBroadening(true)
.addAllHistogramQueries(new ArrayList
Name | Description |
request | SearchJobsRequest The request object containing all of the parameters for the API call. |
Type | Description |
SearchJobsResponse |
searchJobsCallable()
public final UnaryCallable<SearchJobsRequest,SearchJobsResponse> searchJobsCallable()
Searches for jobs using the provided SearchJobsRequest.
This call constrains the visibility of jobs present in the database, and only returns jobs that the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
SearchJobsRequest request =
SearchJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setRequestMetadata(RequestMetadata.newBuilder().build())
.setJobQuery(JobQuery.newBuilder().build())
.setEnableBroadening(true)
.addAllHistogramQueries(new ArrayList
Type | Description |
UnaryCallable<SearchJobsRequest,SearchJobsResponse> |
searchJobsForAlert(SearchJobsRequest request)
public final SearchJobsResponse searchJobsForAlert(SearchJobsRequest request)
Searches for jobs using the provided SearchJobsRequest.
This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), it has different algorithmic adjustments that are designed to specifically target passive job seekers.
This call constrains the visibility of jobs present in the database, and only returns jobs the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
SearchJobsRequest request =
SearchJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setRequestMetadata(RequestMetadata.newBuilder().build())
.setJobQuery(JobQuery.newBuilder().build())
.setEnableBroadening(true)
.addAllHistogramQueries(new ArrayList
Name | Description |
request | SearchJobsRequest The request object containing all of the parameters for the API call. |
Type | Description |
SearchJobsResponse |
searchJobsForAlertCallable()
public final UnaryCallable<SearchJobsRequest,SearchJobsResponse> searchJobsForAlertCallable()
Searches for jobs using the provided SearchJobsRequest.
This API call is intended for the use case of targeting passive job seekers (for example, job seekers who have signed up to receive email alerts about potential job opportunities), it has different algorithmic adjustments that are designed to specifically target passive job seekers.
This call constrains the visibility of jobs present in the database, and only returns jobs the caller has permission to search against.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
SearchJobsRequest request =
SearchJobsRequest.newBuilder()
.setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
.setRequestMetadata(RequestMetadata.newBuilder().build())
.setJobQuery(JobQuery.newBuilder().build())
.setEnableBroadening(true)
.addAllHistogramQueries(new ArrayList
Type | Description |
UnaryCallable<SearchJobsRequest,SearchJobsResponse> |
shutdown()
public void shutdown()
shutdownNow()
public void shutdownNow()
updateJob(Job job, FieldMask updateMask)
public final Job updateJob(Job job, FieldMask updateMask)
Updates specified job.
Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
Job job = Job.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Job response = jobServiceClient.updateJob(job, updateMask);
}
Name | Description |
job | Job Required. The Job to be updated. |
updateMask | FieldMask Strongly recommended for the best service experience. If update_mask is provided, only the specified fields in job are updated. Otherwise all the fields are updated. A field mask to restrict the fields that are updated. Only top level fields of Job are supported. |
Type | Description |
Job |
updateJob(UpdateJobRequest request)
public final Job updateJob(UpdateJobRequest request)
Updates specified job.
Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
UpdateJobRequest request =
UpdateJobRequest.newBuilder()
.setJob(Job.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Job response = jobServiceClient.updateJob(request);
}
Name | Description |
request | UpdateJobRequest The request object containing all of the parameters for the API call. |
Type | Description |
Job |
updateJobCallable()
public final UnaryCallable<UpdateJobRequest,Job> updateJobCallable()
Updates specified job.
Typically, updated contents become visible in search results within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
UpdateJobRequest request =
UpdateJobRequest.newBuilder()
.setJob(Job.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Job> future = jobServiceClient.updateJobCallable().futureCall(request);
// Do something.
Job response = future.get();
}
Type | Description |
UnaryCallable<UpdateJobRequest,Job> |