Package com.openshift.client

Examples of com.openshift.client.OpenShiftException


          && !isTimeouted(timeout, startTime)) {
        Thread.sleep(APPLICATION_WAIT_RETRY_DELAY);
      }
      return canResolv(applicationUrl);
    } catch (MalformedURLException e) {
      throw new OpenShiftException(e,
          "Could not wait for application {0} to become accessible, it has an invalid URL \"{1}\": {2}",
          name, applicationUrl, e.getMessage());
    }
  }
View Full Code Here


  }

  @Override
  public IEnvironmentVariable addEnvironmentVariable(String name, String value) throws OpenShiftException {
    if (name == null) {
      throw new OpenShiftException("Environment variable name is mandatory but none was given.");
    }
    if (value == null) {
      throw new OpenShiftException("Value for environment variable \"{0}\" not given.", name);
    }
    if (hasEnvironmentVariable(name)) {
      throw new OpenShiftException("Environment variable with name \"{0}\" already exists.", name);
    }

    EnvironmentVariableResourceDTO environmentVariableResourceDTO =
        new AddEnvironmentVariableRequest().execute(name, value);
    IEnvironmentVariable environmentVariable = new EnvironmentVariableResource(environmentVariableResourceDTO, this);
View Full Code Here

  }

  @Override
  public IEnvironmentVariable updateEnvironmentVariable(String name, String value) throws OpenShiftException {
    if (name == null) {
      throw new OpenShiftException("Environment variable name is mandatory but none was given.");
    }
    if (value == null) {
      throw new OpenShiftException("Value for environment variable \"{0}\" not given.", name);
    }
    if (!hasEnvironmentVariable(name)) {
      throw new OpenShiftException("Environment variable with name \"{0}\" does not exist.", name);
    }

    IEnvironmentVariable environmentVariable = getEnvironmentVariable(name);
    environmentVariable.update(value);
View Full Code Here

  }

  @Override
  public void removeEnvironmentVariable(IEnvironmentVariable environmentVariable){
    if(getEnvironmentVariable(environmentVariable.getName()) == null)
      throw new OpenShiftException("IEnvironmentVariable with supplied name does not exist.");
    environmentVariable.destroy();
    environmentVariablesMap.remove(environmentVariable.getName());

  }
View Full Code Here

  }

  @Override
  public boolean hasEnvironmentVariable(String name) throws OpenShiftException {
    if (StringUtils.isEmpty(name)) {
      throw new OpenShiftException("Environment variable name is mandatory but none was given.");
    }
    return getEnvironmentVariable(name) != null;

  }
View Full Code Here

        String url = link.getHref(server, SERVICE_PATH, urlPathParameter, urlParameters);
        try {
            String response = request(new URL(url), link.getHttpMethod(), requestMediaType, timeout, parameters);
            return responseFactory.get(response);
        } catch (EncodingException e) {
            throw new OpenShiftException(e, e.getMessage());
    } catch (MalformedURLException e) {
      throw new OpenShiftException(e, e.getMessage());
        } catch (UnauthorizedException e) {
            throw new InvalidCredentialsOpenShiftException(url, e, getRestResponse(e));
        } catch (NotFoundException e) {
            throw new NotFoundOpenShiftException(url, e, getRestResponse(e));
        } catch (HttpClientException e) {
View Full Code Here

    case DELETE:
      return client.delete(url, mediaType, timeout, parameters);
    case PATCH:
      return client.patch(url, mediaType, timeout, parameters);
    default:
      throw new OpenShiftException("Unexpected HTTP method {0}", httpMethod.toString());
    }
   
   
  }
View Full Code Here

  @Override
  @Deprecated
  public void update(String newValue) throws OpenShiftException {
    if (newValue == null) {
      throw new OpenShiftException("Value for environment variable \"{0}\" not given.", name);
    }
    EnvironmentVariableResourceDTO environmentVariableResourceDTO =
        new UpdateEnvironmentVariableRequest().execute(newValue);
    updateEnvironmentVariable(environmentVariableResourceDTO);
    /*
 
View Full Code Here

      out.write(url.getBytes());
      out.write(IHttpClient.QUESTION_MARK);
      new FormUrlEncodedMediaType().writeTo(new ParameterValueMap(urlParameters), out);
      return out.toString();
    } catch (IOException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
    } catch (EncodingException e) {
      throw new OpenShiftException(e, "Could not add paramters {0} to url {1}", urlParameters, url);
    }
  }
View Full Code Here

  protected IApplication createApplication(final String name, final ApplicationScale scale,
      final IGearProfile gearProfile, String initialGitUrl, int timeout,
      Map<String, String> environmentVariables, Collection<ICartridge> cartridges)
      throws OpenShiftException {
    if (name == null) {
      throw new OpenShiftException("Application name is mandatory but none was given.");
    }
    // this would trigger lazy loading list of available applications.
    // this is needed anyhow since we're adding the new app to the list of
    // available apps
    if (hasApplicationByName(name)) {
      throw new OpenShiftException("Application with name \"{0}\" already exists.", name);
    }

    ApplicationResourceDTO applicationDTO =
        new CreateApplicationRequest().execute(
            name, scale, gearProfile, initialGitUrl, timeout, environmentVariables, cartridges);
View Full Code Here

TOP

Related Classes of com.openshift.client.OpenShiftException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.