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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +1 -1
- data/comet_backup_ruby_sdk.gemspec +1 -1
- data/lib/comet/comet_server.rb +264 -6
- data/lib/comet/definitions.rb +45 -7
- data/lib/comet/models/admin_options.rb +72 -0
- data/lib/comet/models/backup_job_detail.rb +12 -0
- data/lib/comet/models/block_info.rb +82 -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/browse_vmware_datacenters_response.rb +100 -0
- data/lib/comet/models/browse_vmware_datastores_response.rb +100 -0
- data/lib/comet/models/browse_vmware_hosts_response.rb +100 -0
- data/lib/comet/models/browse_vmware_networks_response.rb +100 -0
- data/lib/comet/models/browse_vmware_response.rb +2 -0
- data/lib/comet/models/disk_drive.rb +16 -0
- data/lib/comet/models/dispatcher_list_snapshot_virtual_machines_response.rb +99 -0
- data/lib/comet/models/external_authentication_source.rb +3 -3
- data/lib/comet/models/hyper_vmachine_info.rb +57 -0
- data/lib/comet/models/hyper_vrestore_target_options.rb +73 -0
- data/lib/comet/models/office_365custom_setting_v2.rb +64 -6
- data/lib/comet/models/office_365mixed_virtual_account.rb +8 -8
- data/lib/comet/models/partition.rb +20 -0
- data/lib/comet/models/partition_conflict.rb +91 -0
- data/lib/comet/models/policy_options.rb +80 -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 +86 -0
- data/lib/comet/models/pvebackup_node.rb +100 -0
- data/lib/comet/models/pvebackup_vm.rb +122 -0
- data/lib/comet/models/pvedisk.rb +137 -0
- data/lib/comet/models/pveparams.rb +138 -0
- data/lib/comet/models/pverestore_selection.rb +94 -0
- data/lib/comet/models/pvestorage_name.rb +83 -0
- data/lib/comet/models/pvevm.rb +148 -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 +35 -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/user_policy.rb +11 -0
- data/lib/comet/models/vmdisk_info.rb +105 -0
- data/lib/comet/models/vminfo.rb +137 -0
- data/lib/comet/models/vminfo_list.rb +80 -0
- data/lib/comet/models/vmware_datacenter_info.rb +74 -0
- data/lib/comet/models/vmware_datastore_info.rb +74 -0
- data/lib/comet/models/vmware_host_info.rb +74 -0
- data/lib/comet/models/vmware_machine_info.rb +1 -0
- data/lib/comet/models/vmware_network_info.rb +74 -0
- data/lib/comet/models/vmware_restore_target_options.rb +119 -0
- data/lib/comet_backup_ruby_sdk.rb +33 -0
- metadata +33 -2
@@ -0,0 +1,91 @@
|
|
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
|
+
# PartitionConflict is a typed class wrapper around the underlying Comet Server API data structure.
|
13
|
+
class PartitionConflict
|
14
|
+
|
15
|
+
# @type [String] partition_a
|
16
|
+
attr_accessor :partition_a
|
17
|
+
|
18
|
+
# @type [String] partition_b
|
19
|
+
attr_accessor :partition_b
|
20
|
+
|
21
|
+
# @type [Number] size
|
22
|
+
attr_accessor :size
|
23
|
+
|
24
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
25
|
+
attr_accessor :unknown_json_fields
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
clear
|
29
|
+
end
|
30
|
+
|
31
|
+
def clear
|
32
|
+
@partition_a = ''
|
33
|
+
@partition_b = ''
|
34
|
+
@size = 0
|
35
|
+
@unknown_json_fields = {}
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param [String] json_string The complete object in JSON format
|
39
|
+
def from_json(json_string)
|
40
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
41
|
+
|
42
|
+
from_hash(JSON.parse(json_string))
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
46
|
+
def from_hash(obj)
|
47
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
48
|
+
|
49
|
+
obj.each do |k, v|
|
50
|
+
case k
|
51
|
+
when 'PartitionA'
|
52
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
53
|
+
|
54
|
+
@partition_a = v
|
55
|
+
when 'PartitionB'
|
56
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
57
|
+
|
58
|
+
@partition_b = v
|
59
|
+
when 'Size'
|
60
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
61
|
+
|
62
|
+
@size = v
|
63
|
+
else
|
64
|
+
@unknown_json_fields[k] = v
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [Hash] The complete object as a Ruby hash
|
70
|
+
def to_hash
|
71
|
+
ret = {}
|
72
|
+
ret['PartitionA'] = @partition_a
|
73
|
+
ret['PartitionB'] = @partition_b
|
74
|
+
ret['Size'] = @size
|
75
|
+
@unknown_json_fields.each do |k, v|
|
76
|
+
ret[k] = v
|
77
|
+
end
|
78
|
+
ret
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [Hash] The complete object as a Ruby hash
|
82
|
+
def to_h
|
83
|
+
to_hash
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [String] The complete object as a JSON string
|
87
|
+
def to_json(options = {})
|
88
|
+
to_hash.to_json(options)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
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
|
+
# PolicyOptions is a typed class wrapper around the underlying Comet Server API data structure.
|
13
|
+
class PolicyOptions
|
14
|
+
|
15
|
+
# @type [Array<String>] delete_sources
|
16
|
+
attr_accessor :delete_sources
|
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
|
+
@delete_sources = []
|
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 'DeleteSources'
|
44
|
+
if v.nil?
|
45
|
+
@delete_sources = []
|
46
|
+
else
|
47
|
+
@delete_sources = Array.new(v.length)
|
48
|
+
v.each_with_index do |v1, i1|
|
49
|
+
raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String
|
50
|
+
|
51
|
+
@delete_sources[i1] = 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['DeleteSources'] = @delete_sources
|
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,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,86 @@
|
|
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
|
+
class PVEBackupDisk
|
14
|
+
|
15
|
+
# @type [String] device
|
16
|
+
attr_accessor :device
|
17
|
+
|
18
|
+
# @type [Number] device_num
|
19
|
+
attr_accessor :device_num
|
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 = ''
|
30
|
+
@device_num = 0
|
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 'Device'
|
48
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
49
|
+
|
50
|
+
@device = v
|
51
|
+
when 'DeviceNum'
|
52
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
53
|
+
|
54
|
+
@device_num = 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
|
+
unless @device.nil?
|
65
|
+
ret['Device'] = @device
|
66
|
+
end
|
67
|
+
unless @device_num.nil?
|
68
|
+
ret['DeviceNum'] = @device_num
|
69
|
+
end
|
70
|
+
@unknown_json_fields.each do |k, v|
|
71
|
+
ret[k] = v
|
72
|
+
end
|
73
|
+
ret
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Hash] The complete object as a Ruby hash
|
77
|
+
def to_h
|
78
|
+
to_hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [String] The complete object as a JSON string
|
82
|
+
def to_json(options = {})
|
83
|
+
to_hash.to_json(options)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,100 @@
|
|
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
|
+
class PVEBackupNode
|
14
|
+
|
15
|
+
# @type [Array<Comet::PVEBackupVM>] included_vms
|
16
|
+
attr_accessor :included_vms
|
17
|
+
|
18
|
+
# @type [String] name
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# @type [Boolean] selected
|
22
|
+
attr_accessor :selected
|
23
|
+
|
24
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
25
|
+
attr_accessor :unknown_json_fields
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
clear
|
29
|
+
end
|
30
|
+
|
31
|
+
def clear
|
32
|
+
@included_vms = []
|
33
|
+
@name = ''
|
34
|
+
@unknown_json_fields = {}
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param [String] json_string The complete object in JSON format
|
38
|
+
def from_json(json_string)
|
39
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
40
|
+
|
41
|
+
from_hash(JSON.parse(json_string))
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
45
|
+
def from_hash(obj)
|
46
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
47
|
+
|
48
|
+
obj.each do |k, v|
|
49
|
+
case k
|
50
|
+
when 'IncludedVMs'
|
51
|
+
if v.nil?
|
52
|
+
@included_vms = []
|
53
|
+
else
|
54
|
+
@included_vms = Array.new(v.length)
|
55
|
+
v.each_with_index do |v1, i1|
|
56
|
+
@included_vms[i1] = Comet::PVEBackupVM.new
|
57
|
+
@included_vms[i1].from_hash(v1)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
when 'Name'
|
61
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
62
|
+
|
63
|
+
@name = v
|
64
|
+
when 'Selected'
|
65
|
+
@selected = v
|
66
|
+
else
|
67
|
+
@unknown_json_fields[k] = v
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [Hash] The complete object as a Ruby hash
|
73
|
+
def to_hash
|
74
|
+
ret = {}
|
75
|
+
unless @included_vms.nil?
|
76
|
+
ret['IncludedVMs'] = @included_vms
|
77
|
+
end
|
78
|
+
unless @name.nil?
|
79
|
+
ret['Name'] = @name
|
80
|
+
end
|
81
|
+
unless @selected.nil?
|
82
|
+
ret['Selected'] = @selected
|
83
|
+
end
|
84
|
+
@unknown_json_fields.each do |k, v|
|
85
|
+
ret[k] = v
|
86
|
+
end
|
87
|
+
ret
|
88
|
+
end
|
89
|
+
|
90
|
+
# @return [Hash] The complete object as a Ruby hash
|
91
|
+
def to_h
|
92
|
+
to_hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [String] The complete object as a JSON string
|
96
|
+
def to_json(options = {})
|
97
|
+
to_hash.to_json(options)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,122 @@
|
|
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
|
+
class PVEBackupVM
|
14
|
+
|
15
|
+
# @type [Array<Comet::PVEBackupDisk>] included_disks
|
16
|
+
attr_accessor :included_disks
|
17
|
+
|
18
|
+
# @type [String] name
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
# @type [Boolean] selected
|
22
|
+
attr_accessor :selected
|
23
|
+
|
24
|
+
# @type [String] type
|
25
|
+
attr_accessor :type
|
26
|
+
|
27
|
+
# @type [String] vmid
|
28
|
+
attr_accessor :vmid
|
29
|
+
|
30
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
31
|
+
attr_accessor :unknown_json_fields
|
32
|
+
|
33
|
+
def initialize
|
34
|
+
clear
|
35
|
+
end
|
36
|
+
|
37
|
+
def clear
|
38
|
+
@included_disks = []
|
39
|
+
@name = ''
|
40
|
+
@type = ''
|
41
|
+
@vmid = ''
|
42
|
+
@unknown_json_fields = {}
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param [String] json_string The complete object in JSON format
|
46
|
+
def from_json(json_string)
|
47
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
48
|
+
|
49
|
+
from_hash(JSON.parse(json_string))
|
50
|
+
end
|
51
|
+
|
52
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
53
|
+
def from_hash(obj)
|
54
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
55
|
+
|
56
|
+
obj.each do |k, v|
|
57
|
+
case k
|
58
|
+
when 'IncludedDisks'
|
59
|
+
if v.nil?
|
60
|
+
@included_disks = []
|
61
|
+
else
|
62
|
+
@included_disks = Array.new(v.length)
|
63
|
+
v.each_with_index do |v1, i1|
|
64
|
+
@included_disks[i1] = Comet::PVEBackupDisk.new
|
65
|
+
@included_disks[i1].from_hash(v1)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
when 'Name'
|
69
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
70
|
+
|
71
|
+
@name = v
|
72
|
+
when 'Selected'
|
73
|
+
@selected = v
|
74
|
+
when 'Type'
|
75
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
76
|
+
|
77
|
+
@type = v
|
78
|
+
when 'VMID'
|
79
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
80
|
+
|
81
|
+
@vmid = v
|
82
|
+
else
|
83
|
+
@unknown_json_fields[k] = v
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# @return [Hash] The complete object as a Ruby hash
|
89
|
+
def to_hash
|
90
|
+
ret = {}
|
91
|
+
unless @included_disks.nil?
|
92
|
+
ret['IncludedDisks'] = @included_disks
|
93
|
+
end
|
94
|
+
unless @name.nil?
|
95
|
+
ret['Name'] = @name
|
96
|
+
end
|
97
|
+
unless @selected.nil?
|
98
|
+
ret['Selected'] = @selected
|
99
|
+
end
|
100
|
+
unless @type.nil?
|
101
|
+
ret['Type'] = @type
|
102
|
+
end
|
103
|
+
unless @vmid.nil?
|
104
|
+
ret['VMID'] = @vmid
|
105
|
+
end
|
106
|
+
@unknown_json_fields.each do |k, v|
|
107
|
+
ret[k] = v
|
108
|
+
end
|
109
|
+
ret
|
110
|
+
end
|
111
|
+
|
112
|
+
# @return [Hash] The complete object as a Ruby hash
|
113
|
+
def to_h
|
114
|
+
to_hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# @return [String] The complete object as a JSON string
|
118
|
+
def to_json(options = {})
|
119
|
+
to_hash.to_json(options)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|