comet_backup_ruby_sdk 2.41.0 → 2.43.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +1 -1
- data/comet_backup_ruby_sdk.gemspec +1 -1
- data/lib/comet/comet_server.rb +253 -12
- data/lib/comet/definitions.rb +51 -7
- data/lib/comet/models/backup_job_advanced_options.rb +10 -0
- data/lib/comet/models/backup_job_detail.rb +12 -0
- data/lib/comet/models/backup_rule_config.rb +10 -0
- data/lib/comet/models/branding_options.rb +30 -0
- data/lib/comet/models/branding_properties.rb +30 -0
- data/lib/comet/models/browse_proxmox_nodes_response.rb +99 -0
- data/lib/comet/models/browse_proxmox_response.rb +98 -0
- data/lib/comet/models/browse_proxmox_storage_response.rb +98 -0
- data/lib/comet/models/dispatch_with_job_idresponse.rb +94 -0
- data/lib/comet/models/external_authentication_source.rb +3 -3
- data/lib/comet/models/office_365custom_setting_v2.rb +16 -5
- data/lib/comet/models/partition.rb +20 -0
- data/lib/comet/models/private_branding_properties.rb +30 -0
- data/lib/comet/models/protected_item_with_backup_rules_response.rb +119 -0
- data/lib/comet/models/proxmox_connection.rb +72 -0
- data/lib/comet/models/proxmox_restore_target_options.rb +92 -0
- data/lib/comet/models/pvebackup_disk.rb +92 -0
- data/lib/comet/models/pvebackup_node.rb +105 -0
- data/lib/comet/models/pvebackup_vm.rb +128 -0
- data/lib/comet/models/pvedisk.rb +138 -0
- data/lib/comet/models/pveparams.rb +140 -0
- data/lib/comet/models/pvestorage_name.rb +83 -0
- data/lib/comet/models/pvevm.rb +150 -0
- data/lib/comet/models/registration_lobby_connection.rb +11 -0
- data/lib/comet/models/remote_server_address.rb +3 -3
- data/lib/comet/models/remote_storage_option.rb +3 -3
- data/lib/comet/models/replica_server.rb +3 -3
- data/lib/comet/models/request_storage_vault_response_message.rb +17 -0
- data/lib/comet/models/restore_job_advanced_options.rb +11 -0
- data/lib/comet/models/retention_range.rb +18 -0
- data/lib/comet/models/schedule_config.rb +18 -0
- data/lib/comet/models/self_backup_export_options.rb +2 -2
- data/lib/comet/models/self_backup_target.rb +2 -2
- data/lib/comet/models/source_config.rb +7 -0
- data/lib/comet/models/user_policy.rb +11 -0
- data/lib/comet/models/user_profile_config.rb +8 -0
- data/lib/comet/models/vault_snapshot.rb +19 -0
- data/lib/comet/models/windows_code_sign_properties.rb +30 -0
- data/lib/comet_backup_ruby_sdk.rb +14 -1
- metadata +16 -2
|
@@ -93,6 +93,18 @@ module Comet
|
|
|
93
93
|
# @type [String] windows_code_sign_azure_tenant_id
|
|
94
94
|
attr_accessor :windows_code_sign_azure_tenant_id
|
|
95
95
|
|
|
96
|
+
# URL of the SAS Relic server, with protocol (https://) and trailing slash
|
|
97
|
+
# @type [String] windows_code_sign_relic_server_url
|
|
98
|
+
attr_accessor :windows_code_sign_relic_server_url
|
|
99
|
+
|
|
100
|
+
# The SAS Relic client keypair in PEM format
|
|
101
|
+
# @type [String] windows_code_sign_relic_keypair_file
|
|
102
|
+
attr_accessor :windows_code_sign_relic_keypair_file
|
|
103
|
+
|
|
104
|
+
# The name of the key to select on the remote SAS Relic server
|
|
105
|
+
# @type [String] windows_code_sign_relic_key_name
|
|
106
|
+
attr_accessor :windows_code_sign_relic_key_name
|
|
107
|
+
|
|
96
108
|
# @type [Comet::MacOSCodeSignProperties] mac_oscode_sign
|
|
97
109
|
attr_accessor :mac_oscode_sign
|
|
98
110
|
|
|
@@ -129,6 +141,9 @@ module Comet
|
|
|
129
141
|
@windows_code_sign_azure_app_secret_format = 0
|
|
130
142
|
@windows_code_sign_azure_app_secret = ''
|
|
131
143
|
@windows_code_sign_azure_tenant_id = ''
|
|
144
|
+
@windows_code_sign_relic_server_url = ''
|
|
145
|
+
@windows_code_sign_relic_keypair_file = ''
|
|
146
|
+
@windows_code_sign_relic_key_name = ''
|
|
132
147
|
@mac_oscode_sign = Comet::MacOSCodeSignProperties.new
|
|
133
148
|
@unknown_json_fields = {}
|
|
134
149
|
end
|
|
@@ -246,6 +261,18 @@ module Comet
|
|
|
246
261
|
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
247
262
|
|
|
248
263
|
@windows_code_sign_azure_tenant_id = v
|
|
264
|
+
when 'WindowsCodeSignRelicServerURL'
|
|
265
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
266
|
+
|
|
267
|
+
@windows_code_sign_relic_server_url = v
|
|
268
|
+
when 'WindowsCodeSignRelicKeypairFile'
|
|
269
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
270
|
+
|
|
271
|
+
@windows_code_sign_relic_keypair_file = v
|
|
272
|
+
when 'WindowsCodeSignRelicKeyName'
|
|
273
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
274
|
+
|
|
275
|
+
@windows_code_sign_relic_key_name = v
|
|
249
276
|
when 'MacOSCodeSign'
|
|
250
277
|
@mac_oscode_sign = Comet::MacOSCodeSignProperties.new
|
|
251
278
|
@mac_oscode_sign.from_hash(v)
|
|
@@ -283,6 +310,9 @@ module Comet
|
|
|
283
310
|
ret['WindowsCodeSignAzureAppSecretFormat'] = @windows_code_sign_azure_app_secret_format
|
|
284
311
|
ret['WindowsCodeSignAzureAppSecret'] = @windows_code_sign_azure_app_secret
|
|
285
312
|
ret['WindowsCodeSignAzureTenantID'] = @windows_code_sign_azure_tenant_id
|
|
313
|
+
ret['WindowsCodeSignRelicServerURL'] = @windows_code_sign_relic_server_url
|
|
314
|
+
ret['WindowsCodeSignRelicKeypairFile'] = @windows_code_sign_relic_keypair_file
|
|
315
|
+
ret['WindowsCodeSignRelicKeyName'] = @windows_code_sign_relic_key_name
|
|
286
316
|
ret['MacOSCodeSign'] = @mac_oscode_sign
|
|
287
317
|
@unknown_json_fields.each do |k, v|
|
|
288
318
|
ret[k] = v
|
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
# ProtectedItemWithBackupRulesResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
class ProtectedItemWithBackupRulesResponse
|
|
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
|
+
# The Protected Item configuration
|
|
23
|
+
# @type [Comet::SourceConfig] source
|
|
24
|
+
attr_accessor :source
|
|
25
|
+
|
|
26
|
+
# All backup rules for the Protected Item
|
|
27
|
+
# @type [Hash{String => Comet::BackupRuleConfig}] backup_rules
|
|
28
|
+
attr_accessor :backup_rules
|
|
29
|
+
|
|
30
|
+
# @type [String] profile_hash
|
|
31
|
+
attr_accessor :profile_hash
|
|
32
|
+
|
|
33
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
34
|
+
attr_accessor :unknown_json_fields
|
|
35
|
+
|
|
36
|
+
def initialize
|
|
37
|
+
clear
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def clear
|
|
41
|
+
@status = 0
|
|
42
|
+
@message = ''
|
|
43
|
+
@source = Comet::SourceConfig.new
|
|
44
|
+
@backup_rules = {}
|
|
45
|
+
@profile_hash = ''
|
|
46
|
+
@unknown_json_fields = {}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# @param [String] json_string The complete object in JSON format
|
|
50
|
+
def from_json(json_string)
|
|
51
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
52
|
+
|
|
53
|
+
from_hash(JSON.parse(json_string))
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
57
|
+
def from_hash(obj)
|
|
58
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
59
|
+
|
|
60
|
+
obj.each do |k, v|
|
|
61
|
+
case k
|
|
62
|
+
when 'Status'
|
|
63
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
|
64
|
+
|
|
65
|
+
@status = v
|
|
66
|
+
when 'Message'
|
|
67
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
68
|
+
|
|
69
|
+
@message = v
|
|
70
|
+
when 'Source'
|
|
71
|
+
@source = Comet::SourceConfig.new
|
|
72
|
+
@source.from_hash(v)
|
|
73
|
+
when 'BackupRules'
|
|
74
|
+
@backup_rules = {}
|
|
75
|
+
if v.nil?
|
|
76
|
+
@backup_rules = {}
|
|
77
|
+
else
|
|
78
|
+
v.each do |k1, v1|
|
|
79
|
+
@backup_rules[k1] = Comet::BackupRuleConfig.new
|
|
80
|
+
@backup_rules[k1].from_hash(v1)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
when 'ProfileHash'
|
|
84
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
85
|
+
|
|
86
|
+
@profile_hash = v
|
|
87
|
+
else
|
|
88
|
+
@unknown_json_fields[k] = v
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
94
|
+
def to_hash
|
|
95
|
+
ret = {}
|
|
96
|
+
ret['Status'] = @status
|
|
97
|
+
ret['Message'] = @message
|
|
98
|
+
ret['Source'] = @source
|
|
99
|
+
unless @backup_rules.nil?
|
|
100
|
+
ret['BackupRules'] = @backup_rules
|
|
101
|
+
end
|
|
102
|
+
ret['ProfileHash'] = @profile_hash
|
|
103
|
+
@unknown_json_fields.each do |k, v|
|
|
104
|
+
ret[k] = v
|
|
105
|
+
end
|
|
106
|
+
ret
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
110
|
+
def to_h
|
|
111
|
+
to_hash
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# @return [String] The complete object as a JSON string
|
|
115
|
+
def to_json(options = {})
|
|
116
|
+
to_hash.to_json(options)
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
# ProxmoxConnection is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
class ProxmoxConnection
|
|
14
|
+
|
|
15
|
+
# @type [Comet::SSHConnection] ssh
|
|
16
|
+
attr_accessor :ssh
|
|
17
|
+
|
|
18
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
19
|
+
attr_accessor :unknown_json_fields
|
|
20
|
+
|
|
21
|
+
def initialize
|
|
22
|
+
clear
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def clear
|
|
26
|
+
@ssh = Comet::SSHConnection.new
|
|
27
|
+
@unknown_json_fields = {}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# @param [String] json_string The complete object in JSON format
|
|
31
|
+
def from_json(json_string)
|
|
32
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
33
|
+
|
|
34
|
+
from_hash(JSON.parse(json_string))
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
38
|
+
def from_hash(obj)
|
|
39
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
40
|
+
|
|
41
|
+
obj.each do |k, v|
|
|
42
|
+
case k
|
|
43
|
+
when 'SSH'
|
|
44
|
+
@ssh = Comet::SSHConnection.new
|
|
45
|
+
@ssh.from_hash(v)
|
|
46
|
+
else
|
|
47
|
+
@unknown_json_fields[k] = v
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
53
|
+
def to_hash
|
|
54
|
+
ret = {}
|
|
55
|
+
ret['SSH'] = @ssh
|
|
56
|
+
@unknown_json_fields.each do |k, v|
|
|
57
|
+
ret[k] = v
|
|
58
|
+
end
|
|
59
|
+
ret
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
63
|
+
def to_h
|
|
64
|
+
to_hash
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# @return [String] The complete object as a JSON string
|
|
68
|
+
def to_json(options = {})
|
|
69
|
+
to_hash.to_json(options)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
# ProxmoxRestoreTargetOptions is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
class ProxmoxRestoreTargetOptions
|
|
14
|
+
|
|
15
|
+
# The name of the node to restore to in the Proxmox Cluster
|
|
16
|
+
# @type [String] node
|
|
17
|
+
attr_accessor :node
|
|
18
|
+
|
|
19
|
+
# @type [Comet::SSHConnection] ssh
|
|
20
|
+
attr_accessor :ssh
|
|
21
|
+
|
|
22
|
+
# the name of the storage location to restore to
|
|
23
|
+
# @type [String] storage
|
|
24
|
+
attr_accessor :storage
|
|
25
|
+
|
|
26
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
27
|
+
attr_accessor :unknown_json_fields
|
|
28
|
+
|
|
29
|
+
def initialize
|
|
30
|
+
clear
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def clear
|
|
34
|
+
@node = ''
|
|
35
|
+
@ssh = Comet::SSHConnection.new
|
|
36
|
+
@storage = ''
|
|
37
|
+
@unknown_json_fields = {}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @param [String] json_string The complete object in JSON format
|
|
41
|
+
def from_json(json_string)
|
|
42
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
43
|
+
|
|
44
|
+
from_hash(JSON.parse(json_string))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
48
|
+
def from_hash(obj)
|
|
49
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
50
|
+
|
|
51
|
+
obj.each do |k, v|
|
|
52
|
+
case k
|
|
53
|
+
when 'Node'
|
|
54
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
55
|
+
|
|
56
|
+
@node = v
|
|
57
|
+
when 'SSH'
|
|
58
|
+
@ssh = Comet::SSHConnection.new
|
|
59
|
+
@ssh.from_hash(v)
|
|
60
|
+
when 'Storage'
|
|
61
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
62
|
+
|
|
63
|
+
@storage = v
|
|
64
|
+
else
|
|
65
|
+
@unknown_json_fields[k] = v
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
71
|
+
def to_hash
|
|
72
|
+
ret = {}
|
|
73
|
+
ret['Node'] = @node
|
|
74
|
+
ret['SSH'] = @ssh
|
|
75
|
+
ret['Storage'] = @storage
|
|
76
|
+
@unknown_json_fields.each do |k, v|
|
|
77
|
+
ret[k] = v
|
|
78
|
+
end
|
|
79
|
+
ret
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
83
|
+
def to_h
|
|
84
|
+
to_hash
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# @return [String] The complete object as a JSON string
|
|
88
|
+
def to_json(options = {})
|
|
89
|
+
to_hash.to_json(options)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
# PVEBackupDisk is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
# This type is used in the EngineProps for an "engine1/proxmox" Protected Item. It represents the
|
|
14
|
+
# selection state for a single disk attached to a single Proxmox VM or LXC Container. It is expected
|
|
15
|
+
# to be user-configurable.
|
|
16
|
+
# This type is available in Comet 25.8.0 and later.
|
|
17
|
+
class PVEBackupDisk
|
|
18
|
+
|
|
19
|
+
# For a disk "scsi0", this field should contain: "scsi"
|
|
20
|
+
# @type [String] device
|
|
21
|
+
attr_accessor :device
|
|
22
|
+
|
|
23
|
+
# For a disk "scsi0", this field should contain: 0
|
|
24
|
+
# @type [Number] device_num
|
|
25
|
+
attr_accessor :device_num
|
|
26
|
+
|
|
27
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
28
|
+
attr_accessor :unknown_json_fields
|
|
29
|
+
|
|
30
|
+
def initialize
|
|
31
|
+
clear
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def clear
|
|
35
|
+
@device = ''
|
|
36
|
+
@device_num = 0
|
|
37
|
+
@unknown_json_fields = {}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# @param [String] json_string The complete object in JSON format
|
|
41
|
+
def from_json(json_string)
|
|
42
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
43
|
+
|
|
44
|
+
from_hash(JSON.parse(json_string))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
48
|
+
def from_hash(obj)
|
|
49
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
50
|
+
|
|
51
|
+
obj.each do |k, v|
|
|
52
|
+
case k
|
|
53
|
+
when 'Device'
|
|
54
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
55
|
+
|
|
56
|
+
@device = v
|
|
57
|
+
when 'DeviceNum'
|
|
58
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
|
59
|
+
|
|
60
|
+
@device_num = v
|
|
61
|
+
else
|
|
62
|
+
@unknown_json_fields[k] = v
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
68
|
+
def to_hash
|
|
69
|
+
ret = {}
|
|
70
|
+
unless @device.nil?
|
|
71
|
+
ret['Device'] = @device
|
|
72
|
+
end
|
|
73
|
+
unless @device_num.nil?
|
|
74
|
+
ret['DeviceNum'] = @device_num
|
|
75
|
+
end
|
|
76
|
+
@unknown_json_fields.each do |k, v|
|
|
77
|
+
ret[k] = v
|
|
78
|
+
end
|
|
79
|
+
ret
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
83
|
+
def to_h
|
|
84
|
+
to_hash
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# @return [String] The complete object as a JSON string
|
|
88
|
+
def to_json(options = {})
|
|
89
|
+
to_hash.to_json(options)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
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
|
+
# PVEBackupNode is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
# This type is used in the EngineProps for an "engine1/proxmox" Protected Item. It represents the
|
|
14
|
+
# selection state for a single Proxmox VE node. It is expected to be user-configurable.
|
|
15
|
+
# This type is available in Comet 25.8.0 and later.
|
|
16
|
+
class PVEBackupNode
|
|
17
|
+
|
|
18
|
+
# @type [Array<Comet::PVEBackupVM>] included_vms
|
|
19
|
+
attr_accessor :included_vms
|
|
20
|
+
|
|
21
|
+
# Used as a cache if the device is offline when editing the Protected Item; not considered as part
|
|
22
|
+
# of the selection
|
|
23
|
+
# @type [String] name
|
|
24
|
+
attr_accessor :name
|
|
25
|
+
|
|
26
|
+
# @type [Boolean] selected
|
|
27
|
+
attr_accessor :selected
|
|
28
|
+
|
|
29
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
30
|
+
attr_accessor :unknown_json_fields
|
|
31
|
+
|
|
32
|
+
def initialize
|
|
33
|
+
clear
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def clear
|
|
37
|
+
@included_vms = []
|
|
38
|
+
@name = ''
|
|
39
|
+
@unknown_json_fields = {}
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @param [String] json_string The complete object in JSON format
|
|
43
|
+
def from_json(json_string)
|
|
44
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
45
|
+
|
|
46
|
+
from_hash(JSON.parse(json_string))
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
50
|
+
def from_hash(obj)
|
|
51
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
52
|
+
|
|
53
|
+
obj.each do |k, v|
|
|
54
|
+
case k
|
|
55
|
+
when 'IncludedVMs'
|
|
56
|
+
if v.nil?
|
|
57
|
+
@included_vms = []
|
|
58
|
+
else
|
|
59
|
+
@included_vms = Array.new(v.length)
|
|
60
|
+
v.each_with_index do |v1, i1|
|
|
61
|
+
@included_vms[i1] = Comet::PVEBackupVM.new
|
|
62
|
+
@included_vms[i1].from_hash(v1)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
when 'Name'
|
|
66
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
67
|
+
|
|
68
|
+
@name = v
|
|
69
|
+
when 'Selected'
|
|
70
|
+
@selected = v
|
|
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
|
+
unless @included_vms.nil?
|
|
81
|
+
ret['IncludedVMs'] = @included_vms
|
|
82
|
+
end
|
|
83
|
+
unless @name.nil?
|
|
84
|
+
ret['Name'] = @name
|
|
85
|
+
end
|
|
86
|
+
unless @selected.nil?
|
|
87
|
+
ret['Selected'] = @selected
|
|
88
|
+
end
|
|
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,128 @@
|
|
|
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
|
+
# PVEBackupVM is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
# This type is used in the EngineProps for an "engine1/proxmox" Protected Item. It represents the
|
|
14
|
+
# selection state for a single Proxmox VM or LXC Container. It is expected to be user-configurable.
|
|
15
|
+
# This type is available in Comet 25.8.0 and later.
|
|
16
|
+
class PVEBackupVM
|
|
17
|
+
|
|
18
|
+
# @type [Array<Comet::PVEBackupDisk>] included_disks
|
|
19
|
+
attr_accessor :included_disks
|
|
20
|
+
|
|
21
|
+
# Used as a cache if the device is offline when editing the Protected Item; not considered as part
|
|
22
|
+
# of the selection
|
|
23
|
+
# @type [String] name
|
|
24
|
+
attr_accessor :name
|
|
25
|
+
|
|
26
|
+
# @type [Boolean] selected
|
|
27
|
+
attr_accessor :selected
|
|
28
|
+
|
|
29
|
+
# One of the PROXMOX_TYPE_ constants
|
|
30
|
+
# @type [String] type
|
|
31
|
+
attr_accessor :type
|
|
32
|
+
|
|
33
|
+
# @type [String] vmid
|
|
34
|
+
attr_accessor :vmid
|
|
35
|
+
|
|
36
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
37
|
+
attr_accessor :unknown_json_fields
|
|
38
|
+
|
|
39
|
+
def initialize
|
|
40
|
+
clear
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def clear
|
|
44
|
+
@included_disks = []
|
|
45
|
+
@name = ''
|
|
46
|
+
@type = ''
|
|
47
|
+
@vmid = ''
|
|
48
|
+
@unknown_json_fields = {}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @param [String] json_string The complete object in JSON format
|
|
52
|
+
def from_json(json_string)
|
|
53
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
54
|
+
|
|
55
|
+
from_hash(JSON.parse(json_string))
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
59
|
+
def from_hash(obj)
|
|
60
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
61
|
+
|
|
62
|
+
obj.each do |k, v|
|
|
63
|
+
case k
|
|
64
|
+
when 'IncludedDisks'
|
|
65
|
+
if v.nil?
|
|
66
|
+
@included_disks = []
|
|
67
|
+
else
|
|
68
|
+
@included_disks = Array.new(v.length)
|
|
69
|
+
v.each_with_index do |v1, i1|
|
|
70
|
+
@included_disks[i1] = Comet::PVEBackupDisk.new
|
|
71
|
+
@included_disks[i1].from_hash(v1)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
when 'Name'
|
|
75
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
76
|
+
|
|
77
|
+
@name = v
|
|
78
|
+
when 'Selected'
|
|
79
|
+
@selected = v
|
|
80
|
+
when 'Type'
|
|
81
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
82
|
+
|
|
83
|
+
@type = v
|
|
84
|
+
when 'VMID'
|
|
85
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
86
|
+
|
|
87
|
+
@vmid = v
|
|
88
|
+
else
|
|
89
|
+
@unknown_json_fields[k] = v
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
95
|
+
def to_hash
|
|
96
|
+
ret = {}
|
|
97
|
+
unless @included_disks.nil?
|
|
98
|
+
ret['IncludedDisks'] = @included_disks
|
|
99
|
+
end
|
|
100
|
+
unless @name.nil?
|
|
101
|
+
ret['Name'] = @name
|
|
102
|
+
end
|
|
103
|
+
unless @selected.nil?
|
|
104
|
+
ret['Selected'] = @selected
|
|
105
|
+
end
|
|
106
|
+
unless @type.nil?
|
|
107
|
+
ret['Type'] = @type
|
|
108
|
+
end
|
|
109
|
+
unless @vmid.nil?
|
|
110
|
+
ret['VMID'] = @vmid
|
|
111
|
+
end
|
|
112
|
+
@unknown_json_fields.each do |k, v|
|
|
113
|
+
ret[k] = v
|
|
114
|
+
end
|
|
115
|
+
ret
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
119
|
+
def to_h
|
|
120
|
+
to_hash
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# @return [String] The complete object as a JSON string
|
|
124
|
+
def to_json(options = {})
|
|
125
|
+
to_hash.to_json(options)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|