Revision 26563957 api/actions.py
b/api/actions.py | ||
---|---|---|
40 | 40 |
|
41 | 41 |
from synnefo.api.faults import BadRequest, ServiceUnavailable |
42 | 42 |
from synnefo.api.util import random_password, get_vm |
43 |
from synnefo.db.models import NetworkInterface |
|
43 | 44 |
from synnefo.util.vapclient import request_forwarding as request_vnc_forwarding |
44 | 45 |
from synnefo.logic import backend |
45 | 46 |
from synnefo.logic.utils import get_rsapi_state |
... | ... | |
266 | 267 |
|
267 | 268 |
@server_action('firewallProfile') |
268 | 269 |
def set_firewall_profile(request, vm, args): |
270 |
# Normal Response Code: 200 |
|
271 |
# Error Response Codes: computeFault (400, 500), |
|
272 |
# serviceUnavailable (503), |
|
273 |
# unauthorized (401), |
|
274 |
# badRequest (400), |
|
275 |
# badMediaType(415), |
|
276 |
# itemNotFound (404), |
|
277 |
# buildInProgress (409), |
|
278 |
# overLimit (413) |
|
279 |
|
|
269 | 280 |
profile = args.get('profile', '') |
270 |
if profile not in ('ENABLED', 'DISABLED'):
|
|
281 |
if profile not in [x[0] for x in NetworkInterface.FIREWALL_PROFILES]:
|
|
271 | 282 |
raise BadRequest("Unsupported firewall profile") |
272 | 283 |
backend.set_firewall_profile(vm, profile) |
273 | 284 |
return HttpResponse(status=202) |
Also available in: Unified diff