use of com.google.cloud.talent.v4beta1.JobName in project java-docs-samples by GoogleCloudPlatform.
the class GetJobState method getJobState.
// Gets the state of a job.
public static void getJobState(String projectId, String location, String jobId) throws IOException {
// once, and can be reused for multiple requests.
try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
JobName jobName = JobName.newBuilder().setProject(projectId).setLocation(location).setJob(jobId).build();
var getJobRequest = GetJobRequest.newBuilder().setName(jobName.toString()).build();
// Send the get job request and process the response.
Job job = transcoderServiceClient.getJob(getJobRequest);
System.out.println("Job state: " + job.getState());
}
}
use of com.google.cloud.talent.v4beta1.JobName in project java-docs-samples by GoogleCloudPlatform.
the class JobSearchGetJob method getJob.
// Get Job.
public static void getJob(String projectId, String tenantId, String jobId) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobName.ofProjectTenantJobName(projectId, tenantId, jobId);
GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build();
Job response = jobServiceClient.getJob(request);
System.out.format("Job name: %s%n", response.getName());
System.out.format("Requisition ID: %s%n", response.getRequisitionId());
System.out.format("Title: %s%n", response.getTitle());
System.out.format("Description: %s%n", response.getDescription());
System.out.format("Posting language: %s%n", response.getLanguageCode());
for (String address : response.getAddressesList()) {
System.out.format("Address: %s%n", address);
}
for (String email : response.getApplicationInfo().getEmailsList()) {
System.out.format("Email: %s%n", email);
}
for (String websiteUri : response.getApplicationInfo().getUrisList()) {
System.out.format("Website: %s%n", websiteUri);
}
}
}
use of com.google.cloud.talent.v4beta1.JobName in project java-docs-samples by GoogleCloudPlatform.
the class DeleteJob method deleteJob.
// Deletes a job.
public static void deleteJob(String projectId, String location, String jobId) throws IOException {
// once, and can be reused for multiple requests.
try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
JobName jobName = JobName.newBuilder().setProject(projectId).setLocation(location).setJob(jobId).build();
var deleteJobRequest = DeleteJobRequest.newBuilder().setName(jobName.toString()).build();
// Send the delete job request and process the response.
transcoderServiceClient.deleteJob(deleteJobRequest);
System.out.println("Deleted job");
}
}
use of com.google.cloud.talent.v4beta1.JobName in project java-docs-samples by GoogleCloudPlatform.
the class GetJob method getJob.
// Gets a job.
public static void getJob(String projectId, String location, String jobId) throws IOException {
// once, and can be reused for multiple requests.
try (TranscoderServiceClient transcoderServiceClient = TranscoderServiceClient.create()) {
JobName jobName = JobName.newBuilder().setProject(projectId).setLocation(location).setJob(jobId).build();
var getJobRequest = GetJobRequest.newBuilder().setName(jobName.toString()).build();
// Send the get job request and process the response.
Job job = transcoderServiceClient.getJob(getJobRequest);
System.out.println("Job: " + job.getName());
}
}
use of com.google.cloud.talent.v4beta1.JobName in project java-docs-samples by GoogleCloudPlatform.
the class JobSearchDeleteJob method deleteJob.
// Delete Job.
public static void deleteJob(String projectId, String tenantId, String jobId) throws IOException {
// the "close" method on the client to safely clean up any remaining background resources.
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
JobName name = JobName.ofProjectTenantJobName(projectId, tenantId, jobId);
DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build();
jobServiceClient.deleteJob(request);
System.out.println("Deleted job.");
}
}
Aggregations