Github user tbouron commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/485#discussion_r106949452
--- Diff:
rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java ---
@@ -38,27 +38,60 @@
import org.apache.brooklyn.rest.domain.CatalogLocationSummary;
import org.apache.brooklyn.rest.domain.CatalogPolicySummary;
+import com.google.common.annotations.Beta;
+
import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
@Path("/catalog")
@Api("Catalog")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface CatalogApi {
- @Consumes
+ @Deprecated /** @deprecated since 0.11.0 use {@link
#createFromYaml(String)} instead */
+ public Response create(String yaml);
+
+ @Consumes({MediaType.APPLICATION_JSON, "application/x-yaml",
+ // see http://stackoverflow.com/questions/332129/yaml-mime-type
+ "text/yaml", "text/x-yaml", "application/yaml"})
@POST
- @ApiOperation(value = "Add a catalog item (e.g. new type of entity,
policy or location) by uploading YAML descriptor "
+ @ApiOperation(value = "Add a catalog item (e.g. new type of entity,
policy or location) by uploading YAML descriptor. "
+ "Return value is map of ID to CatalogItemSummary, with code 201
CREATED.", response = String.class)
- public Response create(
+ public Response createFromYaml(
@ApiParam(name = "yaml", value = "YAML descriptor of catalog
item", required = true)
@Valid String yaml);
@POST
+ @Beta
+ @Consumes // anything (if doesn't match other methods with specific
content types
+ @ApiOperation(value = "Add items to the catalog, either YAML or
JAR/ZIP, format autodetected. "
+ + "Specify a content-type header to skip auto-detection and
invoke one of the more specific methods. "
+ + "Return value is 201 CREATED if bundle could be added.",
response = String.class)
+ public Response createPoly(
+ @ApiParam(
+ name = "item",
+ value = "Item to install, as JAR/ZIP or Catalog YAML
(autodetected)",
+ required = true)
+ byte[] item);
+
+ @POST
+ @Beta
+ @Consumes({"application/x-zip", "application/x-jar"})
+ @ApiOperation(value = "Add a catalog item (e.g. new type of entity,
policy or location) by uploading OSGi bundle JAR, or ZIP which will be turned
into bundle JAR, "
+ + "containing catalog.bom containing bundle name and version. "
+ + "Return value is 201 CREATED if bundle could be added.",
response = String.class)
+ public Response createFromArchive(
--- End diff --
This returns a 500 is case there is an issue with the archive. Should be
400 instead as this is because of a bad request
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---