Snapshots

Snapshots are point in time backups of a volume. This class inherits from TopLevelResource and has direct access to the resource’s database object. The following attributes are directly accessible:

attr organization_service_id:
 The ID of the parent organization service (cloud)
attr region_name:
 The region that the snapshot resides in
attr snapshot_id:
 The provider ID of the snapshot
attr volume_resource_id:
 The resource ID of the volume this snapshot was created from
attr name:The name of the volume’s snapshot
attr description:
 Description of the snapshot
attr state:The current lifecycle state of the snapshot
attr progress:The creation progress of the snapshot
attr size:The size in gigabytes of the volume
attr public:Denotes whether the snapshot is publicly available
attr create_time:
 The time when the snapshot was created
attr encrypted:Denotes whether the snapshot is encrypted
class DivvyResource.Resources.snapshot.Snapshot(resource_id)

Bases: DivvyResource.Resources.toplevelresource.TopLevelResource

Snapshot operations

delete(user_resource_id=None)

Delete this resource. If wrapped with JobQueue() block, this will queue the deletion job to the wrapped queue, otherwise it calls immediately.

get_date_created()

Retrieve the time from the provider that this resource was created (if available).

static get_db_class()
get_parent_resource_id()
get_private_images()

Retrieve a list of db objects for private images created from the snapshot (if any)

static get_provider_id_field()
get_resource_dependencies()

Retrieve the dependencies for a particular resources. This is an override of the parent function because we don’t have ResourceLink relationships for volumes and private/public images where the snapshot ID is included in the block device mapping.

static get_resource_type()
get_size()

Retrieve the size of the snapshot

get_supported_actions()

Retrieve all the actions which are supported by this resource.

handle_resource_created(user_resource_id=None)

This should be called when a resource is created/discovered after the basic data is added to the database. This gives an opportunity for post-addition hooks (assignment to groups, alerts, etc)

handle_resource_destroyed(user_resource_id=None, project_resource_id=None)

This should be called when a resource is destroyed before the basic data is removed from the database. This gives an opportunity for pre-destruction hooks (removal from groups, alerts, etc)

handle_resource_modified(resource, *args, **kwargs)

This should be called when a resource is modified after the new data has been updated in the DB session This gives an opportunity for post-modification hooks

is_backup()

Determine if this snapshot represents a volume backup.

snapshot
snapshot_id
top_level_resource = True