You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ge...@apache.org on 2017/03/27 10:35:25 UTC
[06/12] brooklyn-server git commit: Make swagger display only the
generic method to upload a YAML of ZIP/JAR archive
Make swagger display only the generic method to upload a YAML of ZIP/JAR archive
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c93b05e5
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c93b05e5
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c93b05e5
Branch: refs/heads/master
Commit: c93b05e5a53c32ae18514f8c2541b24a14fb8999
Parents: e8cc8d2
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Fri Mar 24 11:34:48 2017 +0000
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Fri Mar 24 11:34:48 2017 +0000
----------------------------------------------------------------------
rest/rest-api/pom.xml | 2 +-
.../apache/brooklyn/rest/api/CatalogApi.java | 63 ++++++++++++++------
2 files changed, 45 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c93b05e5/rest/rest-api/pom.xml
----------------------------------------------------------------------
diff --git a/rest/rest-api/pom.xml b/rest/rest-api/pom.xml
index 7b3a05d..0c2c690 100644
--- a/rest/rest-api/pom.xml
+++ b/rest/rest-api/pom.xml
@@ -113,7 +113,7 @@
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
- <version>3.1.0</version>
+ <version>3.1.4</version>
<configuration>
<apiSources>
<apiSource>
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c93b05e5/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
----------------------------------------------------------------------
diff --git a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
index 66db391..dcfaa78 100644
--- a/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
+++ b/rest/rest-api/src/main/java/org/apache/brooklyn/rest/api/CatalogApi.java
@@ -55,41 +55,66 @@ public interface CatalogApi {
@Deprecated /** @deprecated since 0.11.0 use {@link #createFromYaml(String)} instead */
public Response create(String yaml);
+ @POST
@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. "
- + "Return value is map of ID to CatalogItemSummary, with code 201 CREATED.", response = String.class)
+ @ApiOperation(
+ value = "Add a catalog items (e.g. new type of entity, policy or location) by uploading YAML descriptor.",
+ notes = "Return value is map of ID to CatalogItemSummary.",
+ response = String.class,
+ hidden = true
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Error processing the given YAML"),
+ @ApiResponse(code = 201, message = "Catalog items added successfully")
+ })
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)
+ @ApiOperation(
+ value = "Add a catalog items (e.g. new type of entity, policy or location) by uploading a ZIP/JAR archive.",
+ notes = "Accepts either an OSGi bundle JAR, or ZIP which will be turned into bundle JAR. Bother format must "
+ + "contain a catalog.bom at the root of the archive, which must contain the bundle and version key."
+ + "Return value is map of ID to CatalogItemSummary.",
+ response = String.class,
+ hidden = true)
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Error processing the given archive, or the catalog.bom is invalid"),
+ @ApiResponse(code = 201, message = "Catalog items added successfully")
+ })
public Response createFromArchive(
@ApiParam(
name = "archive",
value = "Bundle to install, in ZIP or JAR format, requiring catalog.bom containing bundle name and version",
required = true)
byte[] archive);
+
+ @Beta
+ @POST
+ @Consumes // anything (if doesn't match other methods with specific content types
+ @ApiOperation(
+ value = "Add a catalog items (e.g. new type of entity, policy or location) by uploading either YAML or ZIP/JAR archive (format autodetected)",
+ notes = "Specify a content-type header to skip auto-detection and invoke one of the more specific methods. "
+ + "Accepts either an OSGi bundle JAR, or ZIP which will be turned into bundle JAR. Bother format must "
+ + "contain a catalog.bom at the root of the archive, which must contain the bundle and version key."
+ + "Return value is map of ID to CatalogItemSummary.",
+ response = String.class
+ )
+ @ApiResponses(value = {
+ @ApiResponse(code = 400, message = "Error processing the given archive, or the catalog.bom is invalid"),
+ @ApiResponse(code = 201, message = "Catalog items added successfully")
+ })
+ public Response createFromUpload(
+ @ApiParam(
+ name = "item",
+ value = "Item to install, as JAR/ZIP or Catalog YAML (autodetected)",
+ required = true)
+ byte[] item);
@POST
@Consumes(MediaType.APPLICATION_XML)