Class: Comet::BackupJobDetail

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBackupJobDetail

Returns a new instance of BackupJobDetail.



122
123
124
# File 'lib/comet/models/backup_job_detail.rb', line 122

def initialize
  clear
end

Instance Attribute Details

#backup_rule_guidObject

The ID of the backup rule that contains the schedule that triggered this job This field is available in Comet 24.6.6 and later.



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

def backup_rule_guid
  @backup_rule_guid
end

#cancellation_idObject

If this field is present, it is possible to request cancellation of this job via the API.



104
105
106
# File 'lib/comet/models/backup_job_detail.rb', line 104

def cancellation_id
  @cancellation_id
end

#classificationObject

Returns the value of attribute classification.



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

def classification
  @classification
end

#client_versionObject

Returns the value of attribute client_version.



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

def client_version
  @client_version
end

#destination_guidObject

The Storage Vault that this job is for



44
45
46
# File 'lib/comet/models/backup_job_detail.rb', line 44

def destination_guid
  @destination_guid
end

#destination_size_endObject

The size of the Storage Vault, as measured at the end of the job.



117
118
119
# File 'lib/comet/models/backup_job_detail.rb', line 117

def destination_size_end
  @destination_size_end
end

#destination_size_startObject

The size of the Storage Vault, as measured at the start of the job.



113
114
115
# File 'lib/comet/models/backup_job_detail.rb', line 113

def destination_size_start
  @destination_size_start
end

#device_idObject

Returns the value of attribute device_id.



47
48
49
# File 'lib/comet/models/backup_job_detail.rb', line 47

def device_id
  @device_id
end

#download_sizeObject

Returns the value of attribute download_size.



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

def download_size
  @download_size
end

#end_timeObject

Unix timestamp in seconds. Will be zero if the job is still running.



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

def end_time
  @end_time
end

#guidObject

Returns the value of attribute guid.



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

def guid
  @guid
end

#progressObject

If this backup job is still running, additional partial-progress information may be present in this field.



109
110
111
# File 'lib/comet/models/backup_job_detail.rb', line 109

def progress
  @progress
end

#retry_countObject

Returns the value of attribute retry_count.



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

def retry_count
  @retry_count
end

#snapshot_idObject

Returns the value of attribute snapshot_id.



50
51
52
# File 'lib/comet/models/backup_job_detail.rb', line 50

def snapshot_id
  @snapshot_id
end

#source_guidObject

The Protected Item that this job is for



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

def source_guid
  @source_guid
end

#start_timeObject

Unix timestamp in seconds



29
30
31
# File 'lib/comet/models/backup_job_detail.rb', line 29

def start_time
  @start_time
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#total_accounts_countObject

For Office 365 backup jobs, the calculated effective number of protected accounts.



92
93
94
# File 'lib/comet/models/backup_job_detail.rb', line 92

def total_accounts_count
  @total_accounts_count
end

#total_chunksObject

Returns the value of attribute total_chunks.



70
71
72
# File 'lib/comet/models/backup_job_detail.rb', line 70

def total_chunks
  @total_chunks
end

#total_directoriesObject

Returns the value of attribute total_directories.



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

def total_directories
  @total_directories
end

#total_filesObject

Returns the value of attribute total_files.



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

def total_files
  @total_files
end

#total_licensed_mails_countObject

For Office 365 backup jobs, the number of licensed mailboxes.



96
97
98
# File 'lib/comet/models/backup_job_detail.rb', line 96

def total_licensed_mails_count
  @total_licensed_mails_count
end

#total_mails_countObject

For Office 365 backup jobs, the total number of mailboxes.



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

def total_mails_count
  @total_mails_count
end

#total_sites_countObject

For Office 365 backup jobs, the total number of SharePoint sites.



88
89
90
# File 'lib/comet/models/backup_job_detail.rb', line 88

def total_sites_count
  @total_sites_count
end

#total_sizeObject

Returns the value of attribute total_size.



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

def total_size
  @total_size
end

#total_unlicensed_mails_countObject

For Office 365 backup jobs, the number of unlicensed mailboxes.



100
101
102
# File 'lib/comet/models/backup_job_detail.rb', line 100

def total_unlicensed_mails_count
  @total_unlicensed_mails_count
end

#total_vm_countObject

For Hyper-V and VMware backup jobs, the total number of virtual machines.



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

def total_vm_count
  @total_vm_count
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



120
121
122
# File 'lib/comet/models/backup_job_detail.rb', line 120

def unknown_json_fields
  @unknown_json_fields
end

#upload_sizeObject

Returns the value of attribute upload_size.



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

def upload_size
  @upload_size
end

#usernameObject

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#clearObject



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
# File 'lib/comet/models/backup_job_detail.rb', line 126

def clear
  @guid = ''
  @username = ''
  @classification = 0
  @status = 0
  @start_time = 0
  @end_time = 0
  @retry_count = 0
  @source_guid = ''
  @destination_guid = ''
  @device_id = ''
  @snapshot_id = ''
  @backup_rule_guid = ''
  @client_version = ''
  @total_directories = 0
  @total_files = 0
  @total_size = 0
  @total_chunks = 0
  @upload_size = 0
  @download_size = 0
  @total_vm_count = 0
  @total_mails_count = 0
  @total_sites_count = 0
  @total_accounts_count = 0
  @total_licensed_mails_count = 0
  @total_unlicensed_mails_count = 0
  @cancellation_id = ''
  @progress = Comet::BackupJobProgress.new
  @destination_size_start = Comet::SizeMeasurement.new
  @destination_size_end = Comet::SizeMeasurement.new
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


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
219
220
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/comet/models/backup_job_detail.rb', line 167

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      @cancellation_id = v
    when 'Progress'
      @progress = Comet::BackupJobProgress.new
      @progress.from_hash(v)
    when 'DestinationSizeStart'
      @destination_size_start = Comet::SizeMeasurement.new
      @destination_size_start.from_hash(v)
    when 'DestinationSizeEnd'
      @destination_size_end = Comet::SizeMeasurement.new
      @destination_size_end.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)


160
161
162
163
164
# File 'lib/comet/models/backup_job_detail.rb', line 160

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



354
355
356
# File 'lib/comet/models/backup_job_detail.rb', line 354

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



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/comet/models/backup_job_detail.rb', line 292

def to_hash
  ret = {}
  ret['GUID'] = @guid
  ret['Username'] = @username
  ret['Classification'] = @classification
  ret['Status'] = @status
  ret['StartTime'] = @start_time
  ret['EndTime'] = @end_time
  ret['RetryCount'] = @retry_count
  ret['SourceGUID'] = @source_guid
  ret['DestinationGUID'] = @destination_guid
  ret['DeviceID'] = @device_id
  unless @snapshot_id.nil?
    ret['SnapshotID'] = @snapshot_id
  end
  unless @backup_rule_guid.nil?
    ret['BackupRuleGUID'] = @backup_rule_guid
  end
  ret['ClientVersion'] = @client_version
  ret['TotalDirectories'] = @total_directories
  ret['TotalFiles'] = @total_files
  ret['TotalSize'] = @total_size
  ret['TotalChunks'] = @total_chunks
  ret['UploadSize'] = @upload_size
  ret['DownloadSize'] = @download_size
  unless @total_vm_count.nil?
    ret['TotalVmCount'] = @total_vm_count
  end
  unless @total_mails_count.nil?
    ret['TotalMailsCount'] = @total_mails_count
  end
  unless @total_sites_count.nil?
    ret['TotalSitesCount'] = @total_sites_count
  end
  unless @total_accounts_count.nil?
    ret['TotalAccountsCount'] = @total_accounts_count
  end
  unless @total_licensed_mails_count.nil?
    ret['TotalLicensedMailsCount'] = @total_licensed_mails_count
  end
  unless @total_unlicensed_mails_count.nil?
    ret['TotalUnlicensedMailsCount'] = @total_unlicensed_mails_count
  end
  unless @cancellation_id.nil?
    ret['CancellationID'] = @cancellation_id
  end
  unless @progress.nil?
    ret['Progress'] = @progress
  end
  unless @destination_size_start.nil?
    ret['DestinationSizeStart'] = @destination_size_start
  end
  unless @destination_size_end.nil?
    ret['DestinationSizeEnd'] = @destination_size_end
  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.

Returns:

  • (String)

    The complete object as a JSON string



359
360
361
# File 'lib/comet/models/backup_job_detail.rb', line 359

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