Oleksiy Petrenko | 777d782 | 2018-11-06 13:32:44 +0200 | [diff] [blame] | 1 | from designatev2.common import send |
| 2 | from designatev2.arg_converter import get_by_name_or_uuid_multiple |
| 3 | |
| 4 | |
| 5 | @send('post') |
| 6 | def zone_create(name, email, **kwargs): |
| 7 | url = '/zones' |
| 8 | json = { |
| 9 | 'name': name, |
| 10 | 'email': email, |
| 11 | } |
| 12 | json.update(kwargs) |
| 13 | return url, json |
| 14 | |
| 15 | |
| 16 | @get_by_name_or_uuid_multiple([('zone', 'zone_id')]) |
| 17 | @send('get') |
| 18 | def zone_get_details(zone_id, **kwargs): |
| 19 | url = '/zones/{}'.format(zone_id) |
| 20 | return url, None |
| 21 | |
| 22 | |
| 23 | @get_by_name_or_uuid_multiple([('zone', 'zone_id')]) |
| 24 | @send('get') |
| 25 | def zone_get_name_servers(zone_id, **kwargs): |
| 26 | url = '/zones/{}/nameservers'.format(zone_id) |
| 27 | return url, None |
| 28 | |
| 29 | |
| 30 | @get_by_name_or_uuid_multiple([('zone', 'zone_id')]) |
| 31 | @send('patch') |
| 32 | def zone_update(zone_id, **kwargs): |
| 33 | url = '/zones/{}'.format(zone_id) |
| 34 | return url, kwargs |
| 35 | |
| 36 | |
| 37 | @get_by_name_or_uuid_multiple([('zone', 'zone_id')]) |
| 38 | @send('delete') |
| 39 | def zone_delete(zone_id, **kwargs): |
| 40 | url = '/zones/{}'.format(zone_id) |
| 41 | return url, None |