projects
/
osm
/
NBI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
NBI Quotas
[osm/NBI.git]
/
osm_nbi
/
validation.py
diff --git
a/osm_nbi/validation.py
b/osm_nbi/validation.py
index
b6ef64c
..
6e43be5
100644
(file)
--- a/
osm_nbi/validation.py
+++ b/
osm_nbi/validation.py
@@
-631,6
+631,7
@@
user_edit_schema = {
}
# PROJECTS
}
# PROJECTS
+topics_with_quota = ["vnfds", "nsds", "nsts", "pdus", "nsrs", "nsis", "vim_accounts", "wim_accounts", "sdns"]
project_new_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "New project schema for administrators",
project_new_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "New project schema for administrators",
@@
-638,6
+639,11
@@
project_new_schema = {
"properties": {
"name": shortname_schema,
"admin": bool_schema,
"properties": {
"name": shortname_schema,
"admin": bool_schema,
+ "quotas": {
+ "type": "object",
+ "properties": {topic: integer0_schema for topic in topics_with_quota},
+ "additionalProperties": False
+ },
},
"required": ["name"],
"additionalProperties": False
},
"required": ["name"],
"additionalProperties": False
@@
-649,6
+655,11
@@
project_edit_schema = {
"properties": {
"admin": bool_schema,
"name": shortname_schema, # To allow Project Name modification
"properties": {
"admin": bool_schema,
"name": shortname_schema, # To allow Project Name modification
+ "quotas": {
+ "type": "object",
+ "properties": {topic: {"oneOf": [integer0_schema, null_schema]} for topic in topics_with_quota},
+ "additionalProperties": False
+ },
},
"additionalProperties": False,
"minProperties": 1
},
"additionalProperties": False,
"minProperties": 1
@@
-807,5
+818,5
@@
def is_valid_uuid(x):
try:
if UUID(x):
return True
try:
if UUID(x):
return True
- except (TypeError, ValueError):
+ except (TypeError, ValueError
, AttributeError
):
return False
return False