@Test public void testListPolicies() { Set<CatalogPolicySummary> policies = client().resource("/v1/catalog/policies") .get(new GenericType<Set<CatalogPolicySummary>>() {}); assertTrue(policies.size() > 0); CatalogItemSummary asp = null; for (CatalogItemSummary p : policies) { if (AutoScalerPolicy.class.getName().equals(p.getType())) asp = p; } Assert.assertNotNull(asp, "didn't find AutoScalerPolicy"); }
@Override public List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions) { Predicate<CatalogItem<Policy, PolicySpec<?>>> filter = Predicates.and( CatalogPredicates.IS_POLICY, CatalogPredicates.<Policy, PolicySpec<?>>disabled(false)); List<CatalogItemSummary> result = getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment, allVersions); return castList(result, CatalogPolicySummary.class); }
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @Override public List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions) { Predicate<CatalogItem<Policy, PolicySpec<?>>> filter = Predicates.and( CatalogPredicates.IS_POLICY, CatalogPredicates.<Policy, PolicySpec<?>>disabled(false)); List<CatalogItemSummary> result = getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment, allVersions); return castList(result, CatalogPolicySummary.class); } }
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @Override public List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions) { Predicate<CatalogItem<Policy, PolicySpec<?>>> filter = Predicates.and( CatalogPredicates.IS_POLICY, CatalogPredicates.<Policy, PolicySpec<?>>disabled(false)); List<CatalogItemSummary> result = getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment, allVersions); return castList(result, CatalogPolicySummary.class); }  }
CatalogResource extends AbstractBrooklynRestResource implements CatalogApi { @Override public List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions) { Predicate<CatalogItem<Policy, PolicySpec<?>>> filter = Predicates.and( CatalogPredicates.IS_POLICY, CatalogPredicates.<Policy, PolicySpec<?>>disabled(false)); List<CatalogItemSummary> result = getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment, allVersions); return castList(result, CatalogPolicySummary.class); }  @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 List<CatalogPolicySummary> listPolicies(String regex, String fragment, boolean allVersions) { Predicate<CatalogItem<Policy, PolicySpec<?>>> filter = Predicates.and( CatalogPredicates.IS_POLICY, CatalogPredicates.<Policy, PolicySpec<?>>disabled(false)); List<CatalogItemSummary> result = getCatalogItemSummariesMatchingRegexFragment(filter, regex, fragment, allVersions); return castList(result, CatalogPolicySummary.class); }  @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);  }