Revision 008c941f docs/cyclades-api-guide.rst
b/docs/cyclades-api-guide.rst | ||
---|---|---|
2205 | 2205 |
Create Network |
2206 | 2206 |
.............. |
2207 | 2207 |
|
2208 |
**POST** /networks
|
|
2208 |
This operation creates a new network
|
|
2209 | 2209 |
|
2210 |
**Normal Response Code**: 202 |
|
2210 |
==================== ====== |
|
2211 |
URI Method |
|
2212 |
==================== ====== |
|
2213 |
``/networks`` POST |
|
2214 |
==================== ====== |
|
2211 | 2215 |
|
2212 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), |
|
2213 |
unauthorized (401), badMediaType(415), badRequest (400), overLimit (413) |
|
2216 |
| |
|
2217 |
|
|
2218 |
============== ========================= |
|
2219 |
Request Header Value |
|
2220 |
============== ========================= |
|
2221 |
X-Auth-Token User authentication token |
|
2222 |
============== ========================= |
|
2223 |
|
|
2224 |
| |
|
2225 |
|
|
2226 |
The request body is json-formated and contains a collection of attributes under |
|
2227 |
the ``network`` tag, which are presented bellow: |
|
2228 |
|
|
2229 |
================== ======================= ======== ======= |
|
2230 |
Request Attributes Description Required Default |
|
2231 |
================== ======================= ======== ======= |
|
2232 |
name Network name ✔ |
|
2233 |
type Network type ✔ |
|
2234 |
dhcp If use DHCP **✘** True |
|
2235 |
cidr IPv4 CIDR **✘** 192.168.1.0/2 |
|
2236 |
cidr6 IPv6 CDIR **✘** null |
|
2237 |
gateway IPv4 gateway address **✘** null |
|
2238 |
gateway6 IPv6 gateway address **✘** null |
|
2239 |
public If a public network **✘** False |
|
2240 |
================== ======================= ======== ======= |
|
2241 |
|
|
2242 |
* **name** is a string |
|
2243 |
|
|
2244 |
* **type** can be CUSTOM, IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN |
|
2245 |
|
|
2246 |
* **dhcp** and **public** are flags |
|
2214 | 2247 |
|
2215 |
This operation asynchronously provisions a new private network.
|
|
2248 |
* **cidr**, and **gateway** are IPv4 addresses
|
|
2216 | 2249 |
|
2217 |
**Example Create Network Request: JSON**: |
|
2250 |
* **cidr6**, and **gateway6** are IPv6 addresses |
|
2251 |
|
|
2252 |
* **public** should better not be used. If True, a 403 is returned. |
|
2253 |
|
|
2254 |
**Example Create Network Request Body: JSON**: |
|
2218 | 2255 |
|
2219 | 2256 |
.. code-block:: javascript |
2220 | 2257 |
|
2221 | 2258 |
{ |
2222 |
"network": { |
|
2223 |
"name": "private_net", |
|
2224 |
} |
|
2259 |
"network": {"name": "private_net", "type": "MAC_FILTERED"} |
|
2225 | 2260 |
} |
2226 | 2261 |
|
2262 |
| |
|
2263 |
|
|
2264 |
=========================== ===================== |
|
2265 |
Return Code Description |
|
2266 |
=========================== ===================== |
|
2267 |
202 (OK) Request succeeded |
|
2268 |
400 (Bad Request) Malformed network id or request |
|
2269 |
401 (Unauthorized) Missing or expired user token |
|
2270 |
403 (Forbidden) Public network is forbidden |
|
2271 |
404 (Not Found) Network not found |
|
2272 |
413 (Over Limit) Reached networks limit |
|
2273 |
415 (Bad Media Type) Bad network type |
|
2274 |
500 (Internal Server Error) The request cannot be completed because of an |
|
2275 |
internal error |
|
2276 |
503 (Service Unavailable) Failed to allocated network resources |
|
2277 |
=========================== ===================== |
|
2278 |
|
|
2279 |
In case of a 202 code, the operation asynchronously provisions a new private |
|
2280 |
network and the response body consists of a collection of |
|
2281 |
`network attributes <#network-red>`_. |
|
2282 |
|
|
2227 | 2283 |
**Example Create Network Response: JSON**: |
2228 | 2284 |
|
2229 | 2285 |
.. code-block:: javascript |
2230 | 2286 |
|
2231 | 2287 |
{ |
2232 |
"network": { |
|
2233 |
"id": 3, |
|
2234 |
"name": "private_net", |
|
2235 |
"created": "2011-04-20T15:31:08.199640+00:00", |
|
2236 |
"servers": { |
|
2237 |
"values": [] |
|
2238 |
} |
|
2239 |
} |
|
2288 |
"network": { |
|
2289 |
"status": "PENDING", |
|
2290 |
"updated": "2013-04-25T13:31:17.165237+00:00", |
|
2291 |
"name": "my private network", |
|
2292 |
"created": "2013-04-25T13:31:17.165088+00:00", |
|
2293 |
"cidr6": null, |
|
2294 |
"id": "6567", |
|
2295 |
"gateway6": null, |
|
2296 |
"public": false, |
|
2297 |
"dhcp": false, |
|
2298 |
"cidr": "192.168.1.0/24", |
|
2299 |
"type": "MAC_FILTERED", |
|
2300 |
"gateway": null, |
|
2301 |
"attachments": {"values": []} |
|
2302 |
} |
|
2240 | 2303 |
} |
2241 | 2304 |
|
2242 |
**Example Create Network Response: XML**: |
|
2243 | 2305 |
|
2244 |
.. code-block:: xml |
|
2306 |
Get Network Details |
|
2307 |
................... |
|
2245 | 2308 |
|
2246 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2247 |
<network xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" |
|
2248 |
id="2" name="foob" created="2011-04-20T15:31:08.199640+00:00"> |
|
2249 |
<servers> |
|
2250 |
</servers> |
|
2251 |
</network> |
|
2309 |
========================== ====== |
|
2310 |
URI Method |
|
2311 |
========================== ====== |
|
2312 |
``/networks/<network-id>`` GET |
|
2313 |
========================== ====== |
|
2252 | 2314 |
|
2315 |
* **network-id** is the identifier of the network |
|
2253 | 2316 |
|
2254 |
Get Network Details |
|
2255 |
................... |
|
2317 |
| |
|
2256 | 2318 |
|
2257 |
**GET** /networks/*id* |
|
2319 |
============== ========================= |
|
2320 |
Request Header Value |
|
2321 |
============== ========================= |
|
2322 |
X-Auth-Token User authentication token |
|
2323 |
============== ========================= |
|
2258 | 2324 |
|
2259 |
**Normal Response Codes**: 200, 203
|
|
2325 |
|
|
|
2260 | 2326 |
|
2261 |
**Error Response Codes**: computeFault (400, 500), serviceUnavailable (503), |
|
2262 |
unauthorized (401), badRequest (400), itemNotFound (404), overLimit (413) |
|
2327 |
=========================== ===================== |
|
2328 |
Return Code Description |
|
2329 |
=========================== ===================== |
|
2330 |
200 (OK) Request succeeded |
|
2331 |
400 (Bad Request) Malformed request or network id |
|
2332 |
401 (Unauthorized) Missing or expired user token |
|
2333 |
404 (Not Found) Network not found |
|
2334 |
500 (Internal Server Error) The request cannot be completed because of an |
|
2335 |
internal error |
|
2336 |
503 (Service Unavailable) The service is not currently available |
|
2337 |
=========================== ===================== |
|
2263 | 2338 |
|
2264 |
This operation returns the details of a specific network by its id.
|
|
2339 |
|
|
|
2265 | 2340 |
|
2266 |
This operation does not require a request body. |
|
2341 |
In case of a 200 code, the response body consists of a collection of |
|
2342 |
`network attributes <#network-ref>`_. |
|
2267 | 2343 |
|
2268 | 2344 |
**Example Get Network Details Response: JSON**: |
2269 | 2345 |
|
2270 | 2346 |
.. code-block:: javascript |
2271 | 2347 |
|
2272 | 2348 |
{ |
2273 |
"network": { |
|
2274 |
"id": 3, |
|
2275 |
"name": "private_net", |
|
2276 |
"servers": { |
|
2277 |
"values": [1, 7] |
|
2278 |
} |
|
2279 |
} |
|
2349 |
"network": { |
|
2350 |
"status": "PENDING", |
|
2351 |
"updated": "2013-04-25T13:31:17.165237+00:00", |
|
2352 |
"name": "my private network", |
|
2353 |
"created": "2013-04-25T13:31:17.165088+00:00", |
|
2354 |
"cidr6": null, |
|
2355 |
"id": "6567", |
|
2356 |
"gateway6": null, |
|
2357 |
"public": false, |
|
2358 |
"dhcp": false, |
|
2359 |
"cidr": "192.168.1.0/24", |
|
2360 |
"type": "MAC_FILTERED", |
|
2361 |
"gateway": null, |
|
2362 |
"attachments": {"values": []} |
|
2363 |
} |
|
2280 | 2364 |
} |
2281 | 2365 |
|
2282 |
**Example Get Network Details Response: XML**:: |
|
2283 |
|
|
2284 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2285 |
<network xmlns="http://docs.openstack.org/compute/api/v1.1" xmlns:atom="http://www.w3.org/2005/Atom" |
|
2286 |
id="2" name="foob" updated="2011-05-02T21:33:25.606672+00:00" created="2011-04-20T15:31:08.199640+00:00"> |
|
2287 |
<servers> |
|
2288 |
<server id="1"></server> |
|
2289 |
<server id="7"></server> |
|
2290 |
</servers> |
|
2291 |
</network> |
|
2292 |
|
|
2293 |
|
|
2294 | 2366 |
Update Network Name |
2295 | 2367 |
................... |
2296 | 2368 |
|
... | ... | |
2471 | 2543 |
================== =========== |
2472 | 2544 |
Network Attributes Description |
2473 | 2545 |
================== =========== |
2474 |
id |
|
2475 |
name |
|
2476 |
created |
|
2477 |
updates |
|
2478 |
attachments |
|
2546 |
id Network identifier |
|
2547 |
name Network name |
|
2548 |
created Date of creation |
|
2549 |
updates Date of last update |
|
2550 |
cidr IPv4 CIDR Address |
|
2551 |
cidr6 IPv6 CIDR Address |
|
2552 |
dhcp IPv4 DHCP Address |
|
2553 |
dhcp6 IPv6 DHCP Address |
|
2554 |
gateway IPv4 Gateway Address |
|
2555 |
gateway6 IPv6 Gateway Address |
|
2556 |
public If the network is public |
|
2557 |
status Network status |
|
2558 |
attachments Network Interface Connections (NICs) |
|
2479 | 2559 |
================== =========== |
2480 | 2560 |
|
2481 |
* **id** and **name** are the network id (int) and name (string) respectively
|
|
2561 |
* **id** and **name** are int and string respectively
|
|
2482 | 2562 |
|
2483 | 2563 |
* **created** and **updated** are ISO8061 date strings |
2484 | 2564 |
|
2565 |
* **public** is a boolean flag |
|
2566 |
|
|
2567 |
* **status** can be PENDING, ACTIVE or DELETED |
|
2568 |
|
|
2485 | 2569 |
* **attachments** refers to the NICs connecting servers on that network. |
2486 | 2570 |
|
2487 | 2571 |
.. _nic-ref: |
Also available in: Unified diff