forked from linode/linode_api4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
35 lines (30 loc) · 1.17 KB
/
Copy pathconfig.py
File metadata and controls
35 lines (30 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
from .dbase import DerivedBase
from .base import Property
class Config(DerivedBase):
api_endpoint="/linodes/{linode_id}/configs/{id}"
derived_url_path="configs"
parent_id_name="linode_id"
properties = {
"id": Property(identifier=True),
"linode_id": Property(identifier=True),
"helpers": Property(),#TODO: mutable=True),
"created": Property(is_datetime=True),
"root_device": Property(mutable=True),
"kernel": Property(relationship=True, mutable=True),
"disks": Property(),#TODO: mutable=True),
"updated": Property(),
"comments": Property(mutable=True),
"label": Property(mutable=True),
"kernel_params": Property(mutable=True),
}
def _populate(self, json):
"""
Override popupate to map the disks more nicely
"""
DerivedBase._populate(self, json)
import linode.mappings as mapper
for key in vars(self.disks):
if self.disks.__getattribute__(key):
self.disks.__setattr__(key,
mapper.make(self.disks.__getattribute__(key).id,
self._client, parent_id=self.linode_id))