Revision 4a88f05b kamaki/clients/compute/rest_api.py
b/kamaki/clients/compute/rest_api.py | ||
---|---|---|
109 | 109 |
security_group=None, |
110 | 110 |
user_data=None, |
111 | 111 |
availability_zone=None, |
112 |
server=None, |
|
113 |
imageRef=None, |
|
114 |
flavorRef=None, |
|
115 |
name=None, |
|
116 |
metadata=None, |
|
117 |
personality=None, |
|
118 | 112 |
json_data=None, |
119 | 113 |
success=202, |
120 | 114 |
**kwargs): |
... | ... | |
131 | 125 |
|
132 | 126 |
:param availability_zone: (str) |
133 | 127 |
|
134 |
:param server: Server |
|
135 |
|
|
136 |
:param imageRef: ID or full URL. |
|
137 |
|
|
138 |
:param flavorRef: ID or full URL. |
|
139 |
|
|
140 |
:param name: (str) The name of the new server |
|
141 |
|
|
142 |
:param metadata: (dict) Metadata key: value pairs. max size of the key |
|
143 |
and value is 255 bytes each. |
|
144 |
|
|
145 |
:param personality: (str) File path and contents (text only) to inject |
|
146 |
into the server at launch. The maximum size of the file path data |
|
147 |
is 255 bytes. The maximum limit refers to the number of bytes in |
|
148 |
the decoded data and not the number of characters in the encoded |
|
149 |
data. |
|
150 |
|
|
151 | 128 |
:returns: request response |
152 | 129 |
""" |
153 | 130 |
|
154 |
self.set_param(security_group, security_group, iff=security_group)
|
|
155 |
self.set_param(user_data, user_data, iff=user_data)
|
|
131 |
self.set_param('security_group', security_group, iff=security_group)
|
|
132 |
self.set_param('user_data', user_data, iff=user_data)
|
|
156 | 133 |
self.set_param( |
157 |
availability_zone, availability_zone, iff=availability_zone) |
|
158 |
self.set_param(server, server, iff=server) |
|
159 |
self.set_param(imageRef, imageRef, iff=imageRef) |
|
160 |
self.set_param(flavorRef, flavorRef, iff=flavorRef) |
|
161 |
self.set_param(name, name, iff=name) |
|
162 |
if metadata: # don't json.dump None |
|
163 |
self.set_param(metadata, json.dumps(metadata)) |
|
164 |
self.set_param(personality, personality, iff=personality) |
|
134 |
'availability_zone', availability_zone, iff=availability_zone) |
|
165 | 135 |
|
166 | 136 |
if json_data: |
167 | 137 |
json_data = json.dumps(json_data) |
... | ... | |
250 | 220 |
path = path4url('servers', server_id, 'metadata', key) |
251 | 221 |
return self.delete(path, success=success, **kwargs) |
252 | 222 |
|
253 |
def servers_actions_post(
|
|
223 |
def servers_action_post( |
|
254 | 224 |
self, server_id, json_data=None, success=202, **kwargs): |
255 | 225 |
"""POST base_url/servers/<server_id>/action |
256 | 226 |
|
... | ... | |
419 | 389 |
path = path4url('flavors', 'detail' if detail else (flavor_id or '')) |
420 | 390 |
return self.get(path, success=success, **kwargs) |
421 | 391 |
|
422 |
def floating_ip_pools_get(self, tenant_id, success=200, **kwargs):
|
|
392 |
def floating_ip_pools_get(self, success=200, **kwargs): |
|
423 | 393 |
path = path4url('os-floating-ip-pools') |
424 | 394 |
return self.get(path, success=success, **kwargs) |
425 | 395 |
|
426 |
def floating_ips_get(self, tenant_id, ip='', success=200, **kwargs):
|
|
396 |
def floating_ips_get(self, ip='', success=200, **kwargs): |
|
427 | 397 |
path = path4url('os-floating-ips', ip or '') |
428 | 398 |
return self.get(path, success=success, **kwargs) |
429 | 399 |
|
430 |
def floating_ips_post( |
|
431 |
self, tenant_id, json_data, ip='', success=201, **kwargs): |
|
400 |
def floating_ips_post(self, json_data, ip='', success=201, **kwargs): |
|
432 | 401 |
path = path4url('os-floating-ips', ip or '') |
433 | 402 |
if json_data is not None: |
434 | 403 |
json_data = json.dumps(json_data) |
... | ... | |
436 | 405 |
self.set_header('Content-Length', len(json_data)) |
437 | 406 |
return self.post(path, data=json_data, success=success, **kwargs) |
438 | 407 |
|
439 |
def floating_ips_delete(self, tenant_id, ip='', success=204, **kwargs):
|
|
408 |
def floating_ips_delete(self, ip='', success=204, **kwargs): |
|
440 | 409 |
path = path4url('os-floating-ips', ip or '') |
441 | 410 |
return self.delete(path, success=success, **kwargs) |
Also available in: Unified diff