Class: Comet::BackupRuleEventTriggers
- Inherits:
-
Object
- Object
- Comet::BackupRuleEventTriggers
- Defined in:
- lib/comet/models/backup_rule_event_triggers.rb
Overview
BackupRuleEventTriggers is a typed class wrapper around the underlying Comet Server API data structure.
Instance Attribute Summary collapse
-
#last_job_fail_do_retry_count ⇒ Object
The number of retries when the backup job fails.
-
#last_job_fail_do_retry_time ⇒ Object
The number of minutes before retrying when the backup job fails.
-
#on_last_job_fail_do_retry ⇒ Object
The option to enable retrying when a backup job failed.
-
#on_pcboot ⇒ Object
The “When PC Starts” option.
-
#on_pcboot_if_last_job_missed ⇒ Object
The “If the last job was Missed” option.
-
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
Instance Method Summary collapse
- #clear ⇒ Object
- #from_hash(obj) ⇒ Object
- #from_json(json_string) ⇒ Object
-
#initialize ⇒ BackupRuleEventTriggers
constructor
A new instance of BackupRuleEventTriggers.
-
#to_h ⇒ Hash
The complete object as a Ruby hash.
-
#to_hash ⇒ Hash
The complete object as a Ruby hash.
-
#to_json(options = {}) ⇒ String
The complete object as a JSON string.
Constructor Details
#initialize ⇒ BackupRuleEventTriggers
Returns a new instance of BackupRuleEventTriggers.
42 43 44 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 42 def initialize clear end |
Instance Attribute Details
#last_job_fail_do_retry_count ⇒ Object
The number of retries when the backup job fails. This field is available in Comet 24.6.6 and later.
32 33 34 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 32 def last_job_fail_do_retry_count @last_job_fail_do_retry_count end |
#last_job_fail_do_retry_time ⇒ Object
The number of minutes before retrying when the backup job fails. This field is available in Comet 24.6.6 and later.
37 38 39 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 37 def last_job_fail_do_retry_time @last_job_fail_do_retry_time end |
#on_last_job_fail_do_retry ⇒ Object
The option to enable retrying when a backup job failed. This field is available in Comet 24.6.6 and later.
27 28 29 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 27 def on_last_job_fail_do_retry @on_last_job_fail_do_retry end |
#on_pcboot ⇒ Object
The “When PC Starts” option
17 18 19 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 17 def on_pcboot @on_pcboot end |
#on_pcboot_if_last_job_missed ⇒ Object
The “If the last job was Missed” option. In Comet 23.12.3 and later, this condition is evaluated when the PC starts and/or when the live connection is resumed.
22 23 24 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 22 def on_pcboot_if_last_job_missed @on_pcboot_if_last_job_missed end |
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
40 41 42 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 40 def unknown_json_fields @unknown_json_fields end |
Instance Method Details
#clear ⇒ Object
46 47 48 49 50 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 46 def clear @last_job_fail_do_retry_count = 0 @last_job_fail_do_retry_time = 0 @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 60 def from_hash(obj) raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash obj.each do |k, v| case k when 'OnPCBoot' @on_pcboot = v when 'OnPCBootIfLastJobMissed' @on_pcboot_if_last_job_missed = v when 'OnLastJobFailDoRetry' @on_last_job_fail_do_retry = v when 'LastJobFailDoRetryCount' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @last_job_fail_do_retry_count = v when 'LastJobFailDoRetryTime' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @last_job_fail_do_retry_time = v else @unknown_json_fields[k] = v end end end |
#from_json(json_string) ⇒ Object
53 54 55 56 57 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 53 def from_json(json_string) raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String from_hash(JSON.parse(json_string)) end |
#to_h ⇒ Hash
Returns The complete object as a Ruby hash.
110 111 112 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 110 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 86 def to_hash ret = {} unless @on_pcboot.nil? ret['OnPCBoot'] = @on_pcboot end unless @on_pcboot_if_last_job_missed.nil? ret['OnPCBootIfLastJobMissed'] = @on_pcboot_if_last_job_missed end unless @on_last_job_fail_do_retry.nil? ret['OnLastJobFailDoRetry'] = @on_last_job_fail_do_retry end unless @last_job_fail_do_retry_count.nil? ret['LastJobFailDoRetryCount'] = @last_job_fail_do_retry_count end unless @last_job_fail_do_retry_time.nil? ret['LastJobFailDoRetryTime'] = @last_job_fail_do_retry_time end @unknown_json_fields.each do |k, v| ret[k] = v end ret end |
#to_json(options = {}) ⇒ String
Returns The complete object as a JSON string.
115 116 117 |
# File 'lib/comet/models/backup_rule_event_triggers.rb', line 115 def to_json( = {}) to_hash.to_json() end |