public void deregister() { String id = registeredId.get(); if (id != null) { for (String adminUrl : client.getAdminUrl()) { try { template.delete(adminUrl + "/" + id); registeredId.compareAndSet(id, null); if (client.isRegisterOnce()) { break; } } catch (Exception ex) { LOGGER.warn("Failed to deregister application (id={}) at spring-boot-admin ({}): {}", id, adminUrl, ex.getMessage()); } } } }
private <T> T doExecute(HttpMethod method, ServiceDTO service, String path, Object request, Class<T> responseType, Object... uriVariables) { T result = null; switch (method) { case GET: result = restTemplate.getForObject(parseHost(service) + path, responseType, uriVariables); break; case POST: result = restTemplate.postForEntity(parseHost(service) + path, request, responseType, uriVariables).getBody(); break; case PUT: restTemplate.put(parseHost(service) + path, request, uriVariables); break; case DELETE: restTemplate.delete(parseHost(service) + path, uriVariables); break; default: throw new UnsupportedOperationException(String.format("unsupported http method(method=%s)", method)); } return result; }
@Test public void delete() throws Exception { mockSentRequest(DELETE, "http://example.com"); mockResponseStatus(HttpStatus.OK); template.delete("http://example.com"); verify(response).close(); }
@Override public void delete(String url, Map<String, ?> urlVariables) throws RestClientException { getRestTemplate(url).delete(url, urlVariables); }
@Override public void delete(URI url) throws RestClientException { getRestTemplate(url).delete(url); }
@Override public void delete(String url, Object... urlVariables) throws RestClientException { getRestTemplate(url).delete(url, urlVariables); }
/** * Delete the resources at the specified URI. * <p> * URI Template variables are expanded using the given URI variables, if any. * @param url the URL * @param urlVariables the variables to expand in the template * @throws RestClientException on client-side HTTP error * @see RestTemplate#delete(java.lang.String, java.lang.Object[]) */ public void delete(String url, Object... urlVariables) throws RestClientException { this.restTemplate.delete(url, urlVariables); }
protected void finishTransfer() throws IOException { if (state != StreamingResourceState.TRANSFER_IN_PROGRESS && state != StreamingResourceState.EMPTY) { throw new IOException("Streaming resource have to be in progress to be able to finish it"); } try { restTemplate.delete(uri); } catch (RestClientException e) { logger.info("Couldn't delete stream resource" + uri, e); } state = StreamingResourceState.TRANSFERED; }
/** * Delete the resources at the specified URL. * @param url the URL * @throws RestClientException on client-side HTTP error * @see RestTemplate#delete(java.net.URI) */ public void delete(URI url) throws RestClientException { this.restTemplate.delete(applyRootUriIfNecessary(url)); }
private void doDeleteDomain(UUID domainGuid) { Map<String, Object> urlVars = new HashMap<String, Object>(); String urlPath = "/v2/private_domains/{domain}"; urlVars.put("domain", domainGuid); getRestTemplate().delete(getUrl(urlPath), urlVars); }
private void unbindRoute(String host, UUID domainGuid, UUID appGuid) { UUID routeGuid = getRouteGuid(host, domainGuid); if (routeGuid != null) { String bindPath = "/v2/apps/{app}/routes/{route}"; Map<String, Object> bindVars = new HashMap<String, Object>(); bindVars.put("app", appGuid); bindVars.put("route", routeGuid); getRestTemplate().delete(getUrl(bindPath), bindVars); } }
@Override public void unregister(String name, ApplicationType applicationType) { String uri = appsLink.getHref() + "/{type}/{name}"; restTemplate.delete(uri, applicationType.name(), name); }
@Override public void reset(String name) { restTemplate.delete(links.getLink(FVC_RELATION).expand(name).getHref()); } }
@Override public void reset(String name) { restTemplate.delete(links.getLink(AGGREGATE_COUNTER_RELATION).expand(name).getHref()); } }
@Override public void reset(String name) { restTemplate.delete(links.getLink(COUNTER_RELATION).expand(name).getHref()); } }
public void deleteQuota(String quotaName) { CloudQuota quota = this.getQuotaByName(quotaName, true); String setPath = "/v2/quota_definitions/{quotaGuid}"; Map<String, Object> setVars = new HashMap<String, Object>(); setVars.put("quotaGuid", quota.getMeta().getGuid()); getRestTemplate().delete(getUrl(setPath), setVars); }
@Override public void unbindStagingSecurityGroup(String securityGroupName) { CloudSecurityGroup group = doGetSecurityGroup(securityGroupName, true); Map<String, Object> urlVars = new HashMap<String, Object>(); String urlPath = "/v2/config/staging_security_groups/{guid}"; urlVars.put("guid", group.getMeta().getGuid()); getRestTemplate().delete(getUrl(urlPath), urlVars); }
@Override public void deleteSecurityGroup(String securityGroupName) { CloudSecurityGroup group = doGetSecurityGroup(securityGroupName, true); String path = "/v2/security_groups/{guid}"; Map<String, Object> pathVariables = new HashMap<String, Object>(); pathVariables.put("guid", group.getMeta().getGuid()); getRestTemplate().delete(getUrl(path), pathVariables); }
@Override public void unbindRunningSecurityGroup(String securityGroupName) { CloudSecurityGroup group = doGetSecurityGroup(securityGroupName, true); Map<String, Object> urlVars = new HashMap<String, Object>(); String urlPath = "/v2/config/running_security_groups/{guid}"; urlVars.put("guid", group.getMeta().getGuid()); getRestTemplate().delete(getUrl(urlPath), urlVars); }
@Override public void deleteServiceBroker(String name) { CloudServiceBroker existingBroker = getServiceBroker(name); Assert.notNull(existingBroker, "Cannot update broker if it does not first exist"); getRestTemplate().delete(getUrl("/v2/service_brokers/{guid}"), existingBroker.getMeta().getGuid()); }