comet_backup_ruby_sdk 2.41.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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +1 -1
  4. data/comet_backup_ruby_sdk.gemspec +1 -1
  5. data/lib/comet/comet_server.rb +95 -4
  6. data/lib/comet/definitions.rb +41 -7
  7. data/lib/comet/models/backup_job_detail.rb +12 -0
  8. data/lib/comet/models/block_info.rb +82 -0
  9. data/lib/comet/models/browse_proxmox_nodes_response.rb +99 -0
  10. data/lib/comet/models/browse_proxmox_response.rb +98 -0
  11. data/lib/comet/models/browse_proxmox_storage_response.rb +98 -0
  12. data/lib/comet/models/external_authentication_source.rb +3 -3
  13. data/lib/comet/models/office_365custom_setting_v2.rb +16 -5
  14. data/lib/comet/models/partition.rb +20 -0
  15. data/lib/comet/models/proxmox_connection.rb +72 -0
  16. data/lib/comet/models/proxmox_restore_target_options.rb +92 -0
  17. data/lib/comet/models/pvebackup_disk.rb +86 -0
  18. data/lib/comet/models/pvebackup_node.rb +100 -0
  19. data/lib/comet/models/pvebackup_vm.rb +122 -0
  20. data/lib/comet/models/pvedisk.rb +137 -0
  21. data/lib/comet/models/pveparams.rb +138 -0
  22. data/lib/comet/models/pverestore_selection.rb +94 -0
  23. data/lib/comet/models/pvestorage_name.rb +83 -0
  24. data/lib/comet/models/pvevm.rb +148 -0
  25. data/lib/comet/models/registration_lobby_connection.rb +11 -0
  26. data/lib/comet/models/remote_server_address.rb +3 -3
  27. data/lib/comet/models/remote_storage_option.rb +3 -3
  28. data/lib/comet/models/replica_server.rb +3 -3
  29. data/lib/comet/models/request_storage_vault_response_message.rb +17 -0
  30. data/lib/comet/models/restore_job_advanced_options.rb +11 -0
  31. data/lib/comet/models/retention_range.rb +18 -0
  32. data/lib/comet/models/schedule_config.rb +18 -0
  33. data/lib/comet/models/self_backup_export_options.rb +2 -2
  34. data/lib/comet/models/self_backup_target.rb +2 -2
  35. data/lib/comet/models/user_policy.rb +11 -0
  36. data/lib/comet_backup_ruby_sdk.rb +16 -0
  37. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c972fed511fa56a76cf96c42f8559faddcc003fc4378616bb5b91ec0d45ef210
4
- data.tar.gz: 945063cd41af3fb4b56728e2374e99c4463c18e7ca68ee6a916829d31c406959
3
+ metadata.gz: b1ce12d259b4709b8f945a3ab03c5aaa3affa2bf686d8db13a579efa734352ca
4
+ data.tar.gz: dccfbf9c48da859196a0ea45fd546e48869c696860b19b9e0e17275a9ad00ff1
5
5
  SHA512:
6
- metadata.gz: 4d84b541b325ded6b7f1ee7b111a2ef8110b2774b3097c1e1aa26d282543ece740fc6ec5eefaa14a6393f737c3525f4bc316f65b9ddbd135a3b664b3d3890d56
7
- data.tar.gz: d5e8829fe4a04d7f792f4a982f9fe2ae4296de440845d494ccae9d644c8c3743bf7300db0460ba7015355cc821b862b7a28de7ce75d124822923e77b5624cb42
6
+ metadata.gz: ca9afca76f9b80e1f66e22c05bacd2615be2f644f8b3d6db2caf5eb8f25736bb2e4afa73648dd6eaae0985ec2a92626edbba4a523edc43a410733ae7c2ab7f17
7
+ data.tar.gz: 9e6c3ce78d176e8c37966a00e2a33e835da5ed4e32295223d8e4fb9a07530d4a593288732b2a2c714690948ea3a3c4d5f7bf13455abce00ed2f791766e0cd825
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2025-08-15 v2.42.0
4
+
5
+ - Based on Comet 25.6.8
6
+ - Add support for Proxmox
7
+ - Add profile hash to some API endpoints
8
+
3
9
  ## 2025-02-17 v2.41.0
4
10
  Update to 24.12.5
5
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comet_backup_ruby_sdk (2.41.0)
4
+ comet_backup_ruby_sdk (2.42.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -12,7 +12,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
12
12
 
13
13
  Gem::Specification.new do |spec|
14
14
  spec.name = 'comet_backup_ruby_sdk'
15
- spec.version = '2.41.0'
15
+ spec.version = '2.42.0'
16
16
  spec.authors = ['Comet Licensing Ltd.']
17
17
  spec.email = ['hello@cometbackup.com']
18
18
 
@@ -1749,6 +1749,87 @@ module Comet
1749
1749
  ret
1750
1750
  end
1751
1751
 
1752
+ # AdminDispatcherRequestBrowseProxmox
1753
+ #
1754
+ # Request a list of Proxmox virtual machines and containers.
1755
+ #
1756
+ # You must supply administrator authentication credentials to use this API.
1757
+ # This API requires the Auth Role to be enabled.
1758
+ #
1759
+ # @param [String] target_id The live connection GUID
1760
+ # @param [Comet::ProxmoxConnection] credentials The Proxmox connection settings
1761
+ # @return [Comet::BrowseProxmoxResponse]
1762
+ def admin_dispatcher_request_browse_proxmox(target_id, credentials)
1763
+ submit_params = {}
1764
+ raise TypeError, "'target_id' expected String, got #{target_id.class}" unless target_id.is_a? String
1765
+
1766
+ submit_params['TargetID'] = target_id
1767
+ raise TypeError, "'credentials' expected Comet::ProxmoxConnection, got #{credentials.class}" unless credentials.is_a? Comet::ProxmoxConnection
1768
+
1769
+ submit_params['Credentials'] = credentials.to_json
1770
+
1771
+ body = perform_request('api/v1/admin/dispatcher/request-browse-proxmox', submit_params)
1772
+ json_body = JSON.parse body
1773
+ check_status json_body
1774
+ ret = Comet::BrowseProxmoxResponse.new
1775
+ ret.from_hash(json_body)
1776
+ ret
1777
+ end
1778
+
1779
+ # AdminDispatcherRequestBrowseProxmoxNodes
1780
+ #
1781
+ # Request a list of Proxmox nodes.
1782
+ #
1783
+ # You must supply administrator authentication credentials to use this API.
1784
+ # This API requires the Auth Role to be enabled.
1785
+ #
1786
+ # @param [String] target_id The live connection GUID
1787
+ # @param [Comet::SSHConnection] credentials The SSH connection settings
1788
+ # @return [Comet::BrowseProxmoxNodesResponse]
1789
+ def admin_dispatcher_request_browse_proxmox_nodes(target_id, credentials)
1790
+ submit_params = {}
1791
+ raise TypeError, "'target_id' expected String, got #{target_id.class}" unless target_id.is_a? String
1792
+
1793
+ submit_params['TargetID'] = target_id
1794
+ raise TypeError, "'credentials' expected Comet::SSHConnection, got #{credentials.class}" unless credentials.is_a? Comet::SSHConnection
1795
+
1796
+ submit_params['Credentials'] = credentials.to_json
1797
+
1798
+ body = perform_request('api/v1/admin/dispatcher/request-browse-proxmox/nodes', submit_params)
1799
+ json_body = JSON.parse body
1800
+ check_status json_body
1801
+ ret = Comet::BrowseProxmoxNodesResponse.new
1802
+ ret.from_hash(json_body)
1803
+ ret
1804
+ end
1805
+
1806
+ # AdminDispatcherRequestBrowseProxmoxStorage
1807
+ #
1808
+ # Request a list of configured Proxmox storage.
1809
+ #
1810
+ # You must supply administrator authentication credentials to use this API.
1811
+ # This API requires the Auth Role to be enabled.
1812
+ #
1813
+ # @param [String] target_id The live connection GUID
1814
+ # @param [Comet::SSHConnection] credentials The SSH connection settings
1815
+ # @return [Comet::BrowseProxmoxStorageResponse]
1816
+ def admin_dispatcher_request_browse_proxmox_storage(target_id, credentials)
1817
+ submit_params = {}
1818
+ raise TypeError, "'target_id' expected String, got #{target_id.class}" unless target_id.is_a? String
1819
+
1820
+ submit_params['TargetID'] = target_id
1821
+ raise TypeError, "'credentials' expected Comet::SSHConnection, got #{credentials.class}" unless credentials.is_a? Comet::SSHConnection
1822
+
1823
+ submit_params['Credentials'] = credentials.to_json
1824
+
1825
+ body = perform_request('api/v1/admin/dispatcher/request-browse-proxmox/storage', submit_params)
1826
+ json_body = JSON.parse body
1827
+ check_status json_body
1828
+ ret = Comet::BrowseProxmoxStorageResponse.new
1829
+ ret.from_hash(json_body)
1830
+ ret
1831
+ end
1832
+
1752
1833
  # AdminDispatcherRequestBrowseVmware
1753
1834
  #
1754
1835
  # Request a list of VMware vSphere virtual machines.
@@ -2413,8 +2494,9 @@ module Comet
2413
2494
  #
2414
2495
  # @param [String] target_id The live connection GUID
2415
2496
  # @param [String] destination The Storage Vault GUID
2497
+ # @param [Boolean] allow_unsafe (Optional) Allow legacy Storage Vault unlocking, which is unsafe in some cases.
2416
2498
  # @return [Comet::CometAPIResponseMessage]
2417
- def admin_dispatcher_unlock(target_id, destination)
2499
+ def admin_dispatcher_unlock(target_id, destination, allow_unsafe = nil)
2418
2500
  submit_params = {}
2419
2501
  raise TypeError, "'target_id' expected String, got #{target_id.class}" unless target_id.is_a? String
2420
2502
 
@@ -2422,6 +2504,9 @@ module Comet
2422
2504
  raise TypeError, "'destination' expected String, got #{destination.class}" unless destination.is_a? String
2423
2505
 
2424
2506
  submit_params['Destination'] = destination
2507
+ unless allow_unsafe.nil?
2508
+ submit_params['AllowUnsafe'] = (allow_unsafe ? 1 : 0)
2509
+ end
2425
2510
 
2426
2511
  body = perform_request('api/v1/admin/dispatcher/unlock', submit_params)
2427
2512
  json_body = JSON.parse body
@@ -4231,8 +4316,9 @@ module Comet
4231
4316
  # @param [String] storage_provider ID for the storage template destination
4232
4317
  # @param [String] self_address (Optional) The external URL for this server. Used to resolve conflicts
4233
4318
  # @param [String] device_id (Optional) The ID of the device to be added as a associated device of the Storage Vault
4319
+ # @param [String] profile_hash (Optional) The profile hash of the user profile
4234
4320
  # @return [Comet::RequestStorageVaultResponseMessage]
4235
- def admin_request_storage_vault(target_user, storage_provider, self_address = nil, device_id = nil)
4321
+ def admin_request_storage_vault(target_user, storage_provider, self_address = nil, device_id = nil, profile_hash = nil)
4236
4322
  submit_params = {}
4237
4323
  raise TypeError, "'target_user' expected String, got #{target_user.class}" unless target_user.is_a? String
4238
4324
 
@@ -4252,6 +4338,11 @@ module Comet
4252
4338
 
4253
4339
  submit_params['DeviceID'] = device_id
4254
4340
  end
4341
+ unless profile_hash.nil?
4342
+ raise TypeError, "'profile_hash' expected String, got #{profile_hash.class}" unless profile_hash.is_a? String
4343
+
4344
+ submit_params['ProfileHash'] = profile_hash
4345
+ end
4255
4346
 
4256
4347
  body = perform_request('api/v1/admin/request-storage-vault', submit_params)
4257
4348
  json_body = JSON.parse body
@@ -4413,7 +4504,7 @@ module Comet
4413
4504
  # @param [Comet::UserProfileConfig] profile_data Modified user profile
4414
4505
  # @param [String] require_hash Previous hash parameter
4415
4506
  # @param [Comet::AdminOptions] admin_options (Optional) Instructions for modifying user profile
4416
- # @return [Comet::CometAPIResponseMessage]
4507
+ # @return [Comet::GetProfileAndHashResponseMessage]
4417
4508
  def admin_set_user_profile_hash(target_user, profile_data, require_hash, admin_options = nil)
4418
4509
  submit_params = {}
4419
4510
  raise TypeError, "'target_user' expected String, got #{target_user.class}" unless target_user.is_a? String
@@ -4434,7 +4525,7 @@ module Comet
4434
4525
  body = perform_request('api/v1/admin/set-user-profile-hash', submit_params)
4435
4526
  json_body = JSON.parse body
4436
4527
  check_status json_body
4437
- ret = Comet::CometAPIResponseMessage.new
4528
+ ret = Comet::GetProfileAndHashResponseMessage.new
4438
4529
  ret.from_hash(json_body)
4439
4530
  ret
4440
4531
  end
@@ -7,13 +7,13 @@
7
7
 
8
8
  module Comet
9
9
 
10
- APPLICATION_VERSION = '24.12.5'
10
+ APPLICATION_VERSION = '25.6.8'
11
11
 
12
- APPLICATION_VERSION_MAJOR = 24
12
+ APPLICATION_VERSION_MAJOR = 25
13
13
 
14
- APPLICATION_VERSION_MINOR = 12
14
+ APPLICATION_VERSION_MINOR = 6
15
15
 
16
- APPLICATION_VERSION_REVISION = 5
16
+ APPLICATION_VERSION_REVISION = 8
17
17
 
18
18
  # AutoRetentionLevel: The system will automatically choose how often to run an automatic Retention Pass after each backup job.
19
19
  BACKUPJOBAUTORETENTION_AUTOMATIC = 0
@@ -105,6 +105,9 @@ module Comet
105
105
 
106
106
  DESTINATIONTYPE___INVALID = 0
107
107
 
108
+ # Storage type that is applied when Storage Gateway fails to launch correctly
109
+ DESTINATIONTYPE_ERROR = 1
110
+
108
111
  # S3-compatible, or a specific S3 service such as AWS S3, Wasabi, or iDrive e2
109
112
  DESTINATIONTYPE_S3 = 1000
110
113
 
@@ -236,6 +239,9 @@ module Comet
236
239
  # VMware
237
240
  ENGINE_BUILTIN_VMWARE = 'engine1/vmware'
238
241
 
242
+ # Proxmox (PVE)
243
+ ENGINE_BUILTIN_PROXMOX = 'engine1/proxmox'
244
+
239
245
  # FtpsModeType: Use plain FTP, do not use FTPS.
240
246
  FTPS_MODE_PLAINTEXT = 0
241
247
 
@@ -433,6 +439,8 @@ New code should explicitly use OBJECT_LOCK_ON / OBJECT_LOCK_OFF instead.
433
439
 
434
440
  OFFICE365_REGION_US_DOD = 'USGovtGccDoDCloud'
435
441
 
442
+ OFFICE365_REGION_PUBLIC_TEST = 'GlobalPublicCloudTest'
443
+
436
444
  # ExtraFileExclusionOSRestriction: Applies to any device
437
445
  OS_ANY = 0
438
446
 
@@ -466,6 +474,10 @@ New code should explicitly use OBJECT_LOCK_ON / OBJECT_LOCK_OFF instead.
466
474
  # OidcProvider
467
475
  PROVIDER_DASHBOARD = 'dashboard'
468
476
 
477
+ PROXMOX_TYPE_VM = 'qemu'
478
+
479
+ PROXMOX_TYPE_CONTAINER = 'lxc'
480
+
469
481
  # PSAType
470
482
  PSA_TYPE_GENERIC = 0
471
483
 
@@ -475,6 +487,14 @@ New code should explicitly use OBJECT_LOCK_ON / OBJECT_LOCK_OFF instead.
475
487
  # PSAType
476
488
  PSA_TYPE_SYNCRO = 2
477
489
 
490
+ PVE_BACKUP_METHOD_STOP = 'stop'
491
+
492
+ PVE_BACKUP_METHOD_SUSPEND = 'suspend'
493
+
494
+ PVE_BACKUP_METHOD_SNAPSHOT = 'snapshot'
495
+
496
+ PVE_BACKUP_METHOD_DEFAULT = PVE_BACKUP_METHOD_SNAPSHOT
497
+
478
498
  RELEASE_CODENAME = 'Voyager'
479
499
 
480
500
  # RemoteServerType: Comet Server
@@ -619,7 +639,7 @@ New code should explicitly use OBJECT_LOCK_ON / OBJECT_LOCK_OFF instead.
619
639
  # RetentionRangeType: Uses Timestamp
620
640
  RETENTIONRANGE_NEWER_THAN_X = 901
621
641
 
622
- # RetentionRangeType: Uses Days, Weeks, Months
642
+ # RetentionRangeType: Uses Days, Weeks, Months, Years
623
643
  RETENTIONRANGE_JOBS_SINCE = 902
624
644
 
625
645
  # RetentionRangeType: Uses Days
@@ -644,11 +664,19 @@ New code should explicitly use OBJECT_LOCK_ON / OBJECT_LOCK_OFF instead.
644
664
  # RetentionRangeType: Uses Jobs
645
665
  RETENTIONRANGE_LAST_X_BACKUPS_ONE_FOR_EACH_MONTH = 909
646
666
 
667
+ # RetentionRangeType: Uses Jobs
668
+ RETENTIONRANGE_LAST_X_BACKUPS_ONE_FOR_EACH_YEAR = 910
669
+
670
+ # RetentionRangeType: Uses Years, YearOffset
671
+ RETENTIONRANGE_FIRST_JOB_FOR_LAST_X_YEARS = 911
672
+
647
673
  # RetentionRangeType
648
- RETENTIONRANGE__HIGHEST = 909
674
+ RETENTIONRANGE__HIGHEST = 911
649
675
 
650
676
  RETENTIONRANGE_MAXINT = 1_125_899_906_842_624
651
677
 
678
+ ROTATE_STORAGE_VAULT_KEYS_DEFAULT = 48
679
+
652
680
  SCHEDULE_FREQUENCY_LOWEST = 8010
653
681
 
654
682
  # SecondsPast should be a Unix timestamp, in seconds
@@ -669,7 +697,10 @@ New code should explicitly use OBJECT_LOCK_ON / OBJECT_LOCK_OFF instead.
669
697
  # SecondsPast is the number of seconds per period. Offset: Shunt seconds after unix epoch
670
698
  SCHEDULE_FREQUENCY_PERIODIC = 8015
671
699
 
672
- SCHEDULE_FREQUENCY_HIGHEST = 8015
700
+ # SecondsPast is the number of seconds past 00:00 1st, in the device's local timezone.
701
+ SCHEDULE_FREQUENCY_YEARLY = 8016
702
+
703
+ SCHEDULE_FREQUENCY_HIGHEST = 8016
673
704
 
674
705
  # Maximum random delay (5 hours)
675
706
  SCHEDULE_MAX_RANDOM_DELAY_SECS = 18_000
@@ -1021,6 +1052,9 @@ New code should explicitly use OBJECT_LOCK_ON / OBJECT_LOCK_OFF instead.
1021
1052
  # StoredObjectType
1022
1053
  STOREDOBJECTTYPE_VMDK_SYMLINK = 'vmdksymlink'
1023
1054
 
1055
+ # StoredObjectType
1056
+ STOREDOBJECTTYPE_VMDK_WINDEDUP = 'vmdkwindedup'
1057
+
1024
1058
  # StoredObjectType
1025
1059
  STOREDOBJECTTYPE_VIRTUALIMAGE_DISK = 'virtualimagedisk'
1026
1060
 
@@ -99,6 +99,10 @@ module Comet
99
99
  # @type [Number] total_unlicensed_mails_count
100
100
  attr_accessor :total_unlicensed_mails_count
101
101
 
102
+ # The CRC32 of the billing data for this job.
103
+ # @type [Number] billing_crc_32
104
+ attr_accessor :billing_crc_32
105
+
102
106
  # If this field is present, this job did not perform some work because the Storage Vault is
103
107
  # currently busy.
104
108
  # This field is available in Comet 24.9.2 and later.
@@ -155,6 +159,7 @@ module Comet
155
159
  @total_accounts_count = 0
156
160
  @total_licensed_mails_count = 0
157
161
  @total_unlicensed_mails_count = 0
162
+ @billing_crc_32 = 0
158
163
  @conflicting_job_id = ''
159
164
  @cancellation_id = ''
160
165
  @progress = Comet::BackupJobProgress.new
@@ -276,6 +281,10 @@ module Comet
276
281
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
277
282
 
278
283
  @total_unlicensed_mails_count = v
284
+ when 'BillingCrc32'
285
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
286
+
287
+ @billing_crc_32 = v
279
288
  when 'ConflictingJobID'
280
289
  raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
281
290
 
@@ -343,6 +352,9 @@ module Comet
343
352
  unless @total_unlicensed_mails_count.nil?
344
353
  ret['TotalUnlicensedMailsCount'] = @total_unlicensed_mails_count
345
354
  end
355
+ unless @billing_crc_32.nil?
356
+ ret['BillingCrc32'] = @billing_crc_32
357
+ end
346
358
  unless @conflicting_job_id.nil?
347
359
  ret['ConflictingJobID'] = @conflicting_job_id
348
360
  end
@@ -0,0 +1,82 @@
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
+ # BlockInfo is a typed class wrapper around the underlying Comet Server API data structure.
13
+ class BlockInfo
14
+
15
+ # @type [String] device_id
16
+ attr_accessor :device_id
17
+
18
+ # @type [String] disk_node_name
19
+ attr_accessor :disk_node_name
20
+
21
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
22
+ attr_accessor :unknown_json_fields
23
+
24
+ def initialize
25
+ clear
26
+ end
27
+
28
+ def clear
29
+ @device_id = ''
30
+ @disk_node_name = ''
31
+ @unknown_json_fields = {}
32
+ end
33
+
34
+ # @param [String] json_string The complete object in JSON format
35
+ def from_json(json_string)
36
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
37
+
38
+ from_hash(JSON.parse(json_string))
39
+ end
40
+
41
+ # @param [Hash] obj The complete object as a Ruby hash
42
+ def from_hash(obj)
43
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
44
+
45
+ obj.each do |k, v|
46
+ case k
47
+ when 'DeviceID'
48
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
49
+
50
+ @device_id = v
51
+ when 'DiskNodeName'
52
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
53
+
54
+ @disk_node_name = v
55
+ else
56
+ @unknown_json_fields[k] = v
57
+ end
58
+ end
59
+ end
60
+
61
+ # @return [Hash] The complete object as a Ruby hash
62
+ def to_hash
63
+ ret = {}
64
+ ret['DeviceID'] = @device_id
65
+ ret['DiskNodeName'] = @disk_node_name
66
+ @unknown_json_fields.each do |k, v|
67
+ ret[k] = v
68
+ end
69
+ ret
70
+ end
71
+
72
+ # @return [Hash] The complete object as a Ruby hash
73
+ def to_h
74
+ to_hash
75
+ end
76
+
77
+ # @return [String] The complete object as a JSON string
78
+ def to_json(options = {})
79
+ to_hash.to_json(options)
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,99 @@
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
+ # BrowseProxmoxNodesResponse is a typed class wrapper around the underlying Comet Server API data structure.
13
+ class BrowseProxmoxNodesResponse
14
+
15
+ # If the operation was successful, the status will be in the 200-299 range.
16
+ # @type [Number] status
17
+ attr_accessor :status
18
+
19
+ # @type [String] message
20
+ attr_accessor :message
21
+
22
+ # @type [Array<String>] nodes
23
+ attr_accessor :nodes
24
+
25
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
26
+ attr_accessor :unknown_json_fields
27
+
28
+ def initialize
29
+ clear
30
+ end
31
+
32
+ def clear
33
+ @status = 0
34
+ @message = ''
35
+ @nodes = []
36
+ @unknown_json_fields = {}
37
+ end
38
+
39
+ # @param [String] json_string The complete object in JSON format
40
+ def from_json(json_string)
41
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
42
+
43
+ from_hash(JSON.parse(json_string))
44
+ end
45
+
46
+ # @param [Hash] obj The complete object as a Ruby hash
47
+ def from_hash(obj)
48
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
49
+
50
+ obj.each do |k, v|
51
+ case k
52
+ when 'Status'
53
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
54
+
55
+ @status = v
56
+ when 'Message'
57
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
58
+
59
+ @message = v
60
+ when 'Nodes'
61
+ if v.nil?
62
+ @nodes = []
63
+ else
64
+ @nodes = Array.new(v.length)
65
+ v.each_with_index do |v1, i1|
66
+ raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String
67
+
68
+ @nodes[i1] = v1
69
+ end
70
+ end
71
+ else
72
+ @unknown_json_fields[k] = v
73
+ end
74
+ end
75
+ end
76
+
77
+ # @return [Hash] The complete object as a Ruby hash
78
+ def to_hash
79
+ ret = {}
80
+ ret['Status'] = @status
81
+ ret['Message'] = @message
82
+ ret['Nodes'] = @nodes
83
+ @unknown_json_fields.each do |k, v|
84
+ ret[k] = v
85
+ end
86
+ ret
87
+ end
88
+
89
+ # @return [Hash] The complete object as a Ruby hash
90
+ def to_h
91
+ to_hash
92
+ end
93
+
94
+ # @return [String] The complete object as a JSON string
95
+ def to_json(options = {})
96
+ to_hash.to_json(options)
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,98 @@
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
+ # BrowseProxmoxResponse is a typed class wrapper around the underlying Comet Server API data structure.
13
+ class BrowseProxmoxResponse
14
+
15
+ # If the operation was successful, the status will be in the 200-299 range.
16
+ # @type [Number] status
17
+ attr_accessor :status
18
+
19
+ # @type [String] message
20
+ attr_accessor :message
21
+
22
+ # @type [Array<Comet::PVEVM>] vms
23
+ attr_accessor :vms
24
+
25
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
26
+ attr_accessor :unknown_json_fields
27
+
28
+ def initialize
29
+ clear
30
+ end
31
+
32
+ def clear
33
+ @status = 0
34
+ @message = ''
35
+ @vms = []
36
+ @unknown_json_fields = {}
37
+ end
38
+
39
+ # @param [String] json_string The complete object in JSON format
40
+ def from_json(json_string)
41
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
42
+
43
+ from_hash(JSON.parse(json_string))
44
+ end
45
+
46
+ # @param [Hash] obj The complete object as a Ruby hash
47
+ def from_hash(obj)
48
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
49
+
50
+ obj.each do |k, v|
51
+ case k
52
+ when 'Status'
53
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
54
+
55
+ @status = v
56
+ when 'Message'
57
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
58
+
59
+ @message = v
60
+ when 'VMs'
61
+ if v.nil?
62
+ @vms = []
63
+ else
64
+ @vms = Array.new(v.length)
65
+ v.each_with_index do |v1, i1|
66
+ @vms[i1] = Comet::PVEVM.new
67
+ @vms[i1].from_hash(v1)
68
+ end
69
+ end
70
+ else
71
+ @unknown_json_fields[k] = v
72
+ end
73
+ end
74
+ end
75
+
76
+ # @return [Hash] The complete object as a Ruby hash
77
+ def to_hash
78
+ ret = {}
79
+ ret['Status'] = @status
80
+ ret['Message'] = @message
81
+ ret['VMs'] = @vms
82
+ @unknown_json_fields.each do |k, v|
83
+ ret[k] = v
84
+ end
85
+ ret
86
+ end
87
+
88
+ # @return [Hash] The complete object as a Ruby hash
89
+ def to_h
90
+ to_hash
91
+ end
92
+
93
+ # @return [String] The complete object as a JSON string
94
+ def to_json(options = {})
95
+ to_hash.to_json(options)
96
+ end
97
+ end
98
+ end