forked from linode/linode_api4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.py
More file actions
35 lines (29 loc) · 1.07 KB
/
Copy pathbackup.py
File metadata and controls
35 lines (29 loc) · 1.07 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 __future__ import absolute_import
from linode.objects import Base, DerivedBase, Property, Region
class Backup(DerivedBase):
api_endpoint = '/linode/instances/{linode_id}/backups/{id}'
derived_url_path = 'backups'
parent_id_name='linode_id'
properties = {
'id': Property(identifier=True),
'created': Property(is_datetime=True),
'duration': Property(),
'updated': Property(is_datetime=True),
'finished': Property(is_datetime=True),
'message': Property(),
'status': Property(volatile=True),
'type': Property(),
'linode_id': Property(identifier=True),
'label': Property(),
'configs': Property(),
'disks': Property(),
'region': Property(slug_relationship=Region),
}
def restore_to(self, linode, **kwargs):
d = {
"linode_id": linode.id if issubclass(type(linode), Base) else linode,
}
d.update(kwargs)
self._client.post("{}/restore".format(Backup.api_endpoint), model=self,
data=d)
return True