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());
}
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());
}
}
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());
}
}
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);
}
}
Aggregations