forked from linode/linode_api4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzone.py
More file actions
38 lines (31 loc) · 1.17 KB
/
Copy pathzone.py
File metadata and controls
38 lines (31 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from .base import Base, Property
from .zone_record import ZoneRecord
class Zone(Base):
api_endpoint = "/zones/{id}"
properties = {
'id': Property(identifier=True),
'zone': Property(mutable=True),
'display_group': Property(mutable=True),
'description': Property(mutable=True),
'status': Property(mutable=True),
'soa_email': Property(mutable=True),
'retry_sec': Property(mutable=True),
'master_ips': Property(mutable=True),
'axfr_ips': Property(mutable=True),
'expire_sec': Property(mutable=True),
'refresh_sec': Property(mutable=True),
'ttl_se': Property(mutable=True),
'records': Property(derived_class=ZoneRecord),
}
def create_record(self, record_type, **kwargs):
params = {
"type": record_type,
}
params.update(kwargs)
result = self._client.post("{}/records".format(Zone.api_endpoint), model=self, data=params)
self.invalidate()
if not 'record' in result:
return result
zr = ZoneRecord(self._client, result['record']['id'], self.id)
zr._populate(result['record'])
return zr