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

#initialize ⇒ BackupJobDetail

Returns a new instance of BackupJobDetail.



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

def initialize
  clear
end

Instance Attribute Details

#cancellation_id ⇒ Object

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



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

def cancellation_id
  @cancellation_id
end

#classification ⇒ Object

Returns the value of attribute classification.



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

def classification
  @classification
end

#client_version ⇒ Object

Returns the value of attribute client_version.



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

def client_version
  @client_version
end

#destination_guid ⇒ Object

The Storage Vault that this job is for



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

def destination_guid
  @destination_guid
end

#destination_size_end ⇒ Object

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



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

def destination_size_end
  @destination_size_end
end

#destination_size_start ⇒ Object

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



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

def destination_size_start
  @destination_size_start
end

#device_id ⇒ Object

Returns the value of attribute device_id.



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

def device_id
  @device_id
end

#download_size ⇒ Object

Returns the value of attribute download_size.



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

def download_size
  @download_size
end

#end_time ⇒ Object

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

#guid ⇒ Object

Returns the value of attribute guid.



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

def guid
  @guid
end

#progress ⇒ Object

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



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

def progress
  @progress
end

#snapshot_id ⇒ Object

Returns the value of attribute snapshot_id.



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

def snapshot_id
  @snapshot_id
end

#source_guid ⇒ Object

The Protected Item that this job is for



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

def source_guid
  @source_guid
end

#start_time ⇒ Object

Unix timestamp in seconds



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

def start_time
  @start_time
end

#status ⇒ Object

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_count ⇒ Object

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



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

def total_accounts_count
  @total_accounts_count
end

#total_chunks ⇒ Object

Returns the value of attribute total_chunks.



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

def total_chunks
  @total_chunks
end

#total_directories ⇒ Object

Returns the value of attribute total_directories.



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

def total_directories
  @total_directories
end

#total_files ⇒ Object

Returns the value of attribute total_files.



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

def total_files
  @total_files
end

#total_licensed_mails_count ⇒ Object

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



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

def total_licensed_mails_count
  @total_licensed_mails_count
end

#total_mails_count ⇒ Object

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



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

def total_mails_count
  @total_mails_count
end

#total_sites_count ⇒ Object

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



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

def total_sites_count
  @total_sites_count
end

#total_size ⇒ Object

Returns the value of attribute total_size.



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

def total_size
  @total_size
end

#total_unlicensed_mails_count ⇒ Object

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



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

def total_unlicensed_mails_count
  @total_unlicensed_mails_count
end

#total_vm_count ⇒ Object

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



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

def total_vm_count
  @total_vm_count
end

#unknown_json_fields ⇒ Object

Returns the value of attribute unknown_json_fields.



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

def unknown_json_fields
  @unknown_json_fields
end

#upload_size ⇒ Object

Returns the value of attribute upload_size.



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

def upload_size
  @upload_size
end

#username ⇒ Object

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

#clear ⇒ Object



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

def clear
  @guid = ''
  @username = ''
  @classification = 0
  @status = 0
  @start_time = 0
  @end_time = 0
  @source_guid = ''
  @destination_guid = ''
  @device_id = ''
  @snapshot_id = ''
  @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)


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

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


150
151
152
153
154
# File 'lib/comet/models/backup_job_detail.rb', line 150

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.

Returns:

  • (Hash) —

    The complete object as a Ruby hash



332
333
334
# File 'lib/comet/models/backup_job_detail.rb', line 332

def to_h
  to_hash
end

#to_hash ⇒ Hash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash) —

    The complete object as a Ruby hash



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
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
# File 'lib/comet/models/backup_job_detail.rb', line 274

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['SourceGUID'] = @source_guid
  ret['DestinationGUID'] = @destination_guid
  ret['DeviceID'] = @device_id
  unless @snapshot_id.nil?
    ret['SnapshotID'] = @snapshot_id
  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



337
338
339
# File 'lib/comet/models/backup_job_detail.rb', line 337

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