Class: Comet::BackupRuleConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/models/backup_rule_config.rb

Overview

time schedules or event triggers

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBackupRuleConfig

Returns a new instance of BackupRuleConfig.



89
90
91
# File 'lib/comet/models/backup_rule_config.rb', line 89

def initialize
  clear
end

Instance Attribute Details

#allow_zero_files_successObject

Default disabled



69
70
71
# File 'lib/comet/models/backup_rule_config.rb', line 69

def allow_zero_files_success
  @allow_zero_files_success
end

#auto_retention_levelObject

If Zero: default Automatic (BACKUPJOBAUTORETENTION_AUTOMATIC)



73
74
75
# File 'lib/comet/models/backup_rule_config.rb', line 73

def auto_retention_level
  @auto_retention_level
end

#create_timeObject

Unix timestamp in seconds



22
23
24
# File 'lib/comet/models/backup_rule_config.rb', line 22

def create_time
  @create_time
end

#descriptionObject

Returns the value of attribute description.



18
19
20
# File 'lib/comet/models/backup_rule_config.rb', line 18

def description
  @description
end

#destinationObject

The destination Storage Vault ID to back up to, during this schedule



46
47
48
# File 'lib/comet/models/backup_rule_config.rb', line 46

def destination
  @destination
end

#event_triggersObject

Other events that will cause this scheduled job to start



84
85
86
# File 'lib/comet/models/backup_rule_config.rb', line 84

def event_triggers
  @event_triggers
end

#limit_vault_speed_bpsObject

If Zero: disabled



57
58
59
# File 'lib/comet/models/backup_rule_config.rb', line 57

def limit_vault_speed_bps
  @limit_vault_speed_bps
end

#log_levelObject

Returns the value of attribute log_level.



76
77
78
# File 'lib/comet/models/backup_rule_config.rb', line 76

def log_level
  @log_level
end

#modify_timeObject

Unix timestamp in seconds. The caller is responsible for updating this themselves.



26
27
28
# File 'lib/comet/models/backup_rule_config.rb', line 26

def modify_time
  @modify_time
end

#post_execObject

Custom commands to run after the job



38
39
40
# File 'lib/comet/models/backup_rule_config.rb', line 38

def post_exec
  @post_exec
end

#pre_execObject

Custom commands to run before the job



30
31
32
# File 'lib/comet/models/backup_rule_config.rb', line 30

def pre_exec
  @pre_exec
end

#reduce_disk_concurrencyObject

Default disabled



61
62
63
# File 'lib/comet/models/backup_rule_config.rb', line 61

def reduce_disk_concurrency
  @reduce_disk_concurrency
end

#schedulesObject

Scheduled start times



80
81
82
# File 'lib/comet/models/backup_rule_config.rb', line 80

def schedules
  @schedules
end

#skip_already_runningObject

Returns the value of attribute skip_already_running.



49
50
51
# File 'lib/comet/models/backup_rule_config.rb', line 49

def skip_already_running
  @skip_already_running
end

#sourceObject

The source Protected Item ID to back up from, during this schedule



42
43
44
# File 'lib/comet/models/backup_rule_config.rb', line 42

def source
  @source
end

#stop_afterObject

If Zero: disabled



53
54
55
# File 'lib/comet/models/backup_rule_config.rb', line 53

def stop_after
  @stop_after
end

#thaw_execObject

Custom commands to run after taking a disk snapshot



34
35
36
# File 'lib/comet/models/backup_rule_config.rb', line 34

def thaw_exec
  @thaw_exec
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



87
88
89
# File 'lib/comet/models/backup_rule_config.rb', line 87

def unknown_json_fields
  @unknown_json_fields
end

#use_on_disk_indexesObject

Default disabled



65
66
67
# File 'lib/comet/models/backup_rule_config.rb', line 65

def use_on_disk_indexes
  @use_on_disk_indexes
end

Instance Method Details

#clearObject



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/comet/models/backup_rule_config.rb', line 93

def clear
  @description = ''
  @create_time = 0
  @modify_time = 0
  @pre_exec = []
  @thaw_exec = []
  @post_exec = []
  @source = ''
  @destination = ''
  @stop_after = 0
  @limit_vault_speed_bps = 0
  @auto_retention_level = 0
  @log_level = ''
  @schedules = []
  @event_triggers = Comet::BackupRuleEventTriggers.new
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/comet/models/backup_rule_config.rb', line 119

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 'Description'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @description = v
    when 'CreateTime'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @create_time = v
    when 'ModifyTime'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @modify_time = v
    when 'PreExec'
      if v.nil?
        @pre_exec = []
      else
        @pre_exec = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String

          @pre_exec[i1] = v1
        end
      end
    when 'ThawExec'
      if v.nil?
        @thaw_exec = []
      else
        @thaw_exec = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String

          @thaw_exec[i1] = v1
        end
      end
    when 'PostExec'
      if v.nil?
        @post_exec = []
      else
        @post_exec = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String

          @post_exec[i1] = v1
        end
      end
    when 'Source'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @source = v
    when 'Destination'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @destination = v
    when 'SkipAlreadyRunning'
      @skip_already_running = v
    when 'StopAfter'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @stop_after = v
    when 'LimitVaultSpeedBps'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @limit_vault_speed_bps = v
    when 'ReduceDiskConcurrency'
      @reduce_disk_concurrency = v
    when 'UseOnDiskIndexes'
      @use_on_disk_indexes = v
    when 'AllowZeroFilesSuccess'
      @allow_zero_files_success = v
    when 'AutoRetentionLevel'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @auto_retention_level = v
    when 'LogLevel'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @log_level = v
    when 'Schedules'
      if v.nil?
        @schedules = []
      else
        @schedules = Array.new(v.length)
        v.each_with_index do |v1, i1|
          @schedules[i1] = Comet::ScheduleConfig.new
          @schedules[i1].from_hash(v1)
        end
      end
    when 'EventTriggers'
      @event_triggers = Comet::BackupRuleEventTriggers.new
      @event_triggers.from_hash(v)
    else
      @unknown_json_fields[k] = v
    end
  end
end

#from_json(json_string) ⇒ Object

Parameters:

  • json_string (String)

    The complete object in JSON format

Raises:

  • (TypeError)


112
113
114
115
116
# File 'lib/comet/models/backup_rule_config.rb', line 112

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_hHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



248
249
250
# File 'lib/comet/models/backup_rule_config.rb', line 248

def to_h
  to_hash
end

#to_hashHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/comet/models/backup_rule_config.rb', line 221

def to_hash
  ret = {}
  ret['Description'] = @description
  ret['CreateTime'] = @create_time
  ret['ModifyTime'] = @modify_time
  ret['PreExec'] = @pre_exec
  ret['ThawExec'] = @thaw_exec
  ret['PostExec'] = @post_exec
  ret['Source'] = @source
  ret['Destination'] = @destination
  ret['SkipAlreadyRunning'] = @skip_already_running
  ret['StopAfter'] = @stop_after
  ret['LimitVaultSpeedBps'] = @limit_vault_speed_bps
  ret['ReduceDiskConcurrency'] = @reduce_disk_concurrency
  ret['UseOnDiskIndexes'] = @use_on_disk_indexes
  ret['AllowZeroFilesSuccess'] = @allow_zero_files_success
  ret['AutoRetentionLevel'] = @auto_retention_level
  ret['LogLevel'] = @log_level
  ret['Schedules'] = @schedules
  ret['EventTriggers'] = @event_triggers
  @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.

Returns:

  • (String)

    The complete object as a JSON string



253
254
255
# File 'lib/comet/models/backup_rule_config.rb', line 253

def to_json(options = {})
  to_hash.to_json(options)
end