+ public void deleteServiceRecipe(String recipeId) {
+ this.deleteSingleResource(serviceRecipeClient,
+ UriBuilder.fromUri(endpoint + SERVICE_RECIPE + URI_SEPARATOR + recipeId).build());
+ }
+
+ public void postServiceRecipe(ServiceRecipe recipe) {
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<ServiceRecipe> entity = new HttpEntity<>(recipe, headers);
+ restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/serviceRecipe").build().encode().toString(),
+ HttpMethod.POST, entity, ServiceRecipe.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find ServiceRecipe with Id: " + recipe.getId());
+ }
+ throw e;
+ }
+ }
+
+ public void postVnfRecipe(VnfRecipe recipe) {
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<VnfRecipe> entity = new HttpEntity<>(recipe, headers);
+ restTemplate
+ .exchange(UriComponentsBuilder.fromUriString(endpoint + "/vnfRecipe").build().encode().toString(),
+ HttpMethod.POST, entity, VnfRecipe.class)
+ .getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find VnfRecipe with Id: " + recipe.getId());
+ }
+ throw e;
+ }
+ }
+
+ public void postNetworkRecipe(NetworkRecipe recipe) {
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<NetworkRecipe> entity = new HttpEntity<>(recipe, headers);
+ restTemplate.exchange(
+ UriComponentsBuilder.fromUriString(endpoint + "/networkRecipe").build().encode().toString(),
+ HttpMethod.POST, entity, NetworkRecipe.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find NetworkRecipe with Id: " + recipe.getId());
+ }
+ throw e;
+ }
+ }
+
+ public List<ServiceRecipe> getServiceRecipes() {
+ return this.getMultipleResources(serviceRecipeClient,
+ UriBuilder.fromUri(endpoint + SERVICE_RECIPE).queryParam("size", "1000").build());
+ }
+
+ public List<NetworkRecipe> getNetworkRecipes() {
+ return this.getMultipleResources(networkRecipeClient,
+ UriBuilder.fromUri(endpoint + NETWORK_RECIPE).queryParam("size", "1000").build());
+ }
+
+ public List<NetworkResource> getNetworkResources() {
+ return this.getMultipleResources(networkResourceClient,
+ UriBuilder.fromUri(endpoint + "/networkResource").queryParam("size", "1000").build());
+ }
+