ONOS-2486 Adding swagger-based REST API documentation.
Change-Id: I237d973d73549ad30ddc638c1c201f024d344c70
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
index 690637e..ee608b7 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
@@ -37,19 +37,32 @@
import static org.onlab.util.Tools.nullIsNotFound;
/**
- * REST resource for interacting with the ONOS cluster subsystem.
+ * Manage cluster of ONOS instances.
*/
@Path("cluster")
public class ClusterWebResource extends AbstractWebResource {
public static final String NODE_NOT_FOUND = "Node is not found";
+ /**
+ * Get all cluster nodes.
+ * Returns array of all cluster nodes.
+ *
+ * @return 200 OK
+ */
@GET
public Response getClusterNodes() {
Iterable<ControllerNode> nodes = get(ClusterService.class).getNodes();
return ok(encodeArray(ControllerNode.class, "nodes", nodes)).build();
}
+ /**
+ * Get cluster node details.
+ * Returns details of the specified cluster node.
+ *
+ * @param id cluster node identifier
+ * @return 200 OK
+ */
@GET
@Path("{id}")
public Response getClusterNode(@PathParam("id") String id) {
@@ -58,6 +71,13 @@
return ok(codec(ControllerNode.class).encode(node, this)).build();
}
+ /**
+ * Forms cluster of ONOS instances.
+ * Forms ONOS cluster using the uploaded JSON definition.
+ *
+ * @param config cluster definition
+ * @return 200 OK
+ */
@POST
@Path("configuration")
public Response formCluster(InputStream config) throws IOException {