@Generated(value="by gapic-generator") @BetaApi public class JobServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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()) {
TenantOrProjectName 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:
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);
Modifier and Type | Class and Description |
---|---|
static class |
JobServiceClient.ListJobsFixedSizeCollection |
static class |
JobServiceClient.ListJobsPage |
static class |
JobServiceClient.ListJobsPagedResponse |
static class |
JobServiceClient.SearchJobsFixedSizeCollection |
static class |
JobServiceClient.SearchJobsForAlertFixedSizeCollection |
static class |
JobServiceClient.SearchJobsForAlertPage |
static class |
JobServiceClient.SearchJobsForAlertPagedResponse |
static class |
JobServiceClient.SearchJobsPage |
static class |
JobServiceClient.SearchJobsPagedResponse |
Modifier | Constructor and Description |
---|---|
protected |
JobServiceClient(JobServiceSettings settings)
Constructs an instance of JobServiceClient, using the given settings.
|
protected |
JobServiceClient(JobServiceStub stub) |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> |
batchCreateJobsAsync(BatchCreateJobsRequest request)
Begins executing a batch create jobs operation.
|
com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> |
batchCreateJobsAsync(String parent,
List<Job> jobs)
Begins executing a batch create jobs operation.
|
com.google.api.gax.rpc.UnaryCallable<BatchCreateJobsRequest,com.google.longrunning.Operation> |
batchCreateJobsCallable()
Begins executing a batch create jobs operation.
|
com.google.api.gax.rpc.OperationCallable<BatchCreateJobsRequest,JobOperationResult,BatchOperationMetadata> |
batchCreateJobsOperationCallable()
Begins executing a batch create jobs operation.
|
void |
batchDeleteJobs(BatchDeleteJobsRequest request)
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
void |
batchDeleteJobs(String parent,
String filter)
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
void |
batchDeleteJobs(TenantOrProjectName parent,
String filter)
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
com.google.api.gax.rpc.UnaryCallable<BatchDeleteJobsRequest,Empty> |
batchDeleteJobsCallable()
Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter.
|
com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> |
batchUpdateJobsAsync(BatchUpdateJobsRequest request)
Begins executing a batch update jobs operation.
|
com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> |
batchUpdateJobsAsync(String parent,
List<Job> jobs)
Begins executing a batch update jobs operation.
|
com.google.api.gax.rpc.UnaryCallable<BatchUpdateJobsRequest,com.google.longrunning.Operation> |
batchUpdateJobsCallable()
Begins executing a batch update jobs operation.
|
com.google.api.gax.rpc.OperationCallable<BatchUpdateJobsRequest,JobOperationResult,BatchOperationMetadata> |
batchUpdateJobsOperationCallable()
Begins executing a batch update jobs operation.
|
void |
close() |
static JobServiceClient |
create()
Constructs an instance of JobServiceClient with default settings.
|
static JobServiceClient |
create(JobServiceSettings settings)
Constructs an instance of JobServiceClient, using the given settings.
|
static JobServiceClient |
create(JobServiceStub stub)
Constructs an instance of JobServiceClient, using the given stub for making calls.
|
Job |
createJob(CreateJobRequest request)
Creates a new job.
|
Job |
createJob(String parent,
Job job)
Creates a new job.
|
Job |
createJob(TenantOrProjectName parent,
Job job)
Creates a new job.
|
com.google.api.gax.rpc.UnaryCallable<CreateJobRequest,Job> |
createJobCallable()
Creates a new job.
|
void |
deleteJob(DeleteJobRequest request)
Deletes the specified job.
|
void |
deleteJob(JobName name)
Deletes the specified job.
|
void |
deleteJob(String name)
Deletes the specified job.
|
com.google.api.gax.rpc.UnaryCallable<DeleteJobRequest,Empty> |
deleteJobCallable()
Deletes the specified job.
|
Job |
getJob(GetJobRequest request)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
Job |
getJob(JobName name)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
Job |
getJob(String name)
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
com.google.api.gax.rpc.UnaryCallable<GetJobRequest,Job> |
getJobCallable()
Retrieves the specified job, whose status is OPEN or recently EXPIRED within the last 90 days.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
JobServiceSettings |
getSettings() |
JobServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
JobServiceClient.ListJobsPagedResponse |
listJobs(ListJobsRequest request)
Lists jobs by filter.
|
JobServiceClient.ListJobsPagedResponse |
listJobs(String parent,
String filter)
Lists jobs by filter.
|
JobServiceClient.ListJobsPagedResponse |
listJobs(TenantOrProjectName parent,
String filter)
Lists jobs by filter.
|
com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,ListJobsResponse> |
listJobsCallable()
Lists jobs by filter.
|
com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,JobServiceClient.ListJobsPagedResponse> |
listJobsPagedCallable()
Lists jobs by filter.
|
JobServiceClient.SearchJobsPagedResponse |
searchJobs(SearchJobsRequest request)
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,SearchJobsResponse> |
searchJobsCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
JobServiceClient.SearchJobsForAlertPagedResponse |
searchJobsForAlert(SearchJobsRequest request)
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,SearchJobsResponse> |
searchJobsForAlertCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,JobServiceClient.SearchJobsForAlertPagedResponse> |
searchJobsForAlertPagedCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,JobServiceClient.SearchJobsPagedResponse> |
searchJobsPagedCallable()
Searches for jobs using the provided
[SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest].
|
void |
shutdown() |
void |
shutdownNow() |
Job |
updateJob(Job job)
Updates specified job.
|
Job |
updateJob(UpdateJobRequest request)
Updates specified job.
|
com.google.api.gax.rpc.UnaryCallable<UpdateJobRequest,Job> |
updateJobCallable()
Updates specified job.
|
protected JobServiceClient(JobServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") protected JobServiceClient(JobServiceStub stub)
public static final JobServiceClient create() throws IOException
IOException
public static final JobServiceClient create(JobServiceSettings settings) throws IOException
IOException
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public static final JobServiceClient create(JobServiceStub stub)
public final JobServiceSettings getSettings()
@BetaApi(value="A restructuring of stub classes is planned, so this may break in the future") public JobServiceStub getStub()
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.longrunning.OperationsClient getOperationsClient()
public final Job createJob(TenantOrProjectName parent, Job job)
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent, job);
}
parent
- 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/tenant/bar". If tenant id is unspecified a default tenant is created. For example, "projects/foo".
job
- Required. The Job to be created.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Job createJob(String parent, Job job)
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
Job response = jobServiceClient.createJob(parent.toString(), job);
}
parent
- 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/tenant/bar". If tenant id is unspecified a default tenant is created. For example, "projects/foo".
job
- Required. The Job to be created.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Job createJob(CreateJobRequest request)
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
CreateJobRequest request = CreateJobRequest.newBuilder()
.setParent(parent.toString())
.setJob(job)
.build();
Job response = jobServiceClient.createJob(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateJobRequest,Job> createJobCallable()
Typically, the job becomes searchable within 10 seconds, but it may take up to 5 minutes.
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
Job job = Job.newBuilder().build();
CreateJobRequest request = CreateJobRequest.newBuilder()
.setParent(parent.toString())
.setJob(job)
.build();
ApiFuture<Job> future = jobServiceClient.createJobCallable().futureCall(request);
// Do something
Job response = future.get();
}
public final Job getJob(JobName name)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
Job response = jobServiceClient.getJob(name);
}
name
- 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".
If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Job getJob(String name)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
Job response = jobServiceClient.getJob(name.toString());
}
name
- 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".
If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Job getJob(GetJobRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
GetJobRequest request = GetJobRequest.newBuilder()
.setName(name.toString())
.build();
Job response = jobServiceClient.getJob(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetJobRequest,Job> getJobCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
GetJobRequest request = GetJobRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Job> future = jobServiceClient.getJobCallable().futureCall(request);
// Do something
Job response = future.get();
}
public final Job updateJob(Job 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();
Job response = jobServiceClient.updateJob(job);
}
job
- Required. The Job to be updated.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final Job updateJob(UpdateJobRequest request)
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();
UpdateJobRequest request = UpdateJobRequest.newBuilder()
.setJob(job)
.build();
Job response = jobServiceClient.updateJob(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<UpdateJobRequest,Job> updateJobCallable()
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();
UpdateJobRequest request = UpdateJobRequest.newBuilder()
.setJob(job)
.build();
ApiFuture<Job> future = jobServiceClient.updateJobCallable().futureCall(request);
// Do something
Job response = future.get();
}
public final void deleteJob(JobName name)
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 = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
jobServiceClient.deleteJob(name);
}
name
- 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".
If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteJob(String name)
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 = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
jobServiceClient.deleteJob(name.toString());
}
name
- 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".
If tenant id is unspecified, the default tenant is used. For example, "projects/foo/jobs/bar".
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void deleteJob(DeleteJobRequest request)
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 = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
DeleteJobRequest request = DeleteJobRequest.newBuilder()
.setName(name.toString())
.build();
jobServiceClient.deleteJob(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteJobRequest,Empty> deleteJobCallable()
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 = JobWithTenantName.of("[PROJECT]", "[TENANT]", "[JOBS]");
DeleteJobRequest request = DeleteJobRequest.newBuilder()
.setName(name.toString())
.build();
ApiFuture<Void> future = jobServiceClient.deleteJobCallable().futureCall(request);
// Do something
future.get();
}
public final JobServiceClient.ListJobsPagedResponse listJobs(TenantOrProjectName parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
for (Job element : jobServiceClient.listJobs(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
parent
- 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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".
filter
- Required. The filter string specifies the jobs to be enumerated.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` * `status` Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified.
Sample Query:
* companyName = "projects/foo/tenants/bar/companies/baz" * companyName = "projects/foo/tenants/bar/companies/baz" AND requisitionId = "req-1" * companyName = "projects/foo/tenants/bar/companies/baz" AND status = "EXPIRED"
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final JobServiceClient.ListJobsPagedResponse listJobs(String parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
for (Job element : jobServiceClient.listJobs(parent.toString(), filter).iterateAll()) {
// doThingsWith(element);
}
}
parent
- 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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".
filter
- Required. The filter string specifies the jobs to be enumerated.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` * `status` Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified.
Sample Query:
* companyName = "projects/foo/tenants/bar/companies/baz" * companyName = "projects/foo/tenants/bar/companies/baz" AND requisitionId = "req-1" * companyName = "projects/foo/tenants/bar/companies/baz" AND status = "EXPIRED"
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final JobServiceClient.ListJobsPagedResponse listJobs(ListJobsRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
ListJobsRequest request = ListJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
for (Job element : jobServiceClient.listJobs(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,JobServiceClient.ListJobsPagedResponse> listJobsPagedCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
ListJobsRequest request = ListJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
ApiFuture<ListJobsPagedResponse> future = jobServiceClient.listJobsPagedCallable().futureCall(request);
// Do something
for (Job element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListJobsRequest,ListJobsResponse> listJobsCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
ListJobsRequest request = ListJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
while (true) {
ListJobsResponse response = jobServiceClient.listJobsCallable().call(request);
for (Job element : response.getJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void batchDeleteJobs(TenantOrProjectName parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
jobServiceClient.batchDeleteJobs(parent, filter);
}
parent
- 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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".
filter
- Required. The filter string specifies the jobs to be deleted.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` (Required)
Sample Query: companyName = "projects/foo/companies/bar" AND requisitionId = "req-1"
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void batchDeleteJobs(String parent, String filter)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
jobServiceClient.batchDeleteJobs(parent.toString(), filter);
}
parent
- 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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".
filter
- Required. The filter string specifies the jobs to be deleted.
Supported operator: =, AND
The fields eligible for filtering are:
* `companyName` (Required) * `requisitionId` (Required)
Sample Query: companyName = "projects/foo/companies/bar" AND requisitionId = "req-1"
com.google.api.gax.rpc.ApiException
- if the remote call failspublic final void batchDeleteJobs(BatchDeleteJobsRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
BatchDeleteJobsRequest request = BatchDeleteJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
jobServiceClient.batchDeleteJobs(request);
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<BatchDeleteJobsRequest,Empty> batchDeleteJobsCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
String filter = "";
BatchDeleteJobsRequest request = BatchDeleteJobsRequest.newBuilder()
.setParent(parent.toString())
.setFilter(filter)
.build();
ApiFuture<Void> future = jobServiceClient.batchDeleteJobsCallable().futureCall(request);
// Do something
future.get();
}
public final JobServiceClient.SearchJobsPagedResponse searchJobs(SearchJobsRequest request)
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.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()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
for (SearchJobsResponse.MatchingJob element : jobServiceClient.searchJobs(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,JobServiceClient.SearchJobsPagedResponse> searchJobsPagedCallable()
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.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()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
ApiFuture<SearchJobsPagedResponse> future = jobServiceClient.searchJobsPagedCallable().futureCall(request);
// Do something
for (SearchJobsResponse.MatchingJob element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,SearchJobsResponse> searchJobsCallable()
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.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()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
while (true) {
SearchJobsResponse response = jobServiceClient.searchJobsCallable().call(request);
for (SearchJobsResponse.MatchingJob element : response.getMatchingJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final JobServiceClient.SearchJobsForAlertPagedResponse searchJobsForAlert(SearchJobsRequest request)
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), and has different algorithmic adjustments that are targeted to passive job seekers.
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.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()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
for (SearchJobsResponse.MatchingJob element : jobServiceClient.searchJobsForAlert(request).iterateAll()) {
// doThingsWith(element);
}
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,JobServiceClient.SearchJobsForAlertPagedResponse> searchJobsForAlertPagedCallable()
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), and has different algorithmic adjustments that are targeted to passive job seekers.
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.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()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
ApiFuture<SearchJobsForAlertPagedResponse> future = jobServiceClient.searchJobsForAlertPagedCallable().futureCall(request);
// Do something
for (SearchJobsResponse.MatchingJob element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<SearchJobsRequest,SearchJobsResponse> searchJobsForAlertCallable()
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), and has different algorithmic adjustments that are targeted to passive job seekers.
This call constrains the [visibility][google.cloud.talent.v4beta1.Job.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()) {
TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]");
RequestMetadata requestMetadata = RequestMetadata.newBuilder().build();
SearchJobsRequest request = SearchJobsRequest.newBuilder()
.setParent(parent.toString())
.setRequestMetadata(requestMetadata)
.build();
while (true) {
SearchJobsResponse response = jobServiceClient.searchJobsForAlertCallable().call(request);
for (SearchJobsResponse.MatchingJob element : response.getMatchingJobsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> batchCreateJobsAsync(String parent, List<Job> jobs)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
JobOperationResult response = jobServiceClient.batchCreateJobsAsync(formattedParent, jobs).get();
}
parent
- 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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".
jobs
- Required. The jobs to be created.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> batchCreateJobsAsync(BatchCreateJobsRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchCreateJobsRequest request = BatchCreateJobsRequest.newBuilder()
.setParent(formattedParent)
.addAllJobs(jobs)
.build();
JobOperationResult response = jobServiceClient.batchCreateJobsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<BatchCreateJobsRequest,JobOperationResult,BatchOperationMetadata> batchCreateJobsOperationCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchCreateJobsRequest request = BatchCreateJobsRequest.newBuilder()
.setParent(formattedParent)
.addAllJobs(jobs)
.build();
OperationFuture<JobOperationResult, BatchOperationMetadata> future = jobServiceClient.batchCreateJobsOperationCallable().futureCall(request);
// Do something
JobOperationResult response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<BatchCreateJobsRequest,com.google.longrunning.Operation> batchCreateJobsCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchCreateJobsRequest request = BatchCreateJobsRequest.newBuilder()
.setParent(formattedParent)
.addAllJobs(jobs)
.build();
ApiFuture<Operation> future = jobServiceClient.batchCreateJobsCallable().futureCall(request);
// Do something
Operation response = future.get();
}
@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> batchUpdateJobsAsync(String parent, List<Job> jobs)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
JobOperationResult response = jobServiceClient.batchUpdateJobsAsync(formattedParent, jobs).get();
}
parent
- 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/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo".
jobs
- The jobs to be updated.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for long-running operations is not stable yet and may change in the future.") public final com.google.api.gax.longrunning.OperationFuture<JobOperationResult,BatchOperationMetadata> batchUpdateJobsAsync(BatchUpdateJobsRequest request)
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchUpdateJobsRequest request = BatchUpdateJobsRequest.newBuilder()
.setParent(formattedParent)
.addAllJobs(jobs)
.build();
JobOperationResult response = jobServiceClient.batchUpdateJobsAsync(request).get();
}
request
- The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException
- if the remote call fails@BetaApi(value="The surface for use by generated code is not stable yet and may change in the future.") public final com.google.api.gax.rpc.OperationCallable<BatchUpdateJobsRequest,JobOperationResult,BatchOperationMetadata> batchUpdateJobsOperationCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchUpdateJobsRequest request = BatchUpdateJobsRequest.newBuilder()
.setParent(formattedParent)
.addAllJobs(jobs)
.build();
OperationFuture<JobOperationResult, BatchOperationMetadata> future = jobServiceClient.batchUpdateJobsOperationCallable().futureCall(request);
// Do something
JobOperationResult response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<BatchUpdateJobsRequest,com.google.longrunning.Operation> batchUpdateJobsCallable()
Sample code:
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
String formattedParent = TenantName.format("[PROJECT]", "[TENANT]");
List<Job> jobs = new ArrayList<>();
BatchUpdateJobsRequest request = BatchUpdateJobsRequest.newBuilder()
.setParent(formattedParent)
.addAllJobs(jobs)
.build();
ApiFuture<Operation> future = jobServiceClient.batchUpdateJobsCallable().futureCall(request);
// Do something
Operation response = future.get();
}
public final void close()
close
in interface AutoCloseable
public void shutdown()
shutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isShutdown()
isShutdown
in interface com.google.api.gax.core.BackgroundResource
public boolean isTerminated()
isTerminated
in interface com.google.api.gax.core.BackgroundResource
public void shutdownNow()
shutdownNow
in interface com.google.api.gax.core.BackgroundResource
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
awaitTermination
in interface com.google.api.gax.core.BackgroundResource
InterruptedException
Copyright © 2019 Google LLC. All rights reserved.