use of com.linkedin.pinot.common.restlet.swagger.HttpVerb 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;
}
use of com.linkedin.pinot.common.restlet.swagger.HttpVerb 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;
}
Aggregations