예제 #1
0
 @Override
 public Boolean delete() {
   if (name != null && !name.isEmpty()) {
     try {
       if (cascading && !isReaping()) {
         Reaper reaper = ReaperFactory.getReaper(this);
         if (reaper != null) {
           setReaping(true);
           reaper.reap();
         }
       }
       deleteThis();
       return true;
     } catch (KubernetesClientException e) {
       if (e.getCode() != 404) {
         throw e;
       }
       return false;
     }
   } else {
     try {
       deleteList();
       return true;
     } catch (KubernetesClientException e) {
       if (e.getCode() != 404) {
         throw e;
       }
       return false;
     }
   }
 }
예제 #2
0
 @Override
 public Boolean delete(List<T> items) {
   try {
     for (T item : items) {
       handleDelete(item);
     }
   } catch (KubernetesClientException e) {
     if (e.getCode() != 404) {
       throw e;
     }
     return false;
   } catch (InterruptedException | ExecutionException | IOException e) {
     throw KubernetesClientException.launderThrowable(e);
   }
   return true;
 }
예제 #3
0
 public RootPaths getRootPaths() {
   try {
     URL requestUrl = client.getMasterUrl();
     Future<Response> f = getClient().getHttpClient().prepareGet(requestUrl.toString()).execute();
     Response r = f.get();
     assertResponseCode(r, 200);
     return OBJECT_MAPPER.readValue(r.getResponseBodyAsStream(), RootPaths.class);
   } catch (KubernetesClientException e) {
     if (e.getCode() != 404) {
       throw e;
     }
     return null;
   } catch (InterruptedException | ExecutionException | IOException e) {
     throw KubernetesClientException.launderThrowable(e);
   }
 }
예제 #4
0
 @Override
 public T get() {
   if (item != null) {
     return item;
   }
   try {
     URL requestUrl = getNamespacedUrl();
     if (name != null) {
       requestUrl = new URL(URLUtils.join(requestUrl.toString(), name));
     }
     return handleGet(requestUrl);
   } catch (KubernetesClientException e) {
     if (e.getCode() != 404) {
       throw e;
     }
     return null;
   } catch (InterruptedException | ExecutionException | IOException e) {
     throw KubernetesClientException.launderThrowable(e);
   }
 }