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.



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

def initialize
  clear
end

Instance Attribute Details

#allow_zero_files_successObject

Returns the value of attribute allow_zero_files_success.



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

def allow_zero_files_success
  @allow_zero_files_success
end

#auto_retention_levelObject

Returns the value of attribute auto_retention_level.



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

def auto_retention_level
  @auto_retention_level
end

#create_timeObject

Returns the value of attribute create_time.



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

def create_time
  @create_time
end

#descriptionObject

Returns the value of attribute description.



16
17
18
# File 'lib/comet/models/backup_rule_config.rb', line 16

def description
  @description
end

#destinationObject

Returns the value of attribute destination.



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

def destination
  @destination
end

#event_triggersObject

Returns the value of attribute event_triggers.



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

def event_triggers
  @event_triggers
end

#limit_vault_speed_bpsObject

Returns the value of attribute limit_vault_speed_bps.



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

def limit_vault_speed_bps
  @limit_vault_speed_bps
end

#modify_timeObject

Returns the value of attribute modify_time.



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

def modify_time
  @modify_time
end

#post_execObject

Returns the value of attribute post_exec.



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

def post_exec
  @post_exec
end

#pre_execObject

Returns the value of attribute pre_exec.



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

def pre_exec
  @pre_exec
end

#reduce_disk_concurrencyObject

Returns the value of attribute reduce_disk_concurrency.



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

def reduce_disk_concurrency
  @reduce_disk_concurrency
end

#schedulesObject

Returns the value of attribute schedules.



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

def schedules
  @schedules
end

#skip_already_runningObject

Returns the value of attribute skip_already_running.



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

def skip_already_running
  @skip_already_running
end

#sourceObject

Returns the value of attribute source.



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

def source
  @source
end

#stop_afterObject

Returns the value of attribute stop_after.



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

def stop_after
  @stop_after
end

#thaw_execObject

Returns the value of attribute thaw_exec.



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

def thaw_exec
  @thaw_exec
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



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

def unknown_json_fields
  @unknown_json_fields
end

#use_on_disk_indexesObject

Returns the value of attribute use_on_disk_indexes.



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

def use_on_disk_indexes
  @use_on_disk_indexes
end

Instance Method Details

#clearObject



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

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


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
188
189
190
191
192
193
# File 'lib/comet/models/backup_rule_config.rb', line 98

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


91
92
93
94
95
# File 'lib/comet/models/backup_rule_config.rb', line 91

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



222
223
224
# File 'lib/comet/models/backup_rule_config.rb', line 222

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



196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/comet/models/backup_rule_config.rb', line 196

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



227
228
229
# File 'lib/comet/models/backup_rule_config.rb', line 227

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