You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/06/03 16:35:47 UTC

[pulsar] branch master updated: Update argument description of web service (#4390)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new d7cef10  Update argument description of web service (#4390)
d7cef10 is described below

commit d7cef10a411ace5c00597cd2ef961c1c3df3baa3
Author: Yong Zhang <zh...@gmail.com>
AuthorDate: Tue Jun 4 00:35:42 2019 +0800

    Update argument description of web service (#4390)
    
    * Update argument description of web service
    
    * Fix http status 500 description
---
 .../pulsar/broker/admin/impl/BrokersBase.java      | 46 ++++++++++++++--------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
index e7dfca9..af98860 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/BrokersBase.java
@@ -73,9 +73,16 @@ public class BrokersBase extends AdminResource {
 
     @GET
     @Path("/{cluster}")
-    @ApiOperation(value = "Get the list of active brokers (web service addresses) in the cluster.", response = String.class, responseContainer = "Set")
-    @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
-            @ApiResponse(code = 404, message = "Cluster doesn't exist") })
+    @ApiOperation(
+        value = "Get the list of active brokers (web service addresses) in the cluster."
+                + "If authorization is not enabled, any cluster name is valid.",
+        response = String.class,
+        responseContainer = "Set")
+    @ApiResponses(
+        value = {
+            @ApiResponse(code = 401, message = "Authentication required"),
+            @ApiResponse(code = 403, message = "This operation requires super-user access"),
+            @ApiResponse(code = 404, message = "Cluster does not exist: cluster={clustername}") })
     public Set<String> getActiveBrokers(@PathParam("cluster") String cluster) throws Exception {
         validateSuperUserAccess();
         validateClusterOwnership(cluster);
@@ -90,12 +97,13 @@ public class BrokersBase extends AdminResource {
     }
 
     @GET
-    @Path("/{cluster}/{broker}/ownedNamespaces")
+    @Path("/{clusterName}/{broker-webserviceurl}/ownedNamespaces")
     @ApiOperation(value = "Get the list of namespaces served by the specific broker", response = NamespaceOwnershipStatus.class, responseContainer = "Map")
-    @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
-            @ApiResponse(code = 404, message = "Cluster doesn't exist") })
-    public Map<String, NamespaceOwnershipStatus> getOwnedNamespaes(@PathParam("cluster") String cluster,
-            @PathParam("broker") String broker) throws Exception {
+    @ApiResponses(value = {
+        @ApiResponse(code = 403, message = "Don't have admin permission"),
+        @ApiResponse(code = 404, message = "Cluster doesn't exist") })
+    public Map<String, NamespaceOwnershipStatus> getOwnedNamespaes(@PathParam("clusterName") String cluster,
+            @PathParam("broker-webserviceurl") String broker) throws Exception {
         validateSuperUserAccess();
         validateClusterOwnership(cluster);
         validateBrokerName(broker);
@@ -113,10 +121,12 @@ public class BrokersBase extends AdminResource {
     @POST
     @Path("/configuration/{configName}/{configValue}")
     @ApiOperation(value = "Update dynamic serviceconfiguration into zk only. This operation requires Pulsar super-user privileges.")
-    @ApiResponses(value = { @ApiResponse(code = 204, message = "Service configuration updated successfully"),
-            @ApiResponse(code = 403, message = "You don't have admin permission to update service-configuration"),
-            @ApiResponse(code = 404, message = "Configuration not found"),
-            @ApiResponse(code = 412, message = "Configuration can't be updated dynamically") })
+    @ApiResponses(value = {
+        @ApiResponse(code = 204, message = "Service configuration updated successfully"),
+        @ApiResponse(code = 403, message = "You don't have admin permission to update service-configuration"),
+        @ApiResponse(code = 404, message = "Configuration not found"),
+        @ApiResponse(code = 412, message = "Invalid dynamic-config value"),
+        @ApiResponse(code = 500, message = "Internal server error")})
     public void updateDynamicConfiguration(@PathParam("configName") String configName, @PathParam("configValue") String configValue) throws Exception {
         validateSuperUserAccess();
         updateDynamicConfigurationOnZk(configName, configValue);
@@ -125,7 +135,9 @@ public class BrokersBase extends AdminResource {
     @GET
     @Path("/configuration/values")
     @ApiOperation(value = "Get value of all dynamic configurations' value overridden on local config")
-    @ApiResponses(value = { @ApiResponse(code = 404, message = "Configuration not found") })
+    @ApiResponses(value = {
+        @ApiResponse(code = 404, message = "Configuration not found"),
+        @ApiResponse(code = 500, message = "Internal server error")})
     public Map<String, String> getAllDynamicConfigurations() throws Exception {
         ZooKeeperDataCache<Map<String, String>> dynamicConfigurationCache = pulsar().getBrokerService()
                 .getDynamicConfigurationCache();
@@ -223,9 +235,11 @@ public class BrokersBase extends AdminResource {
     @GET
     @Path("/health")
     @ApiOperation(value = "Run a healthcheck against the broker")
-    @ApiResponses(value = { @ApiResponse(code = 200, message = "Everything is OK"),
-                            @ApiResponse(code = 403, message = "Don't have admin permission"),
-                            @ApiResponse(code = 404, message = "Cluster doesn't exist") })
+    @ApiResponses(value = {
+        @ApiResponse(code = 200, message = "Everything is OK"),
+        @ApiResponse(code = 403, message = "Don't have admin permission"),
+        @ApiResponse(code = 404, message = "Cluster doesn't exist"),
+        @ApiResponse(code = 500, message = "Internal server error")})
     public void healthcheck(@Suspended AsyncResponse asyncResponse) throws Exception {
         validateSuperUserAccess();
         String heartbeatNamespace = NamespaceService.getHeartbeatNamespace(