comet_backup_ruby_sdk 2.40.0 → 2.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile.lock +1 -1
  4. data/comet_backup_ruby_sdk.gemspec +1 -1
  5. data/lib/comet/comet_server.rb +264 -6
  6. data/lib/comet/definitions.rb +45 -7
  7. data/lib/comet/models/admin_options.rb +72 -0
  8. data/lib/comet/models/backup_job_detail.rb +12 -0
  9. data/lib/comet/models/block_info.rb +82 -0
  10. data/lib/comet/models/browse_proxmox_nodes_response.rb +99 -0
  11. data/lib/comet/models/browse_proxmox_response.rb +98 -0
  12. data/lib/comet/models/browse_proxmox_storage_response.rb +98 -0
  13. data/lib/comet/models/browse_vmware_datacenters_response.rb +100 -0
  14. data/lib/comet/models/browse_vmware_datastores_response.rb +100 -0
  15. data/lib/comet/models/browse_vmware_hosts_response.rb +100 -0
  16. data/lib/comet/models/browse_vmware_networks_response.rb +100 -0
  17. data/lib/comet/models/browse_vmware_response.rb +2 -0
  18. data/lib/comet/models/disk_drive.rb +16 -0
  19. data/lib/comet/models/dispatcher_list_snapshot_virtual_machines_response.rb +99 -0
  20. data/lib/comet/models/external_authentication_source.rb +3 -3
  21. data/lib/comet/models/hyper_vmachine_info.rb +57 -0
  22. data/lib/comet/models/hyper_vrestore_target_options.rb +73 -0
  23. data/lib/comet/models/office_365custom_setting_v2.rb +64 -6
  24. data/lib/comet/models/office_365mixed_virtual_account.rb +8 -8
  25. data/lib/comet/models/partition.rb +20 -0
  26. data/lib/comet/models/partition_conflict.rb +91 -0
  27. data/lib/comet/models/policy_options.rb +80 -0
  28. data/lib/comet/models/proxmox_connection.rb +72 -0
  29. data/lib/comet/models/proxmox_restore_target_options.rb +92 -0
  30. data/lib/comet/models/pvebackup_disk.rb +86 -0
  31. data/lib/comet/models/pvebackup_node.rb +100 -0
  32. data/lib/comet/models/pvebackup_vm.rb +122 -0
  33. data/lib/comet/models/pvedisk.rb +137 -0
  34. data/lib/comet/models/pveparams.rb +138 -0
  35. data/lib/comet/models/pverestore_selection.rb +94 -0
  36. data/lib/comet/models/pvestorage_name.rb +83 -0
  37. data/lib/comet/models/pvevm.rb +148 -0
  38. data/lib/comet/models/registration_lobby_connection.rb +11 -0
  39. data/lib/comet/models/remote_server_address.rb +3 -3
  40. data/lib/comet/models/remote_storage_option.rb +3 -3
  41. data/lib/comet/models/replica_server.rb +3 -3
  42. data/lib/comet/models/request_storage_vault_response_message.rb +17 -0
  43. data/lib/comet/models/restore_job_advanced_options.rb +35 -0
  44. data/lib/comet/models/retention_range.rb +18 -0
  45. data/lib/comet/models/schedule_config.rb +18 -0
  46. data/lib/comet/models/self_backup_export_options.rb +2 -2
  47. data/lib/comet/models/self_backup_target.rb +2 -2
  48. data/lib/comet/models/user_policy.rb +11 -0
  49. data/lib/comet/models/vmdisk_info.rb +105 -0
  50. data/lib/comet/models/vminfo.rb +137 -0
  51. data/lib/comet/models/vminfo_list.rb +80 -0
  52. data/lib/comet/models/vmware_datacenter_info.rb +74 -0
  53. data/lib/comet/models/vmware_datastore_info.rb +74 -0
  54. data/lib/comet/models/vmware_host_info.rb +74 -0
  55. data/lib/comet/models/vmware_machine_info.rb +1 -0
  56. data/lib/comet/models/vmware_network_info.rb +74 -0
  57. data/lib/comet/models/vmware_restore_target_options.rb +119 -0
  58. data/lib/comet_backup_ruby_sdk.rb +33 -0
  59. metadata +33 -2
@@ -22,6 +22,12 @@ module Comet
22
22
  # @type [String] destination_id
23
23
  attr_accessor :destination_id
24
24
 
25
+ # @type [String] profile_hash
26
+ attr_accessor :profile_hash
27
+
28
+ # @type [Comet::UserProfileConfig] profile
29
+ attr_accessor :profile
30
+
25
31
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
26
32
  attr_accessor :unknown_json_fields
27
33
 
@@ -33,6 +39,8 @@ module Comet
33
39
  @status = 0
34
40
  @message = ''
35
41
  @destination_id = ''
42
+ @profile_hash = ''
43
+ @profile = Comet::UserProfileConfig.new
36
44
  @unknown_json_fields = {}
37
45
  end
38
46
 
@@ -61,6 +69,13 @@ module Comet
61
69
  raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
62
70
 
63
71
  @destination_id = v
72
+ when 'ProfileHash'
73
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
74
+
75
+ @profile_hash = v
76
+ when 'Profile'
77
+ @profile = Comet::UserProfileConfig.new
78
+ @profile.from_hash(v)
64
79
  else
65
80
  @unknown_json_fields[k] = v
66
81
  end
@@ -73,6 +88,8 @@ module Comet
73
88
  ret['Status'] = @status
74
89
  ret['Message'] = @message
75
90
  ret['DestinationID'] = @destination_id
91
+ ret['ProfileHash'] = @profile_hash
92
+ ret['Profile'] = @profile
76
93
  @unknown_json_fields.each do |k, v|
77
94
  ret[k] = v
78
95
  end
@@ -107,6 +107,20 @@ module Comet
107
107
  # @type [Comet::MSSQLLoginArgs] ms_sql_connection
108
108
  attr_accessor :ms_sql_connection
109
109
 
110
+ # For RESTORETYPE_VMHOST
111
+ # This field is available in Comet 24.12.x and later.
112
+ # @type [Comet::VMwareRestoreTargetOptions] vmware_connection
113
+ attr_accessor :vmware_connection
114
+
115
+ # For RESTORETYPE_VMHOST
116
+ # This field is available in Comet 24.12.x and later.
117
+ # @type [Comet::HyperVRestoreTargetOptions] hyper_vconnection
118
+ attr_accessor :hyper_vconnection
119
+
120
+ # For RESTORETYPE_VMHOST
121
+ # @type [Comet::ProxmoxRestoreTargetOptions] proxmox_connection
122
+ attr_accessor :proxmox_connection
123
+
110
124
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
111
125
  attr_accessor :unknown_json_fields
112
126
 
@@ -128,6 +142,9 @@ module Comet
128
142
  @ssl_crt_file = ''
129
143
  @ssl_key_file = ''
130
144
  @ms_sql_connection = Comet::MSSQLLoginArgs.new
145
+ @vmware_connection = Comet::VMwareRestoreTargetOptions.new
146
+ @hyper_vconnection = Comet::HyperVRestoreTargetOptions.new
147
+ @proxmox_connection = Comet::ProxmoxRestoreTargetOptions.new
131
148
  @unknown_json_fields = {}
132
149
  end
133
150
 
@@ -219,6 +236,15 @@ module Comet
219
236
  when 'MsSqlConnection'
220
237
  @ms_sql_connection = Comet::MSSQLLoginArgs.new
221
238
  @ms_sql_connection.from_hash(v)
239
+ when 'VMwareConnection'
240
+ @vmware_connection = Comet::VMwareRestoreTargetOptions.new
241
+ @vmware_connection.from_hash(v)
242
+ when 'HyperVConnection'
243
+ @hyper_vconnection = Comet::HyperVRestoreTargetOptions.new
244
+ @hyper_vconnection.from_hash(v)
245
+ when 'ProxmoxConnection'
246
+ @proxmox_connection = Comet::ProxmoxRestoreTargetOptions.new
247
+ @proxmox_connection.from_hash(v)
222
248
  else
223
249
  @unknown_json_fields[k] = v
224
250
  end
@@ -254,6 +280,15 @@ module Comet
254
280
  unless @ms_sql_connection.nil?
255
281
  ret['MsSqlConnection'] = @ms_sql_connection
256
282
  end
283
+ unless @vmware_connection.nil?
284
+ ret['VMwareConnection'] = @vmware_connection
285
+ end
286
+ unless @hyper_vconnection.nil?
287
+ ret['HyperVConnection'] = @hyper_vconnection
288
+ end
289
+ unless @proxmox_connection.nil?
290
+ ret['ProxmoxConnection'] = @proxmox_connection
291
+ end
257
292
  @unknown_json_fields.each do |k, v|
258
293
  ret[k] = v
259
294
  end
@@ -34,6 +34,9 @@ module Comet
34
34
  # @type [Number] months
35
35
  attr_accessor :months
36
36
 
37
+ # @type [Number] years
38
+ attr_accessor :years
39
+
37
40
  # 0: Sunday, 6: Saturday
38
41
  # @type [Number] week_offset
39
42
  attr_accessor :week_offset
@@ -45,6 +48,9 @@ module Comet
45
48
  # @type [Number] month_offset
46
49
  attr_accessor :month_offset
47
50
 
51
+ # @type [Number] year_offset
52
+ attr_accessor :year_offset
53
+
48
54
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
49
55
  attr_accessor :unknown_json_fields
50
56
 
@@ -59,8 +65,10 @@ module Comet
59
65
  @days = 0
60
66
  @weeks = 0
61
67
  @months = 0
68
+ @years = 0
62
69
  @week_offset = 0
63
70
  @month_offset = 0
71
+ @year_offset = 0
64
72
  @unknown_json_fields = {}
65
73
  end
66
74
 
@@ -101,6 +109,10 @@ module Comet
101
109
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
102
110
 
103
111
  @months = v
112
+ when 'Years'
113
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
114
+
115
+ @years = v
104
116
  when 'WeekOffset'
105
117
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
106
118
 
@@ -109,6 +121,10 @@ module Comet
109
121
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
110
122
 
111
123
  @month_offset = v
124
+ when 'YearOffset'
125
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
126
+
127
+ @year_offset = v
112
128
  else
113
129
  @unknown_json_fields[k] = v
114
130
  end
@@ -124,8 +140,10 @@ module Comet
124
140
  ret['Days'] = @days
125
141
  ret['Weeks'] = @weeks
126
142
  ret['Months'] = @months
143
+ ret['Years'] = @years
127
144
  ret['WeekOffset'] = @week_offset
128
145
  ret['MonthOffset'] = @month_offset
146
+ ret['YearOffset'] = @year_offset
129
147
  @unknown_json_fields.each do |k, v|
130
148
  ret[k] = v
131
149
  end
@@ -39,6 +39,12 @@ module Comet
39
39
  # @type [Number] random_delay_secs
40
40
  attr_accessor :random_delay_secs
41
41
 
42
+ # @type [Number] selected_month
43
+ attr_accessor :selected_month
44
+
45
+ # @type [Number] selected_day
46
+ attr_accessor :selected_day
47
+
42
48
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
43
49
  attr_accessor :unknown_json_fields
44
50
 
@@ -54,6 +60,8 @@ module Comet
54
60
  @to_time = Comet::HourSchedConfig.new
55
61
  @days_select = Comet::DaysOfWeekConfig.new
56
62
  @random_delay_secs = 0
63
+ @selected_month = 0
64
+ @selected_day = 0
57
65
  @unknown_json_fields = {}
58
66
  end
59
67
 
@@ -99,6 +107,14 @@ module Comet
99
107
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
100
108
 
101
109
  @random_delay_secs = v
110
+ when 'SelectedMonth'
111
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
112
+
113
+ @selected_month = v
114
+ when 'SelectedDay'
115
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
116
+
117
+ @selected_day = v
102
118
  else
103
119
  @unknown_json_fields[k] = v
104
120
  end
@@ -121,6 +137,8 @@ module Comet
121
137
  unless @random_delay_secs.nil?
122
138
  ret['RandomDelaySecs'] = @random_delay_secs
123
139
  end
140
+ ret['SelectedMonth'] = @selected_month
141
+ ret['SelectedDay'] = @selected_day
124
142
  @unknown_json_fields.each do |k, v|
125
143
  ret[k] = v
126
144
  end
@@ -26,8 +26,8 @@ module Comet
26
26
  # @type [Number] compression
27
27
  attr_accessor :compression
28
28
 
29
- # The jobs database is often the largest component of the Server Self-Backup archive. By excluding
30
- # it, you could run the Server Self-Backup more often.
29
+ # The jobs database is often the largest component of the System Self-Backup archive. By excluding
30
+ # it, you could run the System Self-Backup more often.
31
31
  # @type [Boolean] exclude_jobs_db
32
32
  attr_accessor :exclude_jobs_db
33
33
 
@@ -36,8 +36,8 @@ module Comet
36
36
  # @type [Number] compression
37
37
  attr_accessor :compression
38
38
 
39
- # The jobs database is often the largest component of the Server Self-Backup archive. By excluding
40
- # it, you could run the Server Self-Backup more often.
39
+ # The jobs database is often the largest component of the System Self-Backup archive. By excluding
40
+ # it, you could run the System Self-Backup more often.
41
41
  # @type [Boolean] exclude_jobs_db
42
42
  attr_accessor :exclude_jobs_db
43
43
 
@@ -129,6 +129,11 @@ module Comet
129
129
  # @type [Number] random_delay_secs
130
130
  attr_accessor :random_delay_secs
131
131
 
132
+ # Rotate access keys of a conflicting jobs Storage Vault, if no update from the conflicting job for
133
+ # X hours. If value is 0, ROTATE_STORAGE_VAULT_KEYS_DEFAULT is used.
134
+ # @type [Number] rotate_storage_vault_keys_hours
135
+ attr_accessor :rotate_storage_vault_keys_hours
136
+
132
137
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
133
138
  attr_accessor :unknown_json_fields
134
139
 
@@ -155,6 +160,7 @@ module Comet
155
160
  @default_sources_with_osrestriction = {}
156
161
  @default_backup_rules = {}
157
162
  @random_delay_secs = 0
163
+ @rotate_storage_vault_keys_hours = 0
158
164
  @unknown_json_fields = {}
159
165
  end
160
166
 
@@ -311,6 +317,10 @@ module Comet
311
317
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
312
318
 
313
319
  @random_delay_secs = v
320
+ when 'RotateStorageVaultKeysHours'
321
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
322
+
323
+ @rotate_storage_vault_keys_hours = v
314
324
  else
315
325
  @unknown_json_fields[k] = v
316
326
  end
@@ -377,6 +387,7 @@ module Comet
377
387
  unless @random_delay_secs.nil?
378
388
  ret['RandomDelaySecs'] = @random_delay_secs
379
389
  end
390
+ ret['RotateStorageVaultKeysHours'] = @rotate_storage_vault_keys_hours
380
391
  @unknown_json_fields.each do |k, v|
381
392
  ret[k] = v
382
393
  end
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2020-2025 Comet Licensing Ltd.
4
+ # Please see the LICENSE file for usage information.
5
+ #
6
+ # SPDX-License-Identifier: MIT
7
+
8
+ require 'json'
9
+
10
+ module Comet
11
+
12
+ # VMDiskInfo is a typed class wrapper around the underlying Comet Server API data structure.
13
+ # This type is available in Comet 24.12.x and later.
14
+ class VMDiskInfo
15
+
16
+ # Relative path within this backup job snapshot to root disk files
17
+ # @type [String] path
18
+ attr_accessor :path
19
+
20
+ # The virtual size of the virtual disk
21
+ # @type [Number] size
22
+ attr_accessor :size
23
+
24
+ # Controller number where the disk is associated to
25
+ # @type [Number] controller
26
+ attr_accessor :controller
27
+
28
+ # Device number within the controller
29
+ # @type [Number] device_num
30
+ attr_accessor :device_num
31
+
32
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
33
+ attr_accessor :unknown_json_fields
34
+
35
+ def initialize
36
+ clear
37
+ end
38
+
39
+ def clear
40
+ @path = ''
41
+ @size = 0
42
+ @controller = 0
43
+ @device_num = 0
44
+ @unknown_json_fields = {}
45
+ end
46
+
47
+ # @param [String] json_string The complete object in JSON format
48
+ def from_json(json_string)
49
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
50
+
51
+ from_hash(JSON.parse(json_string))
52
+ end
53
+
54
+ # @param [Hash] obj The complete object as a Ruby hash
55
+ def from_hash(obj)
56
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
57
+
58
+ obj.each do |k, v|
59
+ case k
60
+ when 'Path'
61
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
62
+
63
+ @path = v
64
+ when 'Size'
65
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
66
+
67
+ @size = v
68
+ when 'Controller'
69
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
70
+
71
+ @controller = v
72
+ when 'DeviceNum'
73
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
74
+
75
+ @device_num = v
76
+ else
77
+ @unknown_json_fields[k] = v
78
+ end
79
+ end
80
+ end
81
+
82
+ # @return [Hash] The complete object as a Ruby hash
83
+ def to_hash
84
+ ret = {}
85
+ ret['Path'] = @path
86
+ ret['Size'] = @size
87
+ ret['Controller'] = @controller
88
+ ret['DeviceNum'] = @device_num
89
+ @unknown_json_fields.each do |k, v|
90
+ ret[k] = v
91
+ end
92
+ ret
93
+ end
94
+
95
+ # @return [Hash] The complete object as a Ruby hash
96
+ def to_h
97
+ to_hash
98
+ end
99
+
100
+ # @return [String] The complete object as a JSON string
101
+ def to_json(options = {})
102
+ to_hash.to_json(options)
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,137 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2020-2025 Comet Licensing Ltd.
4
+ # Please see the LICENSE file for usage information.
5
+ #
6
+ # SPDX-License-Identifier: MIT
7
+
8
+ require 'json'
9
+
10
+ module Comet
11
+
12
+ # VMInfo is a typed class wrapper around the underlying Comet Server API data structure.
13
+ # This type is available in Comet 24.12.x and later.
14
+ class VMInfo
15
+
16
+ # @type [String] id
17
+ attr_accessor :id
18
+
19
+ # @type [String] name
20
+ attr_accessor :name
21
+
22
+ # @type [Number] cpucores
23
+ attr_accessor :cpucores
24
+
25
+ # Bytes
26
+ # @type [Number] ram_bytes
27
+ attr_accessor :ram_bytes
28
+
29
+ # The BIOS mode of this machine e.g. "Legacy"|"UEFI"
30
+ # @type [String] firmware_type
31
+ attr_accessor :firmware_type
32
+
33
+ # Relative path to config file or directory, if supported by this Protected Item type
34
+ # @type [String] config_path
35
+ attr_accessor :config_path
36
+
37
+ # @type [Array<Comet::VMDiskInfo>] disks
38
+ attr_accessor :disks
39
+
40
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
41
+ attr_accessor :unknown_json_fields
42
+
43
+ def initialize
44
+ clear
45
+ end
46
+
47
+ def clear
48
+ @id = ''
49
+ @name = ''
50
+ @cpucores = 0
51
+ @ram_bytes = 0
52
+ @firmware_type = ''
53
+ @config_path = ''
54
+ @disks = []
55
+ @unknown_json_fields = {}
56
+ end
57
+
58
+ # @param [String] json_string The complete object in JSON format
59
+ def from_json(json_string)
60
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
61
+
62
+ from_hash(JSON.parse(json_string))
63
+ end
64
+
65
+ # @param [Hash] obj The complete object as a Ruby hash
66
+ def from_hash(obj)
67
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
68
+
69
+ obj.each do |k, v|
70
+ case k
71
+ when 'ID'
72
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
73
+
74
+ @id = v
75
+ when 'Name'
76
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
77
+
78
+ @name = v
79
+ when 'CPUCores'
80
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
81
+
82
+ @cpucores = v
83
+ when 'RamBytes'
84
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
85
+
86
+ @ram_bytes = v
87
+ when 'FirmwareType'
88
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
89
+
90
+ @firmware_type = v
91
+ when 'ConfigPath'
92
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
93
+
94
+ @config_path = v
95
+ when 'Disks'
96
+ if v.nil?
97
+ @disks = []
98
+ else
99
+ @disks = Array.new(v.length)
100
+ v.each_with_index do |v1, i1|
101
+ @disks[i1] = Comet::VMDiskInfo.new
102
+ @disks[i1].from_hash(v1)
103
+ end
104
+ end
105
+ else
106
+ @unknown_json_fields[k] = v
107
+ end
108
+ end
109
+ end
110
+
111
+ # @return [Hash] The complete object as a Ruby hash
112
+ def to_hash
113
+ ret = {}
114
+ ret['ID'] = @id
115
+ ret['Name'] = @name
116
+ ret['CPUCores'] = @cpucores
117
+ ret['RamBytes'] = @ram_bytes
118
+ ret['FirmwareType'] = @firmware_type
119
+ ret['ConfigPath'] = @config_path
120
+ ret['Disks'] = @disks
121
+ @unknown_json_fields.each do |k, v|
122
+ ret[k] = v
123
+ end
124
+ ret
125
+ end
126
+
127
+ # @return [Hash] The complete object as a Ruby hash
128
+ def to_h
129
+ to_hash
130
+ end
131
+
132
+ # @return [String] The complete object as a JSON string
133
+ def to_json(options = {})
134
+ to_hash.to_json(options)
135
+ end
136
+ end
137
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2020-2025 Comet Licensing Ltd.
4
+ # Please see the LICENSE file for usage information.
5
+ #
6
+ # SPDX-License-Identifier: MIT
7
+
8
+ require 'json'
9
+
10
+ module Comet
11
+
12
+ # VMInfoList is a typed class wrapper around the underlying Comet Server API data structure.
13
+ # This type is available in Comet 24.12.x and later.
14
+ class VMInfoList
15
+
16
+ # @type [Array<Comet::VMInfo>] vms
17
+ attr_accessor :vms
18
+
19
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
20
+ attr_accessor :unknown_json_fields
21
+
22
+ def initialize
23
+ clear
24
+ end
25
+
26
+ def clear
27
+ @vms = []
28
+ @unknown_json_fields = {}
29
+ end
30
+
31
+ # @param [String] json_string The complete object in JSON format
32
+ def from_json(json_string)
33
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
34
+
35
+ from_hash(JSON.parse(json_string))
36
+ end
37
+
38
+ # @param [Hash] obj The complete object as a Ruby hash
39
+ def from_hash(obj)
40
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
41
+
42
+ obj.each do |k, v|
43
+ case k
44
+ when 'VMs'
45
+ if v.nil?
46
+ @vms = []
47
+ else
48
+ @vms = Array.new(v.length)
49
+ v.each_with_index do |v1, i1|
50
+ @vms[i1] = Comet::VMInfo.new
51
+ @vms[i1].from_hash(v1)
52
+ end
53
+ end
54
+ else
55
+ @unknown_json_fields[k] = v
56
+ end
57
+ end
58
+ end
59
+
60
+ # @return [Hash] The complete object as a Ruby hash
61
+ def to_hash
62
+ ret = {}
63
+ ret['VMs'] = @vms
64
+ @unknown_json_fields.each do |k, v|
65
+ ret[k] = v
66
+ end
67
+ ret
68
+ end
69
+
70
+ # @return [Hash] The complete object as a Ruby hash
71
+ def to_h
72
+ to_hash
73
+ end
74
+
75
+ # @return [String] The complete object as a JSON string
76
+ def to_json(options = {})
77
+ to_hash.to_json(options)
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2020-2025 Comet Licensing Ltd.
4
+ # Please see the LICENSE file for usage information.
5
+ #
6
+ # SPDX-License-Identifier: MIT
7
+
8
+ require 'json'
9
+
10
+ module Comet
11
+
12
+ # VMwareDatacenterInfo is a typed class wrapper around the underlying Comet Server API data structure.
13
+ # VMwareDatacenterInfo describes a single VMware datacenter.
14
+ class VMwareDatacenterInfo
15
+
16
+ # @type [String] name
17
+ attr_accessor :name
18
+
19
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
20
+ attr_accessor :unknown_json_fields
21
+
22
+ def initialize
23
+ clear
24
+ end
25
+
26
+ def clear
27
+ @name = ''
28
+ @unknown_json_fields = {}
29
+ end
30
+
31
+ # @param [String] json_string The complete object in JSON format
32
+ def from_json(json_string)
33
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
34
+
35
+ from_hash(JSON.parse(json_string))
36
+ end
37
+
38
+ # @param [Hash] obj The complete object as a Ruby hash
39
+ def from_hash(obj)
40
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
41
+
42
+ obj.each do |k, v|
43
+ case k
44
+ when 'Name'
45
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
46
+
47
+ @name = v
48
+ else
49
+ @unknown_json_fields[k] = v
50
+ end
51
+ end
52
+ end
53
+
54
+ # @return [Hash] The complete object as a Ruby hash
55
+ def to_hash
56
+ ret = {}
57
+ ret['Name'] = @name
58
+ @unknown_json_fields.each do |k, v|
59
+ ret[k] = v
60
+ end
61
+ ret
62
+ end
63
+
64
+ # @return [Hash] The complete object as a Ruby hash
65
+ def to_h
66
+ to_hash
67
+ end
68
+
69
+ # @return [String] The complete object as a JSON string
70
+ def to_json(options = {})
71
+ to_hash.to_json(options)
72
+ end
73
+ end
74
+ end