Search in sources :

Example 1 with GetTenantRequest

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

the class ITSystemTest method getTenantTest.

@Test
public void getTenantTest() {
    GetTenantRequest request = GetTenantRequest.newBuilder().setName(tenantName.toString()).build();
    Tenant actual = tenantServiceClient.getTenant(request);
    assertEquals(tenant.getName(), actual.getName());
    assertEquals(tenant.getExternalId(), actual.getExternalId());
}
Also used : Tenant(com.google.cloud.talent.v4beta1.Tenant) GetTenantRequest(com.google.cloud.talent.v4beta1.GetTenantRequest) Test(org.junit.Test)

Example 2 with GetTenantRequest

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

the class JobSearchGetTenant method getTenant.

// Get Tenant by name.
public static void getTenant(String projectId, String tenantId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
        TenantName name = TenantName.of(projectId, tenantId);
        GetTenantRequest request = GetTenantRequest.newBuilder().setName(name.toString()).build();
        Tenant response = tenantServiceClient.getTenant(request);
        System.out.format("Name: %s%n", response.getName());
        System.out.format("External ID: %s%n", response.getExternalId());
    }
}
Also used : TenantServiceClient(com.google.cloud.talent.v4.TenantServiceClient) Tenant(com.google.cloud.talent.v4.Tenant) TenantName(com.google.cloud.talent.v4.TenantName) GetTenantRequest(com.google.cloud.talent.v4.GetTenantRequest)

Example 3 with GetTenantRequest

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

the class JobSearchGetTenant method getTenant.

// Get Tenant by name.
public static void getTenant(String projectId, String tenantId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
        TenantName name = TenantName.of(projectId, tenantId);
        GetTenantRequest request = GetTenantRequest.newBuilder().setName(name.toString()).build();
        Tenant response = tenantServiceClient.getTenant(request);
        System.out.format("Name: %s%n", response.getName());
        System.out.format("External ID: %s%n", response.getExternalId());
    }
}
Also used : TenantServiceClient(com.google.cloud.talent.v4beta1.TenantServiceClient) Tenant(com.google.cloud.talent.v4beta1.Tenant) TenantName(com.google.cloud.talent.v4beta1.TenantName) GetTenantRequest(com.google.cloud.talent.v4beta1.GetTenantRequest)

Example 4 with GetTenantRequest

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

the class JobSearchGetTenant method sampleGetTenant.

/**
 * Get Tenant by name
 */
public static void sampleGetTenant(String projectId, String tenantId) {
    try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
        TenantName name = TenantName.of(projectId, tenantId);
        GetTenantRequest request = GetTenantRequest.newBuilder().setName(name.toString()).build();
        Tenant response = tenantServiceClient.getTenant(request);
        System.out.printf("Name: %s\n", response.getName());
        System.out.printf("External ID: %s\n", response.getExternalId());
    } catch (Exception exception) {
        System.err.println("Failed to create the client due to: " + exception);
    }
}
Also used : TenantServiceClient(com.google.cloud.talent.v4beta1.TenantServiceClient) Tenant(com.google.cloud.talent.v4beta1.Tenant) TenantName(com.google.cloud.talent.v4beta1.TenantName) GetTenantRequest(com.google.cloud.talent.v4beta1.GetTenantRequest)

Aggregations

GetTenantRequest (com.google.cloud.talent.v4beta1.GetTenantRequest)3 Tenant (com.google.cloud.talent.v4beta1.Tenant)3 TenantName (com.google.cloud.talent.v4beta1.TenantName)2 TenantServiceClient (com.google.cloud.talent.v4beta1.TenantServiceClient)2 GetTenantRequest (com.google.cloud.talent.v4.GetTenantRequest)1 Tenant (com.google.cloud.talent.v4.Tenant)1 TenantName (com.google.cloud.talent.v4.TenantName)1 TenantServiceClient (com.google.cloud.talent.v4.TenantServiceClient)1 Test (org.junit.Test)1