테넌트를 삭제합니다.
이 코드 샘플이 포함된 문서 페이지
컨텍스트에서 사용된 코드 샘플을 보려면 다음 문서를 참조하세요.
코드 샘플
C#
public static object DeleteTenant(string projectId, string tenantId)
{
TenantServiceClient tenantServiceClient = TenantServiceClient.Create();
TenantName tenantName = TenantName.FromProjectTenant(projectId, tenantId);
DeleteTenantRequest request = new DeleteTenantRequest
{
TenantName = tenantName
};
tenantServiceClient.DeleteTenant(request);
Console.WriteLine($"Deleted Tenant.");
return 0;
}
자바
import com.google.cloud.talent.v4beta1.DeleteTenantRequest;
import com.google.cloud.talent.v4beta1.TenantName;
import com.google.cloud.talent.v4beta1.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.");
}
}
}