@Test @Deprecated public void testGetCatalogEntityPlusVersionDetails() { CatalogEntitySummary details = client() .resource(URI.create("/v1/catalog/entities/org.apache.brooklyn.entity.brooklynnode.BrooklynNode:0.0.0.SNAPSHOT")) .get(CatalogEntitySummary.class); assertTrue(details.toString().contains("download.url"), "expected more config, only got: "+details); }
@Override public Response create(String yaml) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.ADD_CATALOG_ITEM, yaml)) { throw WebResourceUtils.unauthorized("User '%s' is not authorized to add catalog item", Entitlements.getEntitlementContext().user()); } Iterable<? extends CatalogItem<?, ?>> items; try { items = brooklyn().getCatalog().addItems(yaml); } catch (IllegalArgumentException e) { return Response.status(Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(ApiError.of(e)) .build(); } log.info("REST created catalog items: "+items); Map<String,Object> result = MutableMap.of(); for (CatalogItem<?,?> item: items) { try { result.put(item.getId(), CatalogTransformer.catalogItemSummary(brooklyn(), item)); } catch (Throwable t) { log.warn("Error loading catalog item '"+item+"' (rethrowing): "+t); throw Exceptions.propagate(t); } } return Response.status(Status.CREATED).entity(result).build(); }
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @Override public Response create(String yaml) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.ADD_CATALOG_ITEM, yaml)) { throw WebResourceUtils.unauthorized("User '%s' is not authorized to add catalog item", Entitlements.getEntitlementContext().user()); } Iterable<? extends CatalogItem<?, ?>> items; try { items = brooklyn().getCatalog().addItems(yaml); } catch (IllegalArgumentException e) { return Response.status(Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(ApiError.of(e)) .build(); } log.info("REST created catalog items: "+items); Map<String,Object> result = MutableMap.of(); for (CatalogItem<?,?> item: items) { try { result.put(item.getId(), CatalogTransformer.catalogItemSummary(brooklyn(), item)); } catch (Throwable t) { log.warn("Error loading catalog item '"+item+"' (rethrowing): "+t); throw Exceptions.propagate(t); } } return Response.status(Status.CREATED).entity(result).build(); } }
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @Override public Response create(String yaml) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.ADD_CATALOG_ITEM, yaml)) { throw WebResourceUtils.unauthorized("User '%s' is not authorized to add catalog item", Entitlements.getEntitlementContext().user()); } Iterable<? extends CatalogItem<?, ?>> items; try { items = brooklyn().getCatalog().addItems(yaml); } catch (IllegalArgumentException e) { return Response.status(Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(ApiError.of(e)) .build(); } log.info("REST created catalog items: "+items); Map<String,Object> result = MutableMap.of(); for (CatalogItem<?,?> item: items) { try { result.put(item.getId(), CatalogTransformer.catalogItemSummary(brooklyn(), item)); } catch (Throwable t) { log.warn("Error loading catalog item '"+item+"' (rethrowing): "+t); throw Exceptions.propagate(t); } } return Response.status(Status.CREATED).entity(result).build(); }  }
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @Override public Response create(String yaml) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.ADD_CATALOG_ITEM, yaml)) { throw WebResourceUtils.unauthorized("User '%s' is not authorized to add catalog item", Entitlements.getEntitlementContext().user()); } Iterable<? extends CatalogItem<?, ?>> items; try { items = brooklyn().getCatalog().addItems(yaml); } catch (IllegalArgumentException e) { return Response.status(Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(ApiError.of(e)) .build(); } log.info("REST created catalog items: "+items); Map<String,Object> result = MutableMap.of(); for (CatalogItem<?,?> item: items) { try { result.put(item.getId(), CatalogTransformer.catalogItemSummary(brooklyn(), item)); } catch (Throwable t) { log.warn("Error loading catalog item '"+item+"' (rethrowing): "+t); throw Exceptions.propagate(t); } } return Response.status(Status.CREATED).entity(result).build(); }  @Override @Consumes(MediaType.MULTIPART_FORM_DATA) Response createFromMultipart(InputStream uploadedInputStream, FormDataContentDisposition fileDetail); @Override Response create(String yaml); @SuppressWarnings("deprecation") @Override Response resetXml(String xml, boolean ignoreErrors); @Override @Deprecated void deleteEntity(String entityId); @Override void deleteApplication(String symbolicName, String version); @Override void deleteEntity(String symbolicName, String version); @Override void deletePolicy(String policyId, String version); @Override void deleteLocation(String locationId, String version); @Override List<CatalogEntitySummary> listEntities(String regex, String fragment, boolean allVersions); @Override List<CatalogItemSummary> listApplications(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogEntitySummary getEntity(String entityId); @Override CatalogEntitySummary getEntity(String symbolicName, String version); @Override @Deprecated CatalogEntitySummary getApplication(String applicationId); @Override CatalogEntitySummary getApplication(String symbolicName, String version); @Override List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogPolicySummary getPolicy(String policyId); @Override CatalogPolicySummary getPolicy(String policyId, String version); @Override List<CatalogLocationSummary> listLocations(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogLocationSummary getLocation(String locationId); @Override CatalogLocationSummary getLocation(String locationId, String version); @Override @Deprecated Response getIcon(String itemId); @Override Response getIcon(String itemId, String version); @Override void setDeprecatedLegacy(String itemId, boolean deprecated); @SuppressWarnings("deprecation") @Override void setDeprecated(String itemId, boolean deprecated); @SuppressWarnings("deprecation") @Override void setDisabled(String itemId, boolean disabled); }
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @Override public Response create(String yaml) { if (!Entitlements.isEntitled(mgmt().getEntitlementManager(), Entitlements.ADD_CATALOG_ITEM, yaml)) { throw WebResourceUtils.unauthorized("User '%s' is not authorized to add catalog item", Entitlements.getEntitlementContext().user()); } Iterable<? extends CatalogItem<?, ?>> items; try { items = brooklyn().getCatalog().addItems(yaml); } catch (IllegalArgumentException e) { return Response.status(Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(ApiError.of(e)) .build(); } log.info("REST created catalog items: "+items); Map<String,Object> result = MutableMap.of(); for (CatalogItem<?,?> item: items) { try { result.put(item.getId(), CatalogTransformer.catalogItemSummary(brooklyn(), item)); } catch (Throwable t) { log.warn("Error loading catalog item '"+item+"' (rethrowing): "+t); throw Exceptions.propagate(t); } } return Response.status(Status.CREATED).entity(result).build(); }  @Override @Consumes(MediaType.MULTIPART_FORM_DATA) Response createFromMultipart(InputStream uploadedInputStream, FormDataContentDisposition fileDetail); @Override Response create(String yaml); @SuppressWarnings("deprecation") @Override Response resetXml(String xml, boolean ignoreErrors); @Override @Deprecated void deleteEntity(String entityId); @Override void deleteApplication(String symbolicName, String version); @Override void deleteEntity(String symbolicName, String version); @Override void deletePolicy(String policyId, String version); @Override void deleteLocation(String locationId, String version); @Override List<CatalogEntitySummary> listEntities(String regex, String fragment, boolean allVersions); @Override List<CatalogItemSummary> listApplications(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogEntitySummary getEntity(String entityId); @Override CatalogEntitySummary getEntity(String symbolicName, String version); @Override @Deprecated CatalogEntitySummary getApplication(String applicationId); @Override CatalogEntitySummary getApplication(String symbolicName, String version); @Override List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogPolicySummary getPolicy(String policyId); @Override CatalogPolicySummary getPolicy(String policyId, String version); @Override List<CatalogLocationSummary> listLocations(String regex, String fragment, boolean allVersions); @Override @Deprecated CatalogLocationSummary getLocation(String locationId); @Override CatalogLocationSummary getLocation(String locationId, String version); @Override @Deprecated Response getIcon(String itemId); @Override Response getIcon(String itemId, String version); @Override void setDeprecatedLegacy(String itemId, boolean deprecated); @SuppressWarnings("deprecation") @Override void setDeprecated(String itemId, boolean deprecated); @SuppressWarnings("deprecation") @Override void setDisabled(String itemId, boolean disabled);  }