Understanding Models
This document provides information about models used for backup plugins. Models are PORO objects that you cannot modify. Models are passed to plugin hooks in a plugin.rb file. Each model that is passed to a hook includes a metadata object, which is a hash that allows plugins to save some information along with the model and current backup resource. OnApp handles the metadata saves automatically.
Models & Properties
Here you can find the list of all models and their available properties.
disk | ip_address | recovery_point | schedule | virtual_server |
disk_size identifier created_at updated_at is_swap built locked primary disk_vm_number mount_point label bus file_system volume_id min_iops max_iops burst_iops max_bw burst_bw iqn type mounted io_limits io_limits_override | address prefix broadcast network_address gateway created_at updated_at ipv4 | size state created_at updated_at | type enabled start_time max_recovery_points frequency days_to_run week_to_run day_to_run period | identifier hostname initial_root_password memory cpu cpu_shares created_at updated_at built locked booted label operating_system operating_system_distro allowed_swap template_label min_disk_size type state max_memory cpu_units cpu_sockets cpu_threads cores_per_socket time_zone template_version disks: array of Disk ip_addresses: array of IpAddress virtual_server.owner.login virtual_server.owner.email |
Starting from OnApp 6.0.0-152, you can add metadata objects directly to a model, for example, virtual_server.metadata[:key] = 'value', virtual_server.owner.login.metadata[:key] = 'value', etc. You can also pass metadata via an associated model's metadata, for example, virtual_server.disks.first.metadata[:key] = 'value'. See Implementing Plugin for an example of plugin.rb where you pass models to a plugin.