use of com.google.cloud.security.privateca.v1.DeleteCaPoolRequest in project java-security-private-ca by googleapis.
the class DeleteCaPool method deleteCaPool.
// Delete the CA pool as mentioned by the pool_Id.
// Before deleting the pool, all CAs in the pool MUST BE deleted.
public static void deleteCaPool(String project, String location, String pool_Id) throws InterruptedException, ExecutionException, IOException {
// clean up any remaining background resources.
try (CertificateAuthorityServiceClient certificateAuthorityServiceClient = CertificateAuthorityServiceClient.create()) {
// Set the project, location and pool_Id to delete.
CaPoolName caPool = CaPoolName.newBuilder().setProject(project).setLocation(location).setCaPool(pool_Id).build();
// Create the Delete request.
DeleteCaPoolRequest deleteCaPoolRequest = DeleteCaPoolRequest.newBuilder().setName(caPool.toString()).build();
// Delete the CA Pool.
ApiFuture<Operation> futureCall = certificateAuthorityServiceClient.deleteCaPoolCallable().futureCall(deleteCaPoolRequest);
Operation response = futureCall.get();
if (response.hasError()) {
System.out.println("Error while deleting CA pool !" + response.getError());
return;
}
System.out.println("Deleted CA Pool: " + pool_Id);
}
}
Aggregations