Decorators¶
The Virtualization SDK exposes decorators to be able to annotate functions that correspond to each Plugin Operation.
In the example below, it first instantiates a Plugin()
object, that can then be used to tag plugin operations.
from dlpx.virtualization.platform import Plugin
# Initialize a plugin object
plugin = Plugin()
# Use the decorator to annotate the function that corresponds to the "Virtual Source Start" Plugin Operation
@plugin.virtual_source.start()
def my_start(virtual_source, repository, source_config):
print("running start")
Info
Decorators exposed by the Virtualization SDK are inherently python function calls and needs parentheses ()
appended at the end.
Assuming the name of the object is plugin
as above, the table below lists the corresponding decorators for each plugin operation.
Plugin Operation | Decorator |
---|---|
Repository Discovey | @plugin.discovery.repository() |
Source Config Discovey | @plugin.discovery.source_config() |
Direct Linked Source Pre-Snapshot | @plugin.linked.pre_snapshot() |
Direct Linked Source Post-Snapshot | @plugin.linked.post_snapshot() |
Direct Linked Source Size | @plugin.linked.source_size() |
Staged Linked Source Pre-Snapshot | @plugin.linked.pre_snapshot() |
Staged Linked Source Post-Snapshot | @plugin.linked.post_snapshot() |
Staged Linked Source Start-Staging | @plugin.linked.start_staging() |
Staged Linked Source Stop-Staging | @plugin.linked.stop_staging() |
Staged Linked Source Status | @plugin.linked.status() |
Staged Linked Source Worker | @plugin.linked.worker() |
Staged Linked Source Mount Specification | @plugin.linked.mount_specification() |
Staged Linked Source Size | @plugin.linked.source_size() |
Virtual Source Configure | @plugin.virtual.configure() |
Virtual Source Initialize | @plugin.virtual.initialize() |
Virtual Source Unconfigure | @plugin.virtual.unconfigure() |
Virtual Source Reconfigure | @plugin.virtual.reconfigure() |
Virtual Source Cleanup | @plugin.virtual.cleanup() |
Virtual Source Start | @plugin.virtual.start() |
Virtual Source Stop | @plugin.virtual.stop() |
VirtualSource Pre-Snapshot | @plugin.virtual.pre_snapshot() |
Virtual Source Post-Snapshot | @plugin.virtual.post_snapshot() |
Virtual Source Mount Specification | @plugin.virtual.mount_specification() |
Virtual Source Status | @plugin.virtual.status() |
Virtual Source Size | @plugin.virtual.source_size() |
Repository Data Migration | @plugin.upgrade.repository(migration_id) |
Source Config Data Migration | @plugin.upgrade.source_config(migration_id) |
Linked Source Data Migration | @plugin.upgrade.linked_source(migration_id) |
Virtual Source Data Migration | @plugin.upgrade.virtual_source(migration_id) |
Snapshot Data Migration | @plugin.upgrade.snapshot(migration_id) |
Warning
A plugin should only implement the direct operations or the staged operations based on the plugin type.