rbvmomi2 3.5.0 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbvmomi/basic_types.rb +38 -28
- data/lib/rbvmomi/connection.rb +1 -1
- data/lib/rbvmomi/deserialization.rb +6 -0
- data/lib/rbvmomi/type_loader.rb +8 -0
- data/lib/rbvmomi/version.rb +1 -1
- data/vmodl.db +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7f884a08909043da3caf917fad9bfdccfd2fa72ca2dc3f1f6a5abb30328918b
|
4
|
+
data.tar.gz: 5fa4d805d17742366842a7952b0ff64b615e5486ee97c5346bcf9fecee960a08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03d61e820ea26b14e91292f23bd49bbaa427292f1dd7f95678b6848e23de93a6df61d234e9f65f18cffbd3a6c29925276641adb70857a8a402b8321fd3c2634c
|
7
|
+
data.tar.gz: 070d68363366b331ca9bff257eec83b7e0b2fa95ad86b6c504532070984159ea02e99d3b4b8bc71555aec6a78d158bf0a5b033156b92eb5b6c1bbf98675611aa
|
data/lib/rbvmomi/basic_types.rb
CHANGED
@@ -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
|
@@ -183,9 +183,7 @@ module RbVmomi
|
|
183
183
|
init
|
184
184
|
end
|
185
185
|
|
186
|
-
|
187
|
-
def self.kind; :managed end
|
188
|
-
|
186
|
+
module ObjectWithRefAndConnection
|
189
187
|
def initialize connection, ref
|
190
188
|
super()
|
191
189
|
@connection = connection
|
@@ -201,6 +199,36 @@ module RbVmomi
|
|
201
199
|
@ref
|
202
200
|
end
|
203
201
|
|
202
|
+
def to_s
|
203
|
+
"#{self.class.wsdl_name}(#{@ref.inspect})"
|
204
|
+
end
|
205
|
+
|
206
|
+
def to_hash
|
207
|
+
to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
def pretty_print pp
|
211
|
+
pp.text to_s
|
212
|
+
end
|
213
|
+
|
214
|
+
def == x
|
215
|
+
out = (x.class == self.class && x._ref == @ref)
|
216
|
+
out = (x._connection.instanceUuid == self._connection.instanceUuid) if out && x._connection.host
|
217
|
+
out
|
218
|
+
end
|
219
|
+
|
220
|
+
alias eql? ==
|
221
|
+
|
222
|
+
def hash
|
223
|
+
[self.class, @ref].hash
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
class ManagedObject < ObjectWithMethods
|
228
|
+
include ObjectWithRefAndConnection
|
229
|
+
|
230
|
+
def self.kind; :managed end
|
231
|
+
|
204
232
|
def _get_property sym
|
205
233
|
ret = @connection.propertyCollector.RetrieveProperties(specSet: [{
|
206
234
|
propSet: [{ type: self.class.wsdl_name, pathSet: [sym.to_s] }],
|
@@ -229,34 +257,10 @@ module RbVmomi
|
|
229
257
|
@connection.call method, desc, self, o
|
230
258
|
end
|
231
259
|
|
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
260
|
def [] k
|
245
261
|
_get_property k
|
246
262
|
end
|
247
263
|
|
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
264
|
init 'ManagedObject'
|
261
265
|
end
|
262
266
|
|
@@ -402,6 +406,12 @@ module RbVmomi
|
|
402
406
|
end
|
403
407
|
end
|
404
408
|
|
409
|
+
class OpaqueObject < Base
|
410
|
+
include ObjectWithRefAndConnection
|
411
|
+
|
412
|
+
def self.kind; :opaque end
|
405
413
|
|
414
|
+
init 'OpaqueObject'
|
415
|
+
end
|
406
416
|
end
|
407
417
|
end
|
data/lib/rbvmomi/connection.rb
CHANGED
@@ -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
|
data/lib/rbvmomi/type_loader.rb
CHANGED
@@ -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
|
data/lib/rbvmomi/version.rb
CHANGED
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.
|
4
|
+
version: 3.6.0
|
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:
|
12
|
+
date: 2023-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: builder
|