Diese Seite wurde von der Cloud Translation API übersetzt.
Switch to English

Mandant abrufen (v4beta1)

Mandant abrufen.

Dokumentationsseiten mit diesem Codebeispiel

Das Codebeispiel im Kontext finden Sie in der folgenden Dokumentation:



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;


import com.google.cloud.talent.v4.GetTenantRequest;
import com.google.cloud.talent.v4.Tenant;
import com.google.cloud.talent.v4.TenantName;
import com.google.cloud.talent.v4.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());

Nächste Schritte

Codebeispiele für andere Google Cloud-Produkte finden Sie im Google Cloud-Beispielbrowser.