Use project_id instead of project_uuid for the API.

This commit is contained in:
Jeremy committed 2015-02-03 18:40:13 -07:00
1 parent d2699f051d
commit 59c82e26df
8 files changed
+30 -30

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ class VPCSHandler:
vpcs = VPCS.instance()
vm = yield from vpcs.create_vm(request.json["name"],
request.json["project_uuid"],
request.json["project_id"],
request.json.get("uuid"),
console=request.json.get("console"),
startup_script=request.json.get("startup_script"))
+7 -7
View File
@@ -42,23 +42,23 @@ class ProjectManager:
cls._instance = cls()
return cls._instance
def get_project(self, project_uuid):
def get_project(self, uuid):
"""
Returns a Project instance.
:param project_uuid: Project UUID
:param uuid: Project UUID
:returns: Project instance
"""
try:
UUID(project_uuid, version=4)
UUID(uuid, version=4)
except ValueError:
raise aiohttp.web.HTTPBadRequest(text="{} is not a valid UUID".format(project_uuid))
raise aiohttp.web.HTTPBadRequest(text="{} is not a valid UUID".format(uuid))
if project_uuid not in self._projects:
raise aiohttp.web.HTTPNotFound(text="Project UUID {} doesn't exist".format(project_uuid))
return self._projects[project_uuid]
if uuid not in self._projects:
raise aiohttp.web.HTTPNotFound(text="Project UUID {} doesn't exist".format(uuid))
return self._projects[uuid]
def create_project(self, **kwargs):
"""
@@ -79,7 +79,7 @@ class VirtualBoxVM(BaseVM):
return {"name": self.name,
"uuid": self.uuid,
"console": self.console,
"project_uuid": self.project.uuid,
"project_id": self.project.uuid,
"vmname": self.vmname,
"headless": self.headless,
"enable_remote_console": self.enable_remote_console,
+1 -1
View File
@@ -107,7 +107,7 @@ class VPCSVM(BaseVM):
return {"name": self.name,
"uuid": self.uuid,
"console": self._console,
"project_uuid": self.project.uuid,
"project_id": self.project.uuid,
"script_file": self.script_file,
"startup_script": self.startup_script}
+4 -4
View File
@@ -32,7 +32,7 @@ VBOX_CREATE_SCHEMA = {
"description": "VirtualBox VM instance ID (for project created before GNS3 1.3)",
"type": "integer"
},
"project_uuid": {
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
@@ -86,7 +86,7 @@ VBOX_CREATE_SCHEMA = {
},
},
"additionalProperties": False,
"required": ["name", "vmname", "linked_clone", "project_uuid"],
"required": ["name", "vmname", "linked_clone", "project_id"],
}
VBOX_UPDATE_SCHEMA = {
@@ -211,7 +211,7 @@ VBOX_OBJECT_SCHEMA = {
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_uuid": {
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
@@ -256,5 +256,5 @@ VBOX_OBJECT_SCHEMA = {
},
},
"additionalProperties": False,
"required": ["name", "uuid", "project_uuid"]
"required": ["name", "uuid", "project_id"]
}
+4 -4
View File
@@ -37,7 +37,7 @@ VPCS_CREATE_SCHEMA = {
"maxLength": 36,
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"project_uuid": {
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
@@ -56,7 +56,7 @@ VPCS_CREATE_SCHEMA = {
},
},
"additionalProperties": False,
"required": ["name", "project_uuid"]
"required": ["name", "project_id"]
}
VPCS_UPDATE_SCHEMA = {
@@ -162,7 +162,7 @@ VPCS_OBJECT_SCHEMA = {
"maximum": 65535,
"type": "integer"
},
"project_uuid": {
"project_id": {
"description": "Project UUID",
"type": "string",
"minLength": 36,
@@ -179,5 +179,5 @@ VPCS_OBJECT_SCHEMA = {
},
},
"additionalProperties": False,
"required": ["name", "uuid", "console", "project_uuid"]
"required": ["name", "uuid", "console", "project_id"]
}