Search in sources :

Example 1 with DeleteJobRequest

use of com.google.cloud.talent.v4.DeleteJobRequest in project java-talent by googleapis.

the class JobSearchDeleteJob method sampleDeleteJob.

/**
 * Delete Job
 */
public static void sampleDeleteJob(String projectId, String tenantId, String jobId) {
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
        JobName name = JobWithTenantName.of(projectId, tenantId, jobId);
        DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build();
        jobServiceClient.deleteJob(request);
        System.out.println("Deleted job.");
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4beta1.DeleteJobRequest) JobName(com.google.cloud.talent.v4beta1.JobName) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient)

Example 2 with DeleteJobRequest

use of com.google.cloud.talent.v4.DeleteJobRequest 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.");
    }
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4beta1.DeleteJobRequest) JobName(com.google.cloud.talent.v4beta1.JobName) JobServiceClient(com.google.cloud.talent.v4beta1.JobServiceClient)

Example 3 with DeleteJobRequest

use of com.google.cloud.talent.v4.DeleteJobRequest in project java-talent by googleapis.

the class ITSystemTest method afterTest.

@AfterClass
public static void afterTest() {
    completionClient.close();
    eventServiceClient.close();
    /* delete job */
    DeleteJobRequest jobRequest = DeleteJobRequest.newBuilder().setName(jobName.toString()).build();
    jobServiceClient.deleteJob(jobRequest);
    jobServiceClient.close();
    /* delete company */
    DeleteCompanyRequest companyRequest = DeleteCompanyRequest.newBuilder().setName(companyName.toString()).build();
    companyServiceClient.deleteCompany(companyRequest);
    companyServiceClient.close();
    /* delete tenant */
    DeleteTenantRequest request = DeleteTenantRequest.newBuilder().setName(tenantName.toString()).build();
    tenantServiceClient.deleteTenant(request);
    tenantServiceClient.close();
}
Also used : DeleteJobRequest(com.google.cloud.talent.v4beta1.DeleteJobRequest) DeleteCompanyRequest(com.google.cloud.talent.v4beta1.DeleteCompanyRequest) DeleteTenantRequest(com.google.cloud.talent.v4beta1.DeleteTenantRequest) AfterClass(org.junit.AfterClass)

Example 4 with DeleteJobRequest

use of com.google.cloud.talent.v4.DeleteJobRequest 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

DeleteJobRequest (com.google.cloud.talent.v4beta1.DeleteJobRequest)3 JobName (com.google.cloud.talent.v4beta1.JobName)2 JobServiceClient (com.google.cloud.talent.v4beta1.JobServiceClient)2 DeleteJobRequest (com.google.cloud.talent.v4.DeleteJobRequest)1 JobName (com.google.cloud.talent.v4.JobName)1 JobServiceClient (com.google.cloud.talent.v4.JobServiceClient)1 DeleteCompanyRequest (com.google.cloud.talent.v4beta1.DeleteCompanyRequest)1 DeleteTenantRequest (com.google.cloud.talent.v4beta1.DeleteTenantRequest)1 AfterClass (org.junit.AfterClass)1