3232public class Util {
3333
3434 // Delete Ca pools which starts with the given prefixToDelete.
35- public static void cleanUpCaPool (String prefixToDelete , String projectId ,
35+ public static void cleanUpCaPool (String projectId ,
3636 String location )
3737 throws IOException , ExecutionException , InterruptedException , TimeoutException {
3838
3939 try (CertificateAuthorityServiceClient client = CertificateAuthorityServiceClient .create ()) {
4040
41- // Filter CA pools with the prefix
42- for (CaPool caPool : filterCaPools ( prefixToDelete , projectId , location ).iterateAll ()) {
41+ // List Ca pools
42+ for (CaPool caPool : listCaPools ( projectId , location ).iterateAll ()) {
4343 deleteCertificateAuthority (caPool .getName ());
4444 DeleteCaPoolRequest deleteCaPoolRequest =
4545 DeleteCaPoolRequest .newBuilder ().setName (caPool .getName ()).build ();
@@ -49,7 +49,7 @@ public static void cleanUpCaPool(String prefixToDelete, String projectId,
4949 }
5050 }
5151
52- public static ListCaPoolsPagedResponse filterCaPools ( String prefixToDelete , String project ,
52+ public static ListCaPoolsPagedResponse listCaPools ( String project ,
5353 String location ) throws IOException {
5454 try (CertificateAuthorityServiceClient certificateAuthorityServiceClient =
5555 CertificateAuthorityServiceClient .create ()) {
@@ -59,7 +59,6 @@ public static ListCaPoolsPagedResponse filterCaPools(String prefixToDelete, Stri
5959
6060 ListCaPoolsRequest request = ListCaPoolsRequest .newBuilder ()
6161 .setParent (locationName .toString ())
62- .setFilter (String .format ("name:%s" , prefixToDelete ))
6362 .build ();
6463
6564 return
0 commit comments