use of com.google.cloud.talent.v4beta1.TenantOrProjectName in project java-talent by googleapis.
the class JobSearchCreateJob method sampleCreateJob.
/**
* Create Job
*
* @param projectId Your Google Cloud Project ID
* @param tenantId Identifier of the Tenant
*/
public static void sampleCreateJob(String projectId, String tenantId, String companyName, String requisitionId, String title, String description, String jobApplicationUrl, String addressOne, String addressTwo, String languageCode) {
try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
TenantOrProjectName parent = TenantName.of(projectId, tenantId);
List<String> uris = Arrays.asList(jobApplicationUrl);
Job.ApplicationInfo applicationInfo = Job.ApplicationInfo.newBuilder().addAllUris(uris).build();
List<String> addresses = Arrays.asList(addressOne, addressTwo);
Job job = Job.newBuilder().setCompany(companyName).setRequisitionId(requisitionId).setTitle(title).setDescription(description).setApplicationInfo(applicationInfo).addAllAddresses(addresses).setLanguageCode(languageCode).build();
CreateJobRequest request = CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();
Job response = jobServiceClient.createJob(request);
System.out.printf("Created job: %s\n", response.getName());
} catch (Exception exception) {
System.err.println("Failed to create the client due to: " + exception);
}
}
Aggregations