Skip to content

Commit 140b818

Browse files
feat(api): add user quota management endpoints (reanahub#505)
Closes reanahub/reana-server#747
1 parent ae641b6 commit 140b818

File tree

1 file changed

+304
-1
lines changed

1 file changed

+304
-1
lines changed

reana_commons/openapi_specifications/reana_server.json

Lines changed: 304 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"info": {
33
"description": "Submit workflows to be run on REANA Cloud",
44
"title": "REANA Server",
5-
"version": "0.95.0a2"
5+
"version": "0.95.0a3"
66
},
77
"paths": {
88
"/account/settings/linkedaccounts/": {},
@@ -1032,6 +1032,309 @@
10321032
"summary": "Ping the server (healthcheck)"
10331033
}
10341034
},
1035+
"/api/quota": {
1036+
"get": {
1037+
"description": "This endpoint gets resource quota limits for a given user.",
1038+
"operationId": "get_quota_usage",
1039+
"parameters": [
1040+
{
1041+
"description": "REANA user quota management secret",
1042+
"in": "header",
1043+
"name": "X-Quota-Management-Secret",
1044+
"required": true,
1045+
"type": "string"
1046+
},
1047+
{
1048+
"description": "Get the quota limit by user ID (mutually exclusive with `email` and `user_access_token`)",
1049+
"in": "query",
1050+
"name": "user_id",
1051+
"required": false,
1052+
"type": "string"
1053+
},
1054+
{
1055+
"description": "Get the quota limit by user email (mutually exclusive with `user_id` and `user_access_token`)",
1056+
"in": "query",
1057+
"name": "email",
1058+
"required": false,
1059+
"type": "string"
1060+
},
1061+
{
1062+
"description": "Get the quota limit by user access token (mutually exclusive with `user_id` and `email`)",
1063+
"in": "query",
1064+
"name": "user_access_token",
1065+
"required": false,
1066+
"type": "string"
1067+
},
1068+
{
1069+
"description": "The type of resource",
1070+
"in": "query",
1071+
"name": "resource_type",
1072+
"required": true,
1073+
"type": "string"
1074+
}
1075+
],
1076+
"produces": [
1077+
"application/json"
1078+
],
1079+
"responses": {
1080+
"200": {
1081+
"description": "Request succeeded. Raw resource quota limit is returned.",
1082+
"examples": {
1083+
"application/json": {
1084+
"limit": 1000000000,
1085+
"message": "OK",
1086+
"usage": 500000000
1087+
}
1088+
},
1089+
"schema": {
1090+
"properties": {
1091+
"limit": {
1092+
"type": "number"
1093+
},
1094+
"message": {
1095+
"type": "string"
1096+
},
1097+
"usage": {
1098+
"type": "number"
1099+
}
1100+
},
1101+
"type": "object"
1102+
}
1103+
},
1104+
"400": {
1105+
"description": "Request failed. The incoming data specification seems malformed.",
1106+
"examples": {
1107+
"application/json": {
1108+
"message": "No user specified."
1109+
}
1110+
},
1111+
"schema": {
1112+
"properties": {
1113+
"message": {
1114+
"type": "string"
1115+
}
1116+
},
1117+
"type": "object"
1118+
}
1119+
},
1120+
"401": {
1121+
"description": "Request failed. Unauthorized.",
1122+
"examples": {
1123+
"application/json": {
1124+
"message": "Unauthorized"
1125+
}
1126+
},
1127+
"schema": {
1128+
"properties": {
1129+
"message": {
1130+
"type": "string"
1131+
}
1132+
},
1133+
"type": "object"
1134+
}
1135+
},
1136+
"403": {
1137+
"description": "Request failed. Forbidden.",
1138+
"examples": {
1139+
"application/json": {
1140+
"message": "Quota functionality is not enabled."
1141+
}
1142+
},
1143+
"schema": {
1144+
"properties": {
1145+
"message": {
1146+
"type": "string"
1147+
}
1148+
},
1149+
"type": "object"
1150+
}
1151+
},
1152+
"404": {
1153+
"description": "Request failed. Not found.",
1154+
"examples": {
1155+
"application/json": {
1156+
"message": "Quota functionality is not enabled."
1157+
}
1158+
},
1159+
"schema": {
1160+
"properties": {
1161+
"message": {
1162+
"type": "string"
1163+
}
1164+
},
1165+
"type": "object"
1166+
}
1167+
},
1168+
"500": {
1169+
"description": "Request failed. Internal server error.",
1170+
"examples": {
1171+
"application/json": {
1172+
"message": "Internal server error."
1173+
}
1174+
},
1175+
"schema": {
1176+
"properties": {
1177+
"message": {
1178+
"type": "string"
1179+
}
1180+
},
1181+
"type": "object"
1182+
}
1183+
}
1184+
},
1185+
"summary": "Get resource quota limits."
1186+
},
1187+
"post": {
1188+
"description": "This endpoint sets resource quota limits for a given set of users.",
1189+
"operationId": "set_quota_limit",
1190+
"parameters": [
1191+
{
1192+
"description": "REANA user quota management secret",
1193+
"in": "header",
1194+
"name": "X-Quota-Management-Secret",
1195+
"required": true,
1196+
"type": "string"
1197+
},
1198+
{
1199+
"description": "Data required to set quota limits (exactly one of `user_id` or `email` must be provided).",
1200+
"in": "body",
1201+
"name": "data",
1202+
"required": true,
1203+
"schema": {
1204+
"properties": {
1205+
"email": {
1206+
"description": "Email of the target user (mutually exclusive with `user_id`)",
1207+
"type": "string"
1208+
},
1209+
"limit": {
1210+
"description": "Raw quota limit to set",
1211+
"type": "integer"
1212+
},
1213+
"resource_type": {
1214+
"description": "Resource type to set",
1215+
"type": "string"
1216+
},
1217+
"user_id": {
1218+
"description": "ID of the target user (mutually exclusive with `email`)",
1219+
"type": "string"
1220+
}
1221+
},
1222+
"type": "object"
1223+
}
1224+
}
1225+
],
1226+
"produces": [
1227+
"application/json"
1228+
],
1229+
"responses": {
1230+
"200": {
1231+
"description": "Resource quotas successfully set.",
1232+
"examples": {
1233+
"application/json": {
1234+
"limit": 1000000000,
1235+
"message": "OK",
1236+
"usage": 500000000
1237+
}
1238+
},
1239+
"schema": {
1240+
"properties": {
1241+
"limit": {
1242+
"type": "number"
1243+
},
1244+
"message": {
1245+
"type": "string"
1246+
},
1247+
"usage": {
1248+
"type": "number"
1249+
}
1250+
},
1251+
"type": "object"
1252+
}
1253+
},
1254+
"400": {
1255+
"description": "Request failed. The incoming data specification seems malformed.",
1256+
"examples": {
1257+
"application/json": {
1258+
"message": "Invalid request."
1259+
}
1260+
},
1261+
"schema": {
1262+
"properties": {
1263+
"message": {
1264+
"type": "string"
1265+
}
1266+
},
1267+
"type": "object"
1268+
}
1269+
},
1270+
"401": {
1271+
"description": "Request failed. Unauthorized.",
1272+
"examples": {
1273+
"application/json": {
1274+
"message": "Unauthorized"
1275+
}
1276+
},
1277+
"schema": {
1278+
"properties": {
1279+
"message": {
1280+
"type": "string"
1281+
}
1282+
},
1283+
"type": "object"
1284+
}
1285+
},
1286+
"403": {
1287+
"description": "Request failed. Forbidden.",
1288+
"examples": {
1289+
"application/json": {
1290+
"message": "Quota functionality is not enabled."
1291+
}
1292+
},
1293+
"schema": {
1294+
"properties": {
1295+
"message": {
1296+
"type": "string"
1297+
}
1298+
},
1299+
"type": "object"
1300+
}
1301+
},
1302+
"404": {
1303+
"description": "Request failed. User not found.",
1304+
"examples": {
1305+
"application/json": {
1306+
"message": "User not found."
1307+
}
1308+
},
1309+
"schema": {
1310+
"properties": {
1311+
"message": {
1312+
"type": "string"
1313+
}
1314+
},
1315+
"type": "object"
1316+
}
1317+
},
1318+
"500": {
1319+
"description": "Request failed. Internal server error.",
1320+
"examples": {
1321+
"application/json": {
1322+
"message": "Quota could not be set: {error}"
1323+
}
1324+
},
1325+
"schema": {
1326+
"properties": {
1327+
"message": {
1328+
"type": "string"
1329+
}
1330+
},
1331+
"type": "object"
1332+
}
1333+
}
1334+
},
1335+
"summary": "Set resource quota limits."
1336+
}
1337+
},
10351338
"/api/secrets": {
10361339
"get": {
10371340
"description": "Get user secrets.",

0 commit comments

Comments
 (0)