Se usó la API de Cloud Translation para traducir esta página.
Switch to English

Obtener usuario (v4beta1)

Obtener usuario

Páginas de documentación que incluyen esta muestra de código

Para ver la muestra de código usada en contexto, consulta la siguiente documentación:

Muestra de código

C#

public static object GetTenant(string projectId, string tenantId)
{
    TenantServiceClient tenantServiceClient = TenantServiceClient.Create();
    TenantName name = TenantName.FromProjectTenant(projectId, tenantId);
    GetTenantRequest request = new GetTenantRequest
    {
        TenantName = name
    };
    Tenant response = tenantServiceClient.GetTenant(request);
    Console.WriteLine($"Name: {response.Name}");
    Console.WriteLine($"External ID: {response.ExternalId}");
    return 0;
}

Java


import com.google.cloud.talent.v4beta1.GetTenantRequest;
import com.google.cloud.talent.v4beta1.Tenant;
import com.google.cloud.talent.v4beta1.TenantName;
import com.google.cloud.talent.v4beta1.TenantServiceClient;
import java.io.IOException;

public class JobSearchGetTenant {

  public static void getTenant() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    getTenant(projectId, tenantId);
  }

  // Get Tenant by name.
  public static void getTenant(String projectId, String tenantId) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // 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());
    }
  }
}