How do I enable backup with the Python API?
I create boxes with:
box, pw = client.linode.createinstance(boxtype, region, image="linode/ubuntu18.04", label=label, group=group)
How can I set enable backups on the recently created box? I see it's possible through the API but couldn't find a similar feature in the Python API.
Thank you!
1 Reply
aorme
Linode Staff
Not sure if you can enable backups with create_instance
, but you should be able to enable backups after you create it with enable_backups()
new_linode, password = client.linode.create_instance("g6-standard-1", "us-east", image="linode/debian9", label="APITest")
new_linode.enable_backups()
There's a bunch of things you can do with the new_linode object -- try using dir
. It'll display a list of callable methods and attributes for an object. Here's an example:
print(dir(new_linode))
... 'alerts', 'allocate_ip', 'api_endpoint', 'api_list', 'available_backups', 'backups', 'boot', 'cancel_backups', 'clone', 'configs', 'create_config', 'create_disk', 'created', 'delete', 'disks', 'enable_backups', 'generate_root_password', 'group', 'hypervisor', 'id', 'image', 'invalidate', 'ips', 'ipv4', 'ipv6', 'kvmify', 'label', 'make', 'make_instance', 'mutate', 'properties', 'reboot', 'rebuild', 'region', 'rescue', 'save', 'shutdown', 'snapshot', 'specs', 'stats', 'stats_for', 'status', 'type', 'updated']
You can use dir
on these as well:
print(dir(new_linode.backups))
... 'enabled', 'schedule']