protected URL getNamespacedUrl(String namespace) throws MalformedURLException {
   URL requestUrl = getRootUrl();
   if (namespace != null) {
     requestUrl = new URL(URLUtils.join(requestUrl.toString(), "namespaces", namespace));
   }
   requestUrl = new URL(URLUtils.join(requestUrl.toString(), resourceT));
   return requestUrl;
 }
 public URL getRootUrl() {
   try {
     return new URL(
         URLUtils.join(client.getMasterUrl().toString(), "api", client.getApiVersion()));
   } catch (MalformedURLException e) {
     throw KubernetesClientException.launderThrowable(e);
   }
 }
Esempio n. 3
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);
   }
 }
 protected URL getResourceUrl() throws MalformedURLException {
   if (name == null) {
     return getNamespacedUrl();
   }
   return new URL(URLUtils.join(getNamespacedUrl().toString(), name));
 }