Shape => Drawing

This commit is contained in:
Julien Duponchelle committed 2016-06-23 11:17:23 +02:00
1 parent c847755f1b
commit 852d8e411e
21 files changed
+181 -181

No files matched your search

@@ -1,6 +1,6 @@
curl -i -X DELETE 'http://localhost:3080/v2/projects/6b74fe6e-f65a-46a9-84a9-1db0cd42a9d2/shapes/6e313846-5d8f-4dcc-a231-e2dd9406bb71'
curl -i -X DELETE 'http://localhost:3080/v2/projects/6b74fe6e-f65a-46a9-84a9-1db0cd42a9d2/drawings/6e313846-5d8f-4dcc-a231-e2dd9406bb71'
DELETE /v2/projects/6b74fe6e-f65a-46a9-84a9-1db0cd42a9d2/shapes/6e313846-5d8f-4dcc-a231-e2dd9406bb71 HTTP/1.1
DELETE /v2/projects/6b74fe6e-f65a-46a9-84a9-1db0cd42a9d2/drawings/6e313846-5d8f-4dcc-a231-e2dd9406bb71 HTTP/1.1
@@ -8,5 +8,5 @@ HTTP/1.1 204
CONTENT-LENGTH: 0
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.5 GNS3/2.0.0dev1
X-ROUTE: /v2/projects/{project_id}/shapes/{shape_id}
X-ROUTE: /v2/projects/{project_id}/drawings/{drawing_id}
@@ -1,6 +1,6 @@
curl -i -X GET 'http://localhost:3080/v2/projects/0bb34c74-e696-46b5-9c94-d00e3f55da18/shapes'
curl -i -X GET 'http://localhost:3080/v2/projects/0bb34c74-e696-46b5-9c94-d00e3f55da18/drawings'
GET /v2/projects/0bb34c74-e696-46b5-9c94-d00e3f55da18/shapes HTTP/1.1
GET /v2/projects/0bb34c74-e696-46b5-9c94-d00e3f55da18/drawings HTTP/1.1
@@ -9,13 +9,13 @@ CONTENT-LENGTH: 361
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.5 GNS3/2.0.0dev1
X-ROUTE: /v2/projects/{project_id}/shapes
X-ROUTE: /v2/projects/{project_id}/drawings
[
{
"project_id": "0bb34c74-e696-46b5-9c94-d00e3f55da18",
"rotation": 0,
"shape_id": "a0690cd5-6460-464e-b599-7980f5c08e67",
"drawing_id": "a0690cd5-6460-464e-b599-7980f5c08e67",
"svg": "<svg height=\"210\" width=\"500\"><line x1=\"0\" y1=\"0\" x2=\"200\" y2=\"200\" style=\"stroke:rgb(255,0,0);stroke-width:2\" /></svg>",
"x": 10,
"y": 20,
@@ -1,6 +1,6 @@
curl -i -X POST 'http://localhost:3080/v2/projects/e82d1e06-4235-41dc-9a57-0cd0672692f0/shapes' -d '{"svg": "<svg height=\"210\" width=\"500\"><line x1=\"0\" y1=\"0\" x2=\"200\" y2=\"200\" style=\"stroke:rgb(255,0,0);stroke-width:2\" /></svg>", "x": 10, "y": 20, "z": 0}'
curl -i -X POST 'http://localhost:3080/v2/projects/e82d1e06-4235-41dc-9a57-0cd0672692f0/drawings' -d '{"svg": "<svg height=\"210\" width=\"500\"><line x1=\"0\" y1=\"0\" x2=\"200\" y2=\"200\" style=\"stroke:rgb(255,0,0);stroke-width:2\" /></svg>", "x": 10, "y": 20, "z": 0}'
POST /v2/projects/e82d1e06-4235-41dc-9a57-0cd0672692f0/shapes HTTP/1.1
POST /v2/projects/e82d1e06-4235-41dc-9a57-0cd0672692f0/drawings HTTP/1.1
{
"svg": "<svg height=\"210\" width=\"500\"><line x1=\"0\" y1=\"0\" x2=\"200\" y2=\"200\" style=\"stroke:rgb(255,0,0);stroke-width:2\" /></svg>",
"x": 10,
@@ -14,12 +14,12 @@ CONTENT-LENGTH: 321
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.5 GNS3/2.0.0dev1
X-ROUTE: /v2/projects/{project_id}/shapes
X-ROUTE: /v2/projects/{project_id}/drawings
{
"project_id": "e82d1e06-4235-41dc-9a57-0cd0672692f0",
"rotation": 0,
"shape_id": "66594d41-524e-4dfd-a07b-3186ed392c86",
"drawing_id": "66594d41-524e-4dfd-a07b-3186ed392c86",
"svg": "<svg height=\"210\" width=\"500\"><line x1=\"0\" y1=\"0\" x2=\"200\" y2=\"200\" style=\"stroke:rgb(255,0,0);stroke-width:2\" /></svg>",
"x": 10,
"y": 20,
@@ -1,6 +1,6 @@
curl -i -X PUT 'http://localhost:3080/v2/projects/2312697c-8e49-40e0-9d6d-5bd6dd0679ed/shapes/dbefe2d5-79d7-4f18-b898-cd073224563c' -d '{"x": 42}'
curl -i -X PUT 'http://localhost:3080/v2/projects/2312697c-8e49-40e0-9d6d-5bd6dd0679ed/drawings/dbefe2d5-79d7-4f18-b898-cd073224563c' -d '{"x": 42}'
PUT /v2/projects/2312697c-8e49-40e0-9d6d-5bd6dd0679ed/shapes/dbefe2d5-79d7-4f18-b898-cd073224563c HTTP/1.1
PUT /v2/projects/2312697c-8e49-40e0-9d6d-5bd6dd0679ed/drawings/dbefe2d5-79d7-4f18-b898-cd073224563c HTTP/1.1
{
"x": 42
}
@@ -11,12 +11,12 @@ CONTENT-LENGTH: 321
CONTENT-TYPE: application/json
DATE: Thu, 08 Jan 2015 16:09:15 GMT
SERVER: Python/3.5 GNS3/2.0.0dev1
X-ROUTE: /v2/projects/{project_id}/shapes/{shape_id}
X-ROUTE: /v2/projects/{project_id}/drawings/{drawing_id}
{
"project_id": "2312697c-8e49-40e0-9d6d-5bd6dd0679ed",
"rotation": 0,
"shape_id": "dbefe2d5-79d7-4f18-b898-cd073224563c",
"drawing_id": "dbefe2d5-79d7-4f18-b898-cd073224563c",
"svg": "<svg height=\"210\" width=\"500\"><line x1=\"0\" y1=\"0\" x2=\"200\" y2=\"200\" style=\"stroke:rgb(255,0,0);stroke-width:2\" /></svg>",
"x": 42,
"y": 20,
+2 -2
View File
@@ -1,8 +1,8 @@
Shape
Drawing
-----------------------------
.. toctree::
:glob:
:maxdepth: 2
shape/*
drawing/*
@@ -1,11 +1,11 @@
/v2/projects/{project_id}/shapes
/v2/projects/{project_id}/drawings
------------------------------------------------------------------------------------------------------------------------------------------
.. contents::
GET /v2/projects/**{project_id}**/shapes
GET /v2/projects/**{project_id}**/drawings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
List shapes of a project
List drawings of a project
Parameters
**********
@@ -13,18 +13,18 @@ Parameters
Response status codes
**********************
- **200**: List of shapes returned
- **200**: List of drawings returned
Sample session
***************
.. literalinclude:: ../../../examples/controller_get_projectsprojectidshapes.txt
.. literalinclude:: ../../../examples/controller_get_projectsprojectiddrawings.txt
POST /v2/projects/**{project_id}**/shapes
POST /v2/projects/**{project_id}**/drawings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create a new shape instance
Create a new drawing instance
Parameters
**********
@@ -33,7 +33,7 @@ Parameters
Response status codes
**********************
- **400**: Invalid request
- **201**: Shape created
- **201**: Drawing created
Input
*******
@@ -43,8 +43,8 @@ Input
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>project_id</td> <td> </td> <td>string</td> <td>Project UUID</td> </tr>
<tr><td>rotation</td> <td> </td> <td>integer</td> <td>Rotation of the element</td> </tr>
<tr><td>shape_id</td> <td> </td> <td>string</td> <td>Shape UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the shape</td> </tr>
<tr><td>drawing_id</td> <td> </td> <td>string</td> <td>Drawing UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the drawing</td> </tr>
<tr><td>x</td> <td> </td> <td>integer</td> <td>X property</td> </tr>
<tr><td>y</td> <td> </td> <td>integer</td> <td>Y property</td> </tr>
<tr><td>z</td> <td> </td> <td>integer</td> <td>Z property</td> </tr>
@@ -58,8 +58,8 @@ Output
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>project_id</td> <td> </td> <td>string</td> <td>Project UUID</td> </tr>
<tr><td>rotation</td> <td> </td> <td>integer</td> <td>Rotation of the element</td> </tr>
<tr><td>shape_id</td> <td> </td> <td>string</td> <td>Shape UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the shape</td> </tr>
<tr><td>drawing_id</td> <td> </td> <td>string</td> <td>Drawing UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the drawing</td> </tr>
<tr><td>x</td> <td> </td> <td>integer</td> <td>X property</td> </tr>
<tr><td>y</td> <td> </td> <td>integer</td> <td>Y property</td> </tr>
<tr><td>z</td> <td> </td> <td>integer</td> <td>Z property</td> </tr>
@@ -69,5 +69,5 @@ Sample session
***************
.. literalinclude:: ../../../examples/controller_post_projectsprojectidshapes.txt
.. literalinclude:: ../../../examples/controller_post_projectsprojectiddrawings.txt
@@ -1,21 +1,21 @@
/v2/projects/{project_id}/shapes/{shape_id}
/v2/projects/{project_id}/drawings/{drawing_id}
------------------------------------------------------------------------------------------------------------------------------------------
.. contents::
PUT /v2/projects/**{project_id}**/shapes/**{shape_id}**
PUT /v2/projects/**{project_id}**/drawings/**{drawing_id}**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create a new shape instance
Create a new drawing instance
Parameters
**********
- **project_id**: Project UUID
- **shape_id**: Shape UUID
- **drawing_id**: Drawing UUID
Response status codes
**********************
- **400**: Invalid request
- **201**: Shape updated
- **201**: Drawing updated
Input
*******
@@ -25,8 +25,8 @@ Input
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>project_id</td> <td> </td> <td>string</td> <td>Project UUID</td> </tr>
<tr><td>rotation</td> <td> </td> <td>integer</td> <td>Rotation of the element</td> </tr>
<tr><td>shape_id</td> <td> </td> <td>string</td> <td>Shape UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the shape</td> </tr>
<tr><td>drawing_id</td> <td> </td> <td>string</td> <td>Drawing UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the drawing</td> </tr>
<tr><td>x</td> <td> </td> <td>integer</td> <td>X property</td> </tr>
<tr><td>y</td> <td> </td> <td>integer</td> <td>Y property</td> </tr>
<tr><td>z</td> <td> </td> <td>integer</td> <td>Z property</td> </tr>
@@ -40,8 +40,8 @@ Output
<tr> <th>Name</th> <th>Mandatory</th> <th>Type</th> <th>Description</th> </tr>
<tr><td>project_id</td> <td> </td> <td>string</td> <td>Project UUID</td> </tr>
<tr><td>rotation</td> <td> </td> <td>integer</td> <td>Rotation of the element</td> </tr>
<tr><td>shape_id</td> <td> </td> <td>string</td> <td>Shape UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the shape</td> </tr>
<tr><td>drawing_id</td> <td> </td> <td>string</td> <td>Drawing UUID</td> </tr>
<tr><td>svg</td> <td> </td> <td>string</td> <td>SVG content of the drawing</td> </tr>
<tr><td>x</td> <td> </td> <td>integer</td> <td>X property</td> </tr>
<tr><td>y</td> <td> </td> <td>integer</td> <td>Y property</td> </tr>
<tr><td>z</td> <td> </td> <td>integer</td> <td>Z property</td> </tr>
@@ -51,26 +51,26 @@ Sample session
***************
.. literalinclude:: ../../../examples/controller_put_projectsprojectidshapesshapeid.txt
.. literalinclude:: ../../../examples/controller_put_projectsprojectiddrawingsdrawingid.txt
DELETE /v2/projects/**{project_id}**/shapes/**{shape_id}**
DELETE /v2/projects/**{project_id}**/drawings/**{drawing_id}**
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Delete a shape instance
Delete a drawing instance
Parameters
**********
- **project_id**: Project UUID
- **shape_id**: Shape UUID
- **drawing_id**: Drawing UUID
Response status codes
**********************
- **400**: Invalid request
- **204**: Shape deleted
- **204**: Drawing deleted
Sample session
***************
.. literalinclude:: ../../../examples/controller_delete_projectsprojectidshapesshapeid.txt
.. literalinclude:: ../../../examples/controller_delete_projectsprojectiddrawingsdrawingid.txt
+1 -1
View File
@@ -225,7 +225,7 @@ This will display a red square in the middle of your topologies:
.. code-block:: shell-session
# curl -X POST "http://localhost:3080/v2/projects/b8c070f7-f34c-4b7b-ba6f-be3d26ed073f/shapes" -d '{"x":0, "y": 12, "svg": "<svg width=\"50\" height=\"50\"><rect width=\"50\" height=\"50\" style=\"fill: #ff0000\"></rect></svg>"}'
# curl -X POST "http://localhost:3080/v2/projects/b8c070f7-f34c-4b7b-ba6f-be3d26ed073f/drawings" -d '{"x":0, "y": 12, "svg": "<svg width=\"50\" height=\"50\"><rect width=\"50\" height=\"50\" style=\"fill: #ff0000\"></rect></svg>"}'
Tips: you can embed png/jpg... by using a base64 encoding in the SVG.
+3 -3
View File
@@ -108,9 +108,9 @@ The available notification are:
* link.created
* link.updated
* link.deleted
* shape.created
* shape.updated
* shape.deleted
* drawing.created
* drawing.updated
* drawing.deleted
* log.error
* log.warning
* log.info
+2 -2
View File
@@ -6,10 +6,10 @@ Node
A Virtual Machine (Dynamips, IOU, Qemu, VPCS...), a cloud, a builtin device (switch, hub...)
Shape
Drawing
-----
Shape are visual element not used by the network emulation. Like
Drawing are visual element not used by the network emulation. Like
text, images, rectangle... They are pure SVG elements.
Adapter