Search in sources :

Example 31 with Summary

use of com.linkedin.pinot.common.restlet.swagger.Summary in project pinot by linkedin.

the class PinotTenantRestletResource method createTenant.

@HttpVerb("post")
@Summary("Creates a tenant")
@Tags({ "tenant" })
@Paths({ "/tenants", "/tenants/" })
private StringRepresentation createTenant(Tenant tenant) {
    PinotResourceManagerResponse response;
    StringRepresentation presentation;
    switch(tenant.getTenantRole()) {
        case BROKER:
            response = _pinotHelixResourceManager.createBrokerTenant(tenant);
            presentation = new StringRepresentation(response.toString());
            break;
        case SERVER:
            response = _pinotHelixResourceManager.createServerTenant(tenant);
            presentation = new StringRepresentation(response.toString());
            break;
        default:
            throw new RuntimeException("Not a valid tenant creation call");
    }
    return presentation;
}
Also used : StringRepresentation(org.restlet.representation.StringRepresentation) PinotResourceManagerResponse(com.linkedin.pinot.controller.helix.core.PinotResourceManagerResponse) Summary(com.linkedin.pinot.common.restlet.swagger.Summary) HttpVerb(com.linkedin.pinot.common.restlet.swagger.HttpVerb) Paths(com.linkedin.pinot.common.restlet.swagger.Paths) Tags(com.linkedin.pinot.common.restlet.swagger.Tags)

Example 32 with Summary

use of com.linkedin.pinot.common.restlet.swagger.Summary in project pinot by linkedin.

the class PinotTenantRestletResource method getAllTenants.

@HttpVerb("get")
@Summary("Gets information about all tenants")
@Tags({ "tenant" })
@Paths({ "/tenants", "/tenants/" })
private StringRepresentation getAllTenants(@Parameter(name = "type", in = "query", description = "The type of tenant, either SERVER or BROKER") String type) throws JSONException {
    // Return all the tags.
    StringRepresentation presentation;
    final JSONObject ret = new JSONObject();
    if (type == null || type.equalsIgnoreCase("server")) {
        ret.put("SERVER_TENANTS", _pinotHelixResourceManager.getAllServerTenantNames());
    }
    if (type == null || type.equalsIgnoreCase("broker")) {
        ret.put("BROKER_TENANTS", _pinotHelixResourceManager.getAllBrokerTenantNames());
    }
    presentation = new StringRepresentation(ret.toString(), MediaType.APPLICATION_JSON);
    return presentation;
}
Also used : JSONObject(org.json.JSONObject) StringRepresentation(org.restlet.representation.StringRepresentation) Summary(com.linkedin.pinot.common.restlet.swagger.Summary) HttpVerb(com.linkedin.pinot.common.restlet.swagger.HttpVerb) Paths(com.linkedin.pinot.common.restlet.swagger.Paths) Tags(com.linkedin.pinot.common.restlet.swagger.Tags)

Aggregations

HttpVerb (com.linkedin.pinot.common.restlet.swagger.HttpVerb)32 Paths (com.linkedin.pinot.common.restlet.swagger.Paths)32 Summary (com.linkedin.pinot.common.restlet.swagger.Summary)32 Tags (com.linkedin.pinot.common.restlet.swagger.Tags)31 StringRepresentation (org.restlet.representation.StringRepresentation)30 Responses (com.linkedin.pinot.common.restlet.swagger.Responses)14 JSONObject (org.json.JSONObject)10 JSONArray (org.json.JSONArray)9 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)7 Schema (com.linkedin.pinot.common.data.Schema)5 PinotResourceManagerResponse (com.linkedin.pinot.controller.helix.core.PinotResourceManagerResponse)5 File (java.io.File)5 IOException (java.io.IOException)4 JSONException (org.json.JSONException)4 FileRepresentation (org.restlet.representation.FileRepresentation)3 Representation (org.restlet.representation.Representation)3 Description (com.linkedin.pinot.common.restlet.swagger.Description)2 JSONArray (com.alibaba.fastjson.JSONArray)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 OfflineTableConfig (com.linkedin.pinot.common.config.OfflineTableConfig)1