Search in sources :

Example 1 with DeleteCompanyRequest

use of com.google.cloud.talent.v4.DeleteCompanyRequest in project java-docs-samples by GoogleCloudPlatform.

the class JobSearchDeleteCompany method deleteCompany.

// Delete Company.
public static void deleteCompany(String projectId, String tenantId, String companyId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        CompanyName name = CompanyName.ofProjectTenantCompanyName(projectId, tenantId, companyId);
        DeleteCompanyRequest request = DeleteCompanyRequest.newBuilder().setName(name.toString()).build();
        companyServiceClient.deleteCompany(request);
        System.out.println("Deleted company");
    }
}
Also used : DeleteCompanyRequest(com.google.cloud.talent.v4beta1.DeleteCompanyRequest) CompanyName(com.google.cloud.talent.v4beta1.CompanyName) CompanyServiceClient(com.google.cloud.talent.v4beta1.CompanyServiceClient)

Example 2 with DeleteCompanyRequest

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

the class JobSearchDeleteCompany method sampleDeleteCompany.

/**
 * Delete Company
 */
public static void sampleDeleteCompany(String projectId, String tenantId, String companyId) {
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        CompanyName name = CompanyWithTenantName.of(projectId, tenantId, companyId);
        DeleteCompanyRequest request = DeleteCompanyRequest.newBuilder().setName(name.toString()).build();
        companyServiceClient.deleteCompany(request);
        System.out.println("Deleted company");
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : DeleteCompanyRequest(com.google.cloud.talent.v4beta1.DeleteCompanyRequest) CompanyName(com.google.cloud.talent.v4beta1.CompanyName) CompanyServiceClient(com.google.cloud.talent.v4beta1.CompanyServiceClient)

Example 3 with DeleteCompanyRequest

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

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

the class JobSearchDeleteCompany method deleteCompany.

// Delete Company.
public static void deleteCompany(String projectId, String tenantId, String companyId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) {
        CompanyName name = CompanyName.of(projectId, tenantId, companyId);
        DeleteCompanyRequest request = DeleteCompanyRequest.newBuilder().setName(name.toString()).build();
        companyServiceClient.deleteCompany(request);
        System.out.println("Deleted company");
    }
}
Also used : DeleteCompanyRequest(com.google.cloud.talent.v4.DeleteCompanyRequest) CompanyName(com.google.cloud.talent.v4.CompanyName) CompanyServiceClient(com.google.cloud.talent.v4.CompanyServiceClient)

Aggregations

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