Delete CA pool

Stay organized with collections Save and categorize content based on your preferences.

Delete the specified CA pool.

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample


import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

public class DeleteCaPool {

  public static void main(String[] args)
      throws InterruptedException, ExecutionException, IOException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    // location: For a list of locations, see:
    // poolId: The id of the CA pool to be deleted.
    String project = "your-project-id";
    String location = "ca-location";
    String poolId = "ca-pool-id";
    deleteCaPool(project, location, poolId);

  // Delete the CA pool as mentioned by the poolId.
  // Before deleting the pool, all CAs in the pool MUST BE deleted.
  public static void deleteCaPool(String project, String location, String poolId)
      throws InterruptedException, ExecutionException, 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 `certificateAuthorityServiceClient.close()` method on the client to safely
    // clean up any remaining background resources.
    try (CertificateAuthorityServiceClient certificateAuthorityServiceClient =
        CertificateAuthorityServiceClient.create()) {

      // Set the project, location and poolId to delete.
      CaPoolName caPool =

      // Create the Delete request.
      DeleteCaPoolRequest deleteCaPoolRequest =

      // Delete the CA Pool.
      ApiFuture<Operation> futureCall =
      Operation response = futureCall.get();

      if (response.hasError()) {
        System.out.println("Error while deleting CA pool !" + response.getError());

      System.out.println("Deleted CA Pool: " + poolId);


import as privateca_v1

def delete_ca_pool(project_id: str, location: str, ca_pool_name: str) -> None:
    Delete the CA pool as mentioned by the ca_pool_name.
    Before deleting the pool, all CAs in the pool MUST BE deleted.

        project_id: project ID or project number of the Cloud project you want to use.
        location: location you want to use. For a list of locations, see:
        ca_pool_name: the name of the CA pool to be deleted.

    caServiceClient = privateca_v1.CertificateAuthorityServiceClient()

    ca_pool_path = caServiceClient.ca_pool_path(project_id, location, ca_pool_name)

    # Create the Delete request.
    request = privateca_v1.DeleteCaPoolRequest(name=ca_pool_path)

    # Delete the CA Pool.

    print("Deleted CA Pool:", ca_pool_name)

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.