Search in sources :

Example 6 with ListTenantsRequest

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

the class JobSearchListTenants method listTenants.

// List Tenants.
public static void listTenants(String projectId) throws IOException {
    // the "close" method on the client to safely clean up any remaining background resources.
    try (TenantServiceClient tenantServiceClient = TenantServiceClient.create()) {
        ProjectName parent = ProjectName.of(projectId);
        ListTenantsRequest request = ListTenantsRequest.newBuilder().setParent(parent.toString()).build();
        for (Tenant responseItem : tenantServiceClient.listTenants(request).iterateAll()) {
            System.out.format("Tenant Name: %s%n", responseItem.getName());
            System.out.format("External ID: %s%n", responseItem.getExternalId());
        }
    }
}
Also used : TenantServiceClient(com.google.cloud.talent.v4.TenantServiceClient) Tenant(com.google.cloud.talent.v4.Tenant) ProjectName(com.google.cloud.talent.v4.ProjectName) ListTenantsRequest(com.google.cloud.talent.v4.ListTenantsRequest)

Aggregations

ListTenantsRequest (com.google.cloud.talent.v4beta1.ListTenantsRequest)3 Tenant (com.google.cloud.talent.v4beta1.Tenant)3 Test (org.junit.Test)3 ListTenantsPagedResponse (com.google.cloud.talent.v4.TenantServiceClient.ListTenantsPagedResponse)2 ProjectName (com.google.cloud.talent.v4beta1.ProjectName)2 TenantServiceClient (com.google.cloud.talent.v4beta1.TenantServiceClient)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 ListTenantsRequest (com.google.cloud.talent.v4.ListTenantsRequest)1 ProjectName (com.google.cloud.talent.v4.ProjectName)1 Tenant (com.google.cloud.talent.v4.Tenant)1 TenantServiceClient (com.google.cloud.talent.v4.TenantServiceClient)1