brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #608: `BundleMaker` REST call allowing to add Z...
Date Thu, 23 Mar 2017 17:38:58 GMT
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/608#discussion_r107733604
  
    --- 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 createFromUpload(
    +            @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 --
    
    Would it be worth deleting this and `createFromYaml` so that Swagger on the UI had only
one endpoint to present?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message