comet_backup_ruby_sdk 2.39.0 → 2.41.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 +9 -0
- data/Gemfile.lock +1 -1
- data/comet_backup_ruby_sdk.gemspec +1 -1
- data/lib/comet/comet_server.rb +169 -2
- data/lib/comet/definitions.rb +6 -2
- data/lib/comet/models/admin_options.rb +72 -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/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 +53 -6
- data/lib/comet/models/office_365mixed_virtual_account.rb +8 -8
- data/lib/comet/models/partition_conflict.rb +91 -0
- data/lib/comet/models/policy_options.rb +80 -0
- data/lib/comet/models/restore_job_advanced_options.rb +24 -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 +17 -0
- metadata +19 -2
@@ -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
|
@@ -107,6 +107,16 @@ 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
|
+
|
110
120
|
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
111
121
|
attr_accessor :unknown_json_fields
|
112
122
|
|
@@ -128,6 +138,8 @@ module Comet
|
|
128
138
|
@ssl_crt_file = ''
|
129
139
|
@ssl_key_file = ''
|
130
140
|
@ms_sql_connection = Comet::MSSQLLoginArgs.new
|
141
|
+
@vmware_connection = Comet::VMwareRestoreTargetOptions.new
|
142
|
+
@hyper_vconnection = Comet::HyperVRestoreTargetOptions.new
|
131
143
|
@unknown_json_fields = {}
|
132
144
|
end
|
133
145
|
|
@@ -219,6 +231,12 @@ module Comet
|
|
219
231
|
when 'MsSqlConnection'
|
220
232
|
@ms_sql_connection = Comet::MSSQLLoginArgs.new
|
221
233
|
@ms_sql_connection.from_hash(v)
|
234
|
+
when 'VMwareConnection'
|
235
|
+
@vmware_connection = Comet::VMwareRestoreTargetOptions.new
|
236
|
+
@vmware_connection.from_hash(v)
|
237
|
+
when 'HyperVConnection'
|
238
|
+
@hyper_vconnection = Comet::HyperVRestoreTargetOptions.new
|
239
|
+
@hyper_vconnection.from_hash(v)
|
222
240
|
else
|
223
241
|
@unknown_json_fields[k] = v
|
224
242
|
end
|
@@ -254,6 +272,12 @@ module Comet
|
|
254
272
|
unless @ms_sql_connection.nil?
|
255
273
|
ret['MsSqlConnection'] = @ms_sql_connection
|
256
274
|
end
|
275
|
+
unless @vmware_connection.nil?
|
276
|
+
ret['VMwareConnection'] = @vmware_connection
|
277
|
+
end
|
278
|
+
unless @hyper_vconnection.nil?
|
279
|
+
ret['HyperVConnection'] = @hyper_vconnection
|
280
|
+
end
|
257
281
|
@unknown_json_fields.each do |k, v|
|
258
282
|
ret[k] = v
|
259
283
|
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
|
@@ -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
|
+
# VMwareDatastoreInfo is a typed class wrapper around the underlying Comet Server API data structure.
|
13
|
+
# VMwareDatastoreInfo describes a single VMware datastore within a VMware datacenter.
|
14
|
+
class VMwareDatastoreInfo
|
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
|
@@ -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
|
+
# VMwareHostInfo is a typed class wrapper around the underlying Comet Server API data structure.
|
13
|
+
# VMwareHostInfo describes a single VMware host within a VMware datacenter.
|
14
|
+
class VMwareHostInfo
|
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
|