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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile.lock +1 -1
  4. data/comet_backup_ruby_sdk.gemspec +1 -1
  5. data/lib/comet/comet_server.rb +169 -2
  6. data/lib/comet/definitions.rb +6 -2
  7. data/lib/comet/models/admin_options.rb +72 -0
  8. data/lib/comet/models/browse_vmware_datacenters_response.rb +100 -0
  9. data/lib/comet/models/browse_vmware_datastores_response.rb +100 -0
  10. data/lib/comet/models/browse_vmware_hosts_response.rb +100 -0
  11. data/lib/comet/models/browse_vmware_networks_response.rb +100 -0
  12. data/lib/comet/models/browse_vmware_response.rb +2 -0
  13. data/lib/comet/models/disk_drive.rb +16 -0
  14. data/lib/comet/models/dispatcher_list_snapshot_virtual_machines_response.rb +99 -0
  15. data/lib/comet/models/hyper_vmachine_info.rb +57 -0
  16. data/lib/comet/models/hyper_vrestore_target_options.rb +73 -0
  17. data/lib/comet/models/office_365custom_setting_v2.rb +53 -6
  18. data/lib/comet/models/office_365mixed_virtual_account.rb +8 -8
  19. data/lib/comet/models/partition_conflict.rb +91 -0
  20. data/lib/comet/models/policy_options.rb +80 -0
  21. data/lib/comet/models/restore_job_advanced_options.rb +24 -0
  22. data/lib/comet/models/vmdisk_info.rb +105 -0
  23. data/lib/comet/models/vminfo.rb +137 -0
  24. data/lib/comet/models/vminfo_list.rb +80 -0
  25. data/lib/comet/models/vmware_datacenter_info.rb +74 -0
  26. data/lib/comet/models/vmware_datastore_info.rb +74 -0
  27. data/lib/comet/models/vmware_host_info.rb +74 -0
  28. data/lib/comet/models/vmware_machine_info.rb +1 -0
  29. data/lib/comet/models/vmware_network_info.rb +74 -0
  30. data/lib/comet/models/vmware_restore_target_options.rb +119 -0
  31. data/lib/comet_backup_ruby_sdk.rb +17 -0
  32. metadata +19 -2
@@ -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
+ # BrowseVMwareNetworksResponse is a typed class wrapper around the underlying Comet Server API data structure.
13
+ # BrowseVMwareHostsResponse contains a list of VMware Networks for a specific VMware Datacenter,
14
+ # when remotely browsing a VMware vSphere connection.
15
+ class BrowseVMwareNetworksResponse
16
+
17
+ # If the operation was successful, the status will be in the 200-299 range.
18
+ # @type [Number] status
19
+ attr_accessor :status
20
+
21
+ # @type [String] message
22
+ attr_accessor :message
23
+
24
+ # @type [Array<Comet::VMwareNetworkInfo>] networks
25
+ attr_accessor :networks
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
+ @status = 0
36
+ @message = ''
37
+ @networks = []
38
+ @unknown_json_fields = {}
39
+ end
40
+
41
+ # @param [String] json_string The complete object in JSON format
42
+ def from_json(json_string)
43
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
44
+
45
+ from_hash(JSON.parse(json_string))
46
+ end
47
+
48
+ # @param [Hash] obj The complete object as a Ruby hash
49
+ def from_hash(obj)
50
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
51
+
52
+ obj.each do |k, v|
53
+ case k
54
+ when 'Status'
55
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
56
+
57
+ @status = v
58
+ when 'Message'
59
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
60
+
61
+ @message = v
62
+ when 'Networks'
63
+ if v.nil?
64
+ @networks = []
65
+ else
66
+ @networks = Array.new(v.length)
67
+ v.each_with_index do |v1, i1|
68
+ @networks[i1] = Comet::VMwareNetworkInfo.new
69
+ @networks[i1].from_hash(v1)
70
+ end
71
+ end
72
+ else
73
+ @unknown_json_fields[k] = v
74
+ end
75
+ end
76
+ end
77
+
78
+ # @return [Hash] The complete object as a Ruby hash
79
+ def to_hash
80
+ ret = {}
81
+ ret['Status'] = @status
82
+ ret['Message'] = @message
83
+ ret['Networks'] = @networks
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
@@ -10,6 +10,8 @@ require 'json'
10
10
  module Comet
11
11
 
12
12
  # BrowseVMwareResponse is a typed class wrapper around the underlying Comet Server API data structure.
13
+ # BrowseVMwareResponse contains a list of Virtual Machines when remotely browsing a VMware vSphere
14
+ # connection.
13
15
  class BrowseVMwareResponse
14
16
 
15
17
  # If the operation was successful, the status will be in the 200-299 range.
@@ -59,6 +59,10 @@ module Comet
59
59
  # @type [Number] sector_size
60
60
  attr_accessor :sector_size
61
61
 
62
+ # Used to indicate the partition conflicts on the disk.
63
+ # @type [Array<Comet::PartitionConflict>] partition_conflicts
64
+ attr_accessor :partition_conflicts
65
+
62
66
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
63
67
  attr_accessor :unknown_json_fields
64
68
 
@@ -80,6 +84,7 @@ module Comet
80
84
  @heads = 0
81
85
  @sectors = 0
82
86
  @sector_size = 0
87
+ @partition_conflicts = []
83
88
  @unknown_json_fields = {}
84
89
  end
85
90
 
@@ -161,6 +166,16 @@ module Comet
161
166
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
162
167
 
163
168
  @sector_size = v
169
+ when 'PartitionConflicts'
170
+ if v.nil?
171
+ @partition_conflicts = []
172
+ else
173
+ @partition_conflicts = Array.new(v.length)
174
+ v.each_with_index do |v1, i1|
175
+ @partition_conflicts[i1] = Comet::PartitionConflict.new
176
+ @partition_conflicts[i1].from_hash(v1)
177
+ end
178
+ end
164
179
  else
165
180
  @unknown_json_fields[k] = v
166
181
  end
@@ -183,6 +198,7 @@ module Comet
183
198
  ret['Heads'] = @heads
184
199
  ret['Sectors'] = @sectors
185
200
  ret['SectorSize'] = @sector_size
201
+ ret['PartitionConflicts'] = @partition_conflicts
186
202
  @unknown_json_fields.each do |k, v|
187
203
  ret[k] = v
188
204
  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
+ # DispatcherListSnapshotVirtualMachinesResponse 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 DispatcherListSnapshotVirtualMachinesResponse
15
+
16
+ # If the operation was successful, the status will be in the 200-299 range.
17
+ # @type [Number] status
18
+ attr_accessor :status
19
+
20
+ # @type [String] message
21
+ attr_accessor :message
22
+
23
+ # @type [Array<Comet::VMInfo>] vms
24
+ attr_accessor :vms
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
+ @status = 0
35
+ @message = ''
36
+ @vms = []
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 'Status'
54
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
55
+
56
+ @status = v
57
+ when 'Message'
58
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
59
+
60
+ @message = v
61
+ when 'VMs'
62
+ if v.nil?
63
+ @vms = []
64
+ else
65
+ @vms = Array.new(v.length)
66
+ v.each_with_index do |v1, i1|
67
+ @vms[i1] = Comet::VMInfo.new
68
+ @vms[i1].from_hash(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['VMs'] = @vms
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
@@ -18,6 +18,26 @@ module Comet
18
18
  # @type [String] display_name
19
19
  attr_accessor :display_name
20
20
 
21
+ # This field is available in Comet 24.12.x and later.
22
+ # @type [Number] memory_limit_mb
23
+ attr_accessor :memory_limit_mb
24
+
25
+ # This field is available in Comet 24.12.x and later.
26
+ # @type [Number] cpucores
27
+ attr_accessor :cpucores
28
+
29
+ # This field is available in Comet 24.12.x and later.
30
+ # @type [Array<String>] hard_drives
31
+ attr_accessor :hard_drives
32
+
33
+ # This field is available in Comet 24.12.x and later.
34
+ # @type [Number] generation
35
+ attr_accessor :generation
36
+
37
+ # This field is available in Comet 24.12.x and later.
38
+ # @type [String] config_file_path
39
+ attr_accessor :config_file_path
40
+
21
41
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
22
42
  attr_accessor :unknown_json_fields
23
43
 
@@ -28,6 +48,11 @@ module Comet
28
48
  def clear
29
49
  @id = ''
30
50
  @display_name = ''
51
+ @memory_limit_mb = 0
52
+ @cpucores = 0
53
+ @hard_drives = []
54
+ @generation = 0
55
+ @config_file_path = ''
31
56
  @unknown_json_fields = {}
32
57
  end
33
58
 
@@ -52,6 +77,33 @@ module Comet
52
77
  raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
53
78
 
54
79
  @display_name = v
80
+ when 'MemoryLimitMB'
81
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
82
+
83
+ @memory_limit_mb = v
84
+ when 'CPUCores'
85
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
86
+
87
+ @cpucores = v
88
+ when 'HardDrives'
89
+ if v.nil?
90
+ @hard_drives = []
91
+ else
92
+ @hard_drives = Array.new(v.length)
93
+ v.each_with_index do |v1, i1|
94
+ raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String
95
+
96
+ @hard_drives[i1] = v1
97
+ end
98
+ end
99
+ when 'Generation'
100
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
101
+
102
+ @generation = v
103
+ when 'ConfigFilePath'
104
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
105
+
106
+ @config_file_path = v
55
107
  else
56
108
  @unknown_json_fields[k] = v
57
109
  end
@@ -63,6 +115,11 @@ module Comet
63
115
  ret = {}
64
116
  ret['ID'] = @id
65
117
  ret['Name'] = @display_name
118
+ ret['MemoryLimitMB'] = @memory_limit_mb
119
+ ret['CPUCores'] = @cpucores
120
+ ret['HardDrives'] = @hard_drives
121
+ ret['Generation'] = @generation
122
+ ret['ConfigFilePath'] = @config_file_path
66
123
  @unknown_json_fields.each do |k, v|
67
124
  ret[k] = v
68
125
  end
@@ -0,0 +1,73 @@
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
+ # HyperVRestoreTargetOptions is a typed class wrapper around the underlying Comet Server API data structure.
13
+ class HyperVRestoreTargetOptions
14
+
15
+ # @type [String] disk_storage_path
16
+ attr_accessor :disk_storage_path
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
+ @disk_storage_path = ''
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 'DiskStoragePath'
44
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
45
+
46
+ @disk_storage_path = v
47
+ else
48
+ @unknown_json_fields[k] = v
49
+ end
50
+ end
51
+ end
52
+
53
+ # @return [Hash] The complete object as a Ruby hash
54
+ def to_hash
55
+ ret = {}
56
+ ret['DiskStoragePath'] = @disk_storage_path
57
+ @unknown_json_fields.each do |k, v|
58
+ ret[k] = v
59
+ end
60
+ ret
61
+ end
62
+
63
+ # @return [Hash] The complete object as a Ruby hash
64
+ def to_h
65
+ to_hash
66
+ end
67
+
68
+ # @return [String] The complete object as a JSON string
69
+ def to_json(options = {})
70
+ to_hash.to_json(options)
71
+ end
72
+ end
73
+ end
@@ -15,21 +15,35 @@ module Comet
15
15
  # This type is available in Comet 21.9.xx and later.
16
16
  class Office365CustomSettingV2
17
17
 
18
- # If true, then backup the entire Office 365 Tenant except the selected members. If false, backup
19
- # the selected members only.
18
+ # If true, then backup everything except the selected users (group members are still included)
20
19
  # @type [Boolean] organization
20
+ # @deprecated This member has been deprecated since Comet version 24.12.2
21
21
  attr_accessor :organization
22
22
 
23
- # Key can be the ID of user, group or SharePoint
24
- # Value is a bitset of the SERVICE_ constants, to select which services to back up for this member.
23
+ # If true, exclude all filtered IDs and Members. Backup everything else
24
+ # @type [Boolean] filter_mode
25
+ attr_accessor :filter_mode
26
+
27
+ # Key is the ID of User, Group, or Site
28
+ # Value is a bitset of the SERVICE_ constants, to select which services to back up for members
25
29
  # @type [Hash{String => Number}] backup_options
26
30
  attr_accessor :backup_options
27
31
 
28
- # Key must be a group ID
29
- # Value is a bitset of the SERVICE_ constants, to select which services to back up for this member.
32
+ # Key is the ID of a Group or Team Site
33
+ # Value is a bitset of the SERVICE_ constants, to select which services to back up for members
30
34
  # @type [Hash{String => Number}] member_backup_options
31
35
  attr_accessor :member_backup_options
32
36
 
37
+ # Key is the ID of a User, Group, or Site
38
+ # Value is a bitset of the SERVICE_ constants, to select which services to back up for members
39
+ # @type [Hash{String => Number}] filter_options
40
+ attr_accessor :filter_options
41
+
42
+ # Key is the ID of a Group or Team Site
43
+ # Value is a bitset of the SERVICE_ constants, to select which services to back up for members
44
+ # @type [Hash{String => Number}] filter_member_options
45
+ attr_accessor :filter_member_options
46
+
33
47
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
34
48
  attr_accessor :unknown_json_fields
35
49
 
@@ -40,6 +54,8 @@ module Comet
40
54
  def clear
41
55
  @backup_options = {}
42
56
  @member_backup_options = {}
57
+ @filter_options = {}
58
+ @filter_member_options = {}
43
59
  @unknown_json_fields = {}
44
60
  end
45
61
 
@@ -58,6 +74,8 @@ module Comet
58
74
  case k
59
75
  when 'Organization'
60
76
  @organization = v
77
+ when 'FilterMode'
78
+ @filter_mode = v
61
79
  when 'BackupOptions'
62
80
  @backup_options = {}
63
81
  if v.nil?
@@ -80,6 +98,28 @@ module Comet
80
98
  @member_backup_options[k1] = v1
81
99
  end
82
100
  end
101
+ when 'FilterOptions'
102
+ @filter_options = {}
103
+ if v.nil?
104
+ @filter_options = {}
105
+ else
106
+ v.each do |k1, v1|
107
+ raise TypeError, "'v1' expected Numeric, got #{v1.class}" unless v1.is_a? Numeric
108
+
109
+ @filter_options[k1] = v1
110
+ end
111
+ end
112
+ when 'FilterMemberOptions'
113
+ @filter_member_options = {}
114
+ if v.nil?
115
+ @filter_member_options = {}
116
+ else
117
+ v.each do |k1, v1|
118
+ raise TypeError, "'v1' expected Numeric, got #{v1.class}" unless v1.is_a? Numeric
119
+
120
+ @filter_member_options[k1] = v1
121
+ end
122
+ end
83
123
  else
84
124
  @unknown_json_fields[k] = v
85
125
  end
@@ -90,12 +130,19 @@ module Comet
90
130
  def to_hash
91
131
  ret = {}
92
132
  ret['Organization'] = @organization
133
+ ret['FilterMode'] = @filter_mode
93
134
  unless @backup_options.nil?
94
135
  ret['BackupOptions'] = @backup_options
95
136
  end
96
137
  unless @member_backup_options.nil?
97
138
  ret['MemberBackupOptions'] = @member_backup_options
98
139
  end
140
+ unless @filter_options.nil?
141
+ ret['FilterOptions'] = @filter_options
142
+ end
143
+ unless @filter_member_options.nil?
144
+ ret['FilterMemberOptions'] = @filter_member_options
145
+ end
99
146
  @unknown_json_fields.each do |k, v|
100
147
  ret[k] = v
101
148
  end
@@ -24,6 +24,9 @@ module Comet
24
24
  # @type [Number] enabled_service_option
25
25
  attr_accessor :enabled_service_option
26
26
 
27
+ # @type [Boolean] has_license
28
+ attr_accessor :has_license
29
+
27
30
  # @type [String] id
28
31
  attr_accessor :id
29
32
 
@@ -57,9 +60,6 @@ module Comet
57
60
  # @type [Number] member_service_options
58
61
  attr_accessor :member_service_options
59
62
 
60
- # @type [Boolean] has_license
61
- attr_accessor :has_license
62
-
63
63
  # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
64
64
  attr_accessor :unknown_json_fields
65
65
 
@@ -112,6 +112,8 @@ module Comet
112
112
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
113
113
 
114
114
  @enabled_service_option = v
115
+ when 'hasLicense'
116
+ @has_license = v
115
117
  when 'id'
116
118
  raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
117
119
 
@@ -163,8 +165,6 @@ module Comet
163
165
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
164
166
 
165
167
  @member_service_options = v
166
- when 'hasLicense'
167
- @has_license = v
168
168
  else
169
169
  @unknown_json_fields[k] = v
170
170
  end
@@ -186,6 +186,9 @@ module Comet
186
186
  unless @enabled_service_option.nil?
187
187
  ret['EnabledServiceOption'] = @enabled_service_option
188
188
  end
189
+ unless @has_license.nil?
190
+ ret['hasLicense'] = @has_license
191
+ end
189
192
  ret['id'] = @id
190
193
  unless @job_title.nil?
191
194
  ret['JobTitle'] = @job_title
@@ -217,9 +220,6 @@ module Comet
217
220
  unless @member_service_options.nil?
218
221
  ret['MemberServiceOptions'] = @member_service_options
219
222
  end
220
- unless @has_license.nil?
221
- ret['hasLicense'] = @has_license
222
- end
223
223
  @unknown_json_fields.each do |k, v|
224
224
  ret[k] = v
225
225
  end
@@ -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