Skip to content

Commit

Permalink
[improve][rest] Add lookup REST Api swagger docs describe (apache#16470)
Browse files Browse the repository at this point in the history
  • Loading branch information
shibd authored and weimob-wuxuanqi committed Jul 14, 2022
1 parent 15577ce commit 8ea7eb9
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.pulsar.broker.lookup.v2;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import javax.ws.rs.DefaultValue;
Expand All @@ -34,9 +36,11 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.pulsar.broker.lookup.TopicLookupBase;
import org.apache.pulsar.common.lookup.data.LookupData;
import org.apache.pulsar.common.naming.TopicName;

@Path("/v2/topic")
@Api(value = "lookup", tags = "lookup")
@Slf4j
public class TopicLookup extends TopicLookupBase {

Expand All @@ -45,6 +49,10 @@ public class TopicLookup extends TopicLookupBase {
@GET
@Path("{topic-domain}/{tenant}/{namespace}/{topic}")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Get the owner broker of the given topic.",
response = LookupData.class
)
@ApiResponses(value = { @ApiResponse(code = 307,
message = "Current broker doesn't serve the namespace of this topic") })
public void lookupTopicAsync(
Expand Down Expand Up @@ -72,6 +80,10 @@ public void lookupTopicAsync(
@GET
@Path("{topic-domain}/{tenant}/{namespace}/{topic}/bundle")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
value = "Get the namespace bundle which the given topic belongs to.",
response = String.class
)
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
@ApiResponse(code = 405, message = "Invalid topic domain type") })
public String getNamespaceBundle(@PathParam("topic-domain") String topicDomain,
Expand Down

0 comments on commit 8ea7eb9

Please sign in to comment.