Class: Comet::BackupRuleConfig

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

Overview

BackupRuleConfig is a typed class wrapper around the underlying Comet Server API data structure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBackupRuleConfig

Returns a new instance of BackupRuleConfig.



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

def initialize
  clear
end

Instance Attribute Details

#allow_zero_files_successObject

Returns the value of attribute allow_zero_files_success.



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

def allow_zero_files_success
  @allow_zero_files_success
end

#create_timeObject

Returns the value of attribute create_time.



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

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

Returns the value of attribute destination.



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

def destination
  @destination
end

#event_triggersObject

Returns the value of attribute event_triggers.



63
64
65
# File 'lib/comet/models/backup_rule_config.rb', line 63

def event_triggers
  @event_triggers
end

#limit_vault_speed_bpsObject

Returns the value of attribute limit_vault_speed_bps.



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

def limit_vault_speed_bps
  @limit_vault_speed_bps
end

#modify_timeObject

Returns the value of attribute modify_time.



24
25
26
# File 'lib/comet/models/backup_rule_config.rb', line 24

def modify_time
  @modify_time
end

#post_execObject

Returns the value of attribute post_exec.



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

def post_exec
  @post_exec
end

#pre_execObject

Returns the value of attribute pre_exec.



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

def pre_exec
  @pre_exec
end

#reduce_disk_concurrencyObject

Returns the value of attribute reduce_disk_concurrency.



51
52
53
# File 'lib/comet/models/backup_rule_config.rb', line 51

def reduce_disk_concurrency
  @reduce_disk_concurrency
end

#schedulesObject

Returns the value of attribute schedules.



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

def schedules
  @schedules
end

#skip_already_runningObject

Returns the value of attribute skip_already_running.



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

def skip_already_running
  @skip_already_running
end

#sourceObject

Returns the value of attribute source.



36
37
38
# File 'lib/comet/models/backup_rule_config.rb', line 36

def source
  @source
end

#stop_afterObject

Returns the value of attribute stop_after.



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

def stop_after
  @stop_after
end

#thaw_execObject

Returns the value of attribute thaw_exec.



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

def thaw_exec
  @thaw_exec
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



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

def unknown_json_fields
  @unknown_json_fields
end

#use_on_disk_indexesObject

Returns the value of attribute use_on_disk_indexes.



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

def use_on_disk_indexes
  @use_on_disk_indexes
end

Instance Method Details

#clearObject



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/comet/models/backup_rule_config.rb', line 72

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
  @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)


96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
# File 'lib/comet/models/backup_rule_config.rb', line 96

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 '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)


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

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



215
216
217
# File 'lib/comet/models/backup_rule_config.rb', line 215

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



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/comet/models/backup_rule_config.rb', line 190

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['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



220
221
222
# File 'lib/comet/models/backup_rule_config.rb', line 220

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