Eliminazione di un tenant (v4beta1)

Elimina tenant.

Per saperne di più

Per la documentazione dettagliata che include questo esempio di codice, vedi quanto segue:

Esempio di codice

Java

Per scoprire come installare e utilizzare la libreria client per CTS, consulta Librerie client CTS. Per maggiori informazioni, consulta la documentazione di riferimento dell'API Java CTS.

Per eseguire l'autenticazione su CTS, configura Credenziali predefinite dell'applicazione. Per maggiori informazioni, consulta Configurare l'autenticazione per un ambiente di sviluppo locale.


import com.google.cloud.talent.v4.DeleteTenantRequest;
import com.google.cloud.talent.v4.TenantName;
import com.google.cloud.talent.v4.TenantServiceClient;
import java.io.IOException;

public class JobSearchDeleteTenant {

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

  // Delete Tenant.
  public static void deleteTenant(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);

      DeleteTenantRequest request =
          DeleteTenantRequest.newBuilder().setName(name.toString()).build();

      tenantServiceClient.deleteTenant(request);
      System.out.println("Deleted Tenant.");
    }
  }
}

Passaggi successivi

Per cercare e filtrare esempi di codice per altri prodotti Google Cloud, consulta il browser di esempio Google Cloud.