Search in sources :

Example 46 with JobServiceClient

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient in project java-talent by googleapis.

the class JobSearchBatchDeleteJob method sampleBatchDeleteJobs.

/**
 * Batch delete jobs using a filter
 *
 * @param projectId Your Google Cloud Project ID
 * @param tenantId Identifier of the Tenantd
 * @param filter The filter string specifies the jobs to be deleted. For example: companyName =
 *     "projects/api-test-project/companies/123" AND equisitionId = "req-1"
 */
public static void sampleBatchDeleteJobs(String projectId, String tenantId, String filter) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantOrProjectName parent = TenantName.of(projectId, tenantId);
        BatchDeleteJobsRequest request = BatchDeleteJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build();
        jobServiceClient.batchDeleteJobs(request);
        System.out.println("Batch deleted jobs from filter");
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : BatchDeleteJobsRequest(com.google.cloud.talent.v4beta1.BatchDeleteJobsRequest) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName)

Example 47 with JobServiceClient

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient 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);
    }
}
Also used : JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient) TenantOrProjectName(com.google.cloud.talent.v4beta1.TenantOrProjectName) Job(com.google.cloud.talent.v4beta1.Job) CreateJobRequest(com.google.cloud.talent.v4beta1.CreateJobRequest)

Example 48 with JobServiceClient

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient in project java-talent by googleapis.

the class JobSearchCreateJob method createJob.

// Create a job.
public static void createJob(String projectId, String tenantId, String companyId, String requisitionId, String jobApplicationUrl) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        Job.ApplicationInfo applicationInfo = Job.ApplicationInfo.newBuilder().addUris(jobApplicationUrl).build();
        List<String> addresses = Arrays.asList("1600 Amphitheatre Parkway, Mountain View, CA 94043", "111 8th Avenue, New York, NY 10011");
        // By default, job will expire in 30 days.
        // https://cloud.google.com/talent-solution/job-search/docs/jobs
        Job job = Job.newBuilder().setCompany(companyId).setRequisitionId(requisitionId).setTitle("Software Developer").setDescription("Develop, maintain the software solutions.").setApplicationInfo(applicationInfo).addAllAddresses(addresses).setLanguageCode("en-US").build();
        CreateJobRequest request = CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();
        Job response = jobServiceClient.createJob(request);
        System.out.format("Created job: %s%n", response.getName());
    }
}
Also used : TenantName(com.google.cloud.talent.v4.TenantName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job) CreateJobRequest(com.google.cloud.talent.v4.CreateJobRequest)

Example 49 with JobServiceClient

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient in project java-talent by googleapis.

the class JobSearchCreateJobCustomAttributes method createJob.

// Create Job with Custom Attributes.
public static void createJob(String projectId, String tenantId, String companyId, String requisitionId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        TenantName parent = TenantName.of(projectId, tenantId);
        // Custom attribute can be string or numeric value, and can be filtered in search queries.
        // https://cloud.google.com/talent-solution/job-search/docs/custom-attributes
        CustomAttribute customAttribute = CustomAttribute.newBuilder().addStringValues("Internship").addStringValues("Apprenticeship").setFilterable(true).build();
        Job job = Job.newBuilder().setCompany(companyId).setTitle("Software Developer I").setDescription("This is a description of this <i>wonderful</i> job!").putCustomAttributes("FOR_STUDENTS", customAttribute).setRequisitionId(requisitionId).setLanguageCode("en-US").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());
    }
}
Also used : TenantName(com.google.cloud.talent.v4.TenantName) CustomAttribute(com.google.cloud.talent.v4.CustomAttribute) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient) Job(com.google.cloud.talent.v4.Job) CreateJobRequest(com.google.cloud.talent.v4.CreateJobRequest)

Example 50 with JobServiceClient

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient in project java-talent by googleapis.

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.of(projectId, tenantId, jobId);
        DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build();
        jobServiceClient.deleteJob(request);
        System.out.println("Deleted job.");
    }
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4.DeleteJobRequest) JobName(com.google.cloud.talent.v4.JobName) JobServiceClient(com.google.cloud.talent.v4.JobServiceClient)

Aggregations

JobServiceClient (com.google.cloud.aiplatform.v1.JobServiceClient)21 JobServiceSettings (com.google.cloud.aiplatform.v1.JobServiceSettings)21 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)19 Job (com.google.cloud.talent.v4beta1.Job)16 LocationName (com.google.cloud.aiplatform.v1.LocationName)15 Value (com.google.protobuf.Value)10 BatchPredictionJob (com.google.cloud.aiplatform.v1.BatchPredictionJob)9 GcsDestination (com.google.cloud.aiplatform.v1.GcsDestination)8 GcsSource (com.google.cloud.aiplatform.v1.GcsSource)8 JobServiceClient (com.google.cloud.talent.v4.JobServiceClient)8 Job (com.google.cloud.talent.v4.Job)7 TenantOrProjectName (com.google.cloud.talent.v4beta1.TenantOrProjectName)7 TenantName (com.google.cloud.talent.v4.TenantName)6 RequestMetadata (com.google.cloud.talent.v4beta1.RequestMetadata)6 SearchJobsRequest (com.google.cloud.talent.v4beta1.SearchJobsRequest)6 DataLabelingJob (com.google.cloud.aiplatform.v1.DataLabelingJob)5 MachineSpec (com.google.cloud.aiplatform.v1.MachineSpec)5 BigQueryDestination (com.google.cloud.aiplatform.v1.BigQueryDestination)4 BigQuerySource (com.google.cloud.aiplatform.v1.BigQuerySource)4 CreateJobRequest (com.google.cloud.talent.v4beta1.CreateJobRequest)4