public void addLogMessage(HttpMethod method, URI url, String status, HttpStatus httpStatus, String message) { RestLogEntry logEntry = new RestLogEntry(method, url, status, httpStatus, message); for (RestLogCallback callback : listeners) { callback.onNewLogEntry(logEntry); } }
@Override public String getMessage() { return decorateExceptionMessage(super.getMessage()); }
@Override public String getMessage() { return decorateExceptionMessage(super.getMessage()); }
private String formatLogMessage(RestLogEntry restLogEntry) { return restLogEntry.getStatus() + " :: HTTP STATUS: " + restLogEntry.getHttpStatus() + " :: REQUEST: " + restLogEntry.getMethod() + " " + restLogEntry.getUri() + " :: " + restLogEntry.getMessage(); }
@Override public void onClose(Session session, CloseReason closeReason) { if (closeReason.getCloseCode() == CloseReason.CloseCodes.NORMAL_CLOSURE || closeReason.getCloseCode() == CloseReason.CloseCodes.GOING_AWAY) { listener.onComplete(); } else { listener.onError(new CloudOperationException("Loggregrator connection closed unexpectedly " + closeReason)); } }
/** * Run commands as a different user. The authenticated user must be * privileged to run as this user. * @param user the user to proxy for * @return credentials for the proxied user */ public CloudCredentials proxyForUser(String user) { return new CloudCredentials(this, user); }
private CloudOperationException evaluateCloudOperationException(CloudOperationException e, String serviceName) { if (e.getStatusCode() == HttpStatus.NOT_FOUND) { getStepLogger().warn(e, Messages.COULD_NOT_DELETE_SERVICE, serviceName); return null; } if (e.getStatusCode() == HttpStatus.BAD_GATEWAY) { return new CloudServiceBrokerException(e); } return new CloudControllerException(e); }
@Override public void onClose(Session session, CloseReason closeReason) { if (closeReason.getCloseCode() == CloseReason.CloseCodes.NORMAL_CLOSURE || closeReason.getCloseCode() == CloseReason.CloseCodes.GOING_AWAY) { listener.onComplete(); } else { listener.onError(new CloudException("Loggregrator connection closed unexpectedly " + closeReason)); } }
@Override public Object extractData(ClientHttpResponse clientHttpResponse) throws IOException { callback.onClientHttpResponse(clientHttpResponse); return null; }
public CloudOperationException(HttpStatus statusCode, String statusText, String description, Throwable cause) { super(getExceptionMessage(statusCode, statusText, description), cause); this.statusCode = statusCode; this.statusText = statusText; this.description = description; }
@Override protected Void doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { client.login(); return null; } }.run(monitor);
@Override protected List<CloudDomain> doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { return client.getDomains(); } }.run(monitor);
@Override protected InstancesInfo doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { return client.getApplicationInstances(applicationId); } }.run(monitor);
@Override protected String doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { return client.getFile(applicationId, instanceIndex, path); } }.run(monitor);
@Override protected Void doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { client.updatePassword(newPassword); return null; }
@Override protected List<CloudService> doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { return client.getServices(); } }.run(monitor);
@Override protected Void doRun(CloudFoundryOperations client, SubMonitor progress) throws CoreException { client.updateApplicationServices(appName, services); return null; } };
/** * Run commands as a different user. The authenticated user must be privileged to run as this user. * * @param user the user to proxy for * @return credentials for the proxied user */ public CloudCredentials proxyForUser(String user) { return new CloudCredentials(this, user); } }
public void addLogMessage(HttpMethod method, URI url, String status, HttpStatus httpStatus, String message) { RestLogEntry logEntry = new RestLogEntry(method, url, status, httpStatus, message); for (RestLogCallback callback : listeners) { callback.onNewLogEntry(logEntry); } }
@Override public Object extractData(ClientHttpResponse clientHttpResponse) throws IOException { callback.onClientHttpResponse(clientHttpResponse); return null; }