rbvmomi2 3.5.0 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7924b7c2a0349a7efcda167df430d6dc9212a1c714550577cfd3c659a2acb50e
4
- data.tar.gz: 61078c876d87b723b5d00136b54c414480d3d46b06bbe38d1fefd35c215f43c3
3
+ metadata.gz: c734b7ff622201e3b69ca7fbbfd836673395afb1a9c1c7e24f3293440178b612
4
+ data.tar.gz: b74879085ae47e42857e31abd3b0775c2996ea4659324685f056e4e47c8280bf
5
5
  SHA512:
6
- metadata.gz: 88547766f14147f215f9be68c25fdbecd43c730e2fc4f76fff96908c6fc7ed80ee42a38bfda528e0082b1dc68903f0cec467277818be90fcfb687d6ede4740e0
7
- data.tar.gz: fac00163ba913c0c5035ff1574e3dc1d5e1e4f6ce544b7131c70085c392f451268658d433cda1d922b9cc8ed319f8b14e020b189f6a84632eda71005c0d5035e
6
+ metadata.gz: d6b2a7cedc644d5c07855c4093499541a3f33298ef72f77f0bac2b80edaa6c11e648995867812ce4d274f11b55cca27d2de57b9731a4d517f6b388031e19dcbe
7
+ data.tar.gz: be405091496447be43e8b9746edc0829a468016d5cf5602b13bb7fa465dfc2a79140436dd16681ffde9bd2f36dd435d7d0450336ed4397e12da9f163e0d9eadd
@@ -8,7 +8,7 @@ require 'set'
8
8
  module RbVmomi
9
9
  module BasicTypes
10
10
 
11
- BUILTIN = Set.new %w(ManagedObject DataObject TypeName PropertyPath ManagedObjectReference MethodName MethodFault LocalizedMethodFault KeyValue)
11
+ BUILTIN = Set.new %w(ManagedObject DataObject TypeName PropertyPath ManagedObjectReference MethodName MethodFault LocalizedMethodFault KeyValue OpaqueObject)
12
12
 
13
13
  class Base
14
14
  class << self
@@ -133,8 +133,7 @@ module RbVmomi
133
133
  def == o
134
134
  return false unless o.class == self.class
135
135
 
136
- keys = (props.keys + o.props.keys).uniq
137
- keys.all? { |k| props[k] == o.props[k] }
136
+ hash == o.hash
138
137
  end
139
138
 
140
139
  alias eql? ==
@@ -183,9 +182,7 @@ module RbVmomi
183
182
  init
184
183
  end
185
184
 
186
- class ManagedObject < ObjectWithMethods
187
- def self.kind; :managed end
188
-
185
+ module ObjectWithRefAndConnection
189
186
  def initialize connection, ref
190
187
  super()
191
188
  @connection = connection
@@ -201,6 +198,36 @@ module RbVmomi
201
198
  @ref
202
199
  end
203
200
 
201
+ def to_s
202
+ "#{self.class.wsdl_name}(#{@ref.inspect})"
203
+ end
204
+
205
+ def to_hash
206
+ to_s
207
+ end
208
+
209
+ def pretty_print pp
210
+ pp.text to_s
211
+ end
212
+
213
+ def == x
214
+ out = x.hash == hash
215
+ out = (x._connection.instanceUuid == self._connection.instanceUuid) if out && x._connection.host
216
+ out
217
+ end
218
+
219
+ alias eql? ==
220
+
221
+ def hash
222
+ [self.class, @ref].hash
223
+ end
224
+ end
225
+
226
+ class ManagedObject < ObjectWithMethods
227
+ include ObjectWithRefAndConnection
228
+
229
+ def self.kind; :managed end
230
+
204
231
  def _get_property sym
205
232
  ret = @connection.propertyCollector.RetrieveProperties(specSet: [{
206
233
  propSet: [{ type: self.class.wsdl_name, pathSet: [sym.to_s] }],
@@ -229,34 +256,10 @@ module RbVmomi
229
256
  @connection.call method, desc, self, o
230
257
  end
231
258
 
232
- def to_s
233
- "#{self.class.wsdl_name}(#{@ref.inspect})"
234
- end
235
-
236
- def to_hash
237
- to_s
238
- end
239
-
240
- def pretty_print pp
241
- pp.text to_s
242
- end
243
-
244
259
  def [] k
245
260
  _get_property k
246
261
  end
247
262
 
248
- def == x
249
- out = (x.class == self.class && x._ref == @ref)
250
- out = (x._connection.instanceUuid == self._connection.instanceUuid) if out && x._connection.host
251
- out
252
- end
253
-
254
- alias eql? ==
255
-
256
- def hash
257
- [self.class, @ref].hash
258
- end
259
-
260
263
  init 'ManagedObject'
261
264
  end
262
265
 
@@ -402,6 +405,12 @@ module RbVmomi
402
405
  end
403
406
  end
404
407
 
408
+ class OpaqueObject < Base
409
+ include ObjectWithRefAndConnection
410
+
411
+ def self.kind; :opaque end
405
412
 
413
+ init 'OpaqueObject'
414
+ end
406
415
  end
407
416
  end
@@ -136,7 +136,7 @@ module RbVmomi
136
136
  obj2xml xml, name, expected.wsdl_name, false, e, attrs
137
137
  end
138
138
  end
139
- when BasicTypes::ManagedObject
139
+ when BasicTypes::ManagedObject, BasicTypes::OpaqueObject
140
140
  raise "expected #{expected.wsdl_name} for '#{name}', got #{o.class.wsdl_name} for field #{name.inspect}" if expected and not expected >= o.class and not expected == BasicTypes::AnyType
141
141
 
142
142
  xml.tag! name, o._ref, type: o.class.wsdl_name
@@ -85,6 +85,8 @@ module RbVmomi
85
85
  node.content
86
86
  when :managed
87
87
  leaf_managed node, klass
88
+ when :opaque
89
+ leaf_opaque node, klass
88
90
  else raise
89
91
  end
90
92
  end
@@ -128,6 +130,10 @@ module RbVmomi
128
130
  klass.new(@conn, node.content)
129
131
  end
130
132
 
133
+ def leaf_opaque node, klass
134
+ klass.new(@conn, node.content)
135
+ end
136
+
131
137
  def leaf_date node
132
138
  Time.parse node.content
133
139
  end
@@ -106,6 +106,7 @@ module RbVmomi
106
106
  when 'data' then make_data_type name, desc
107
107
  when 'managed' then make_managed_type name, desc
108
108
  when 'enum' then make_enum_type name, desc
109
+ when 'opaque' then make_opaque_type name, desc
109
110
  else raise desc.inspect
110
111
  end
111
112
  end
@@ -132,6 +133,13 @@ module RbVmomi
132
133
  klass.wsdl_name = desc['wsdl_name']
133
134
  end
134
135
  end
136
+
137
+ def make_opaque_type name, desc
138
+ Class.new(BasicTypes::OpaqueObject).tap do |klass|
139
+ klass.init name
140
+ klass.wsdl_name = desc['wsdl_name']
141
+ end
142
+ end
135
143
  end
136
144
 
137
145
  end
@@ -3,5 +3,5 @@
3
3
  # SPDX-License-Identifier: MIT
4
4
 
5
5
  module RbVmomi
6
- VERSION = '3.5.0'.freeze
6
+ VERSION = '3.6.1'.freeze
7
7
  end
data/vmodl.db CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbvmomi2
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Grare
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-11-09 00:00:00.000000000 Z
12
+ date: 2023-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder