rbvmomi2 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -25
- data/exe/rbvmomish +50 -48
- data/lib/rbvmomi/basic_types.rb +318 -294
- data/lib/rbvmomi/connection.rb +221 -216
- data/lib/rbvmomi/deserialization.rb +201 -205
- data/lib/rbvmomi/fault.rb +10 -9
- data/lib/rbvmomi/optimist.rb +51 -50
- data/lib/rbvmomi/pbm.rb +52 -50
- data/lib/rbvmomi/sms/SmsStorageManager.rb +2 -1
- data/lib/rbvmomi/sms.rb +48 -46
- data/lib/rbvmomi/sso.rb +13 -18
- data/lib/rbvmomi/trivial_soap.rb +9 -8
- data/lib/rbvmomi/type_loader.rb +100 -101
- data/lib/rbvmomi/utils/admission_control.rb +90 -106
- data/lib/rbvmomi/utils/deploy.rb +77 -85
- data/lib/rbvmomi/utils/leases.rb +31 -33
- data/lib/rbvmomi/utils/perfdump.rb +177 -207
- data/lib/rbvmomi/version.rb +2 -1
- data/lib/rbvmomi/vim/ComputeResource.rb +17 -15
- data/lib/rbvmomi/vim/Datacenter.rb +1 -0
- data/lib/rbvmomi/vim/Datastore.rb +18 -15
- data/lib/rbvmomi/vim/DynamicTypeMgrAllTypeInfo.rb +7 -6
- data/lib/rbvmomi/vim/DynamicTypeMgrDataTypeInfo.rb +3 -2
- data/lib/rbvmomi/vim/DynamicTypeMgrManagedTypeInfo.rb +7 -6
- data/lib/rbvmomi/vim/Folder.rb +37 -33
- data/lib/rbvmomi/vim/HostSystem.rb +139 -136
- data/lib/rbvmomi/vim/ManagedEntity.rb +15 -14
- data/lib/rbvmomi/vim/ManagedObject.rb +11 -10
- data/lib/rbvmomi/vim/ObjectContent.rb +3 -1
- data/lib/rbvmomi/vim/ObjectUpdate.rb +3 -1
- data/lib/rbvmomi/vim/OvfManager.rb +50 -57
- data/lib/rbvmomi/vim/PerfCounterInfo.rb +4 -3
- data/lib/rbvmomi/vim/PerformanceManager.rb +28 -31
- data/lib/rbvmomi/vim/PropertyCollector.rb +8 -7
- data/lib/rbvmomi/vim/ReflectManagedMethodExecuter.rb +22 -21
- data/lib/rbvmomi/vim/ResourcePool.rb +19 -18
- data/lib/rbvmomi/vim/ServiceInstance.rb +8 -7
- data/lib/rbvmomi/vim/Task.rb +6 -5
- data/lib/rbvmomi/vim/VirtualMachine.rb +8 -7
- data/lib/rbvmomi/vim.rb +112 -129
- data/lib/rbvmomi.rb +1 -0
- metadata +54 -10
data/lib/rbvmomi/basic_types.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Copyright (c) 2011-2017 VMware, Inc. All Rights Reserved.
|
2
3
|
# SPDX-License-Identifier: MIT
|
3
4
|
|
@@ -5,379 +6,402 @@ require 'pp'
|
|
5
6
|
require 'set'
|
6
7
|
|
7
8
|
module RbVmomi
|
8
|
-
module BasicTypes
|
9
|
+
module BasicTypes
|
9
10
|
|
10
|
-
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)
|
11
12
|
|
12
|
-
class Base
|
13
|
-
|
14
|
-
|
13
|
+
class Base
|
14
|
+
class << self
|
15
|
+
attr_accessor :wsdl_name
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
def init wsdl_name=self.name
|
18
|
+
@wsdl_name = wsdl_name
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_s
|
22
|
+
@wsdl_name
|
23
|
+
end
|
24
|
+
end
|
19
25
|
|
20
|
-
|
21
|
-
@wsdl_name
|
26
|
+
init
|
22
27
|
end
|
23
|
-
end
|
24
28
|
|
25
|
-
|
26
|
-
|
29
|
+
class ObjectWithProperties < Base
|
30
|
+
class << self
|
31
|
+
attr_accessor :props_desc
|
32
|
+
|
33
|
+
def init name=self.name, props=[]
|
34
|
+
super name
|
35
|
+
@props_desc = props
|
36
|
+
@props_desc.each do |d|
|
37
|
+
sym = d['name'].to_sym
|
38
|
+
define_method(sym) { _get_property sym }
|
39
|
+
define_method(:"#{sym}=") { |x| _set_property sym, x }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def full_props_set
|
44
|
+
@full_props_set ||= Set.new(full_props_desc.map { |x| x['name'] })
|
45
|
+
end
|
27
46
|
|
28
|
-
|
29
|
-
|
30
|
-
|
47
|
+
def full_props_desc
|
48
|
+
@full_props_desc ||= (self == ObjectWithProperties ? [] : superclass.full_props_desc) + props_desc
|
49
|
+
end
|
31
50
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
@props_desc.each do |d|
|
36
|
-
sym = d['name'].to_sym
|
37
|
-
define_method(sym) { _get_property sym }
|
38
|
-
define_method(:"#{sym}=") { |x| _set_property sym, x }
|
51
|
+
def find_prop_desc name
|
52
|
+
full_props_desc.find { |x| x['name'] == name.to_s }
|
53
|
+
end
|
39
54
|
end
|
40
|
-
end
|
41
55
|
|
42
|
-
|
43
|
-
|
44
|
-
|
56
|
+
def _get_property sym
|
57
|
+
raise 'unimplemented'
|
58
|
+
end
|
45
59
|
|
46
|
-
|
47
|
-
|
48
|
-
|
60
|
+
def _set_property sym, val
|
61
|
+
raise 'unimplemented'
|
62
|
+
end
|
49
63
|
|
50
|
-
|
51
|
-
full_props_desc.find { |x| x['name'] == name.to_s }
|
64
|
+
init
|
52
65
|
end
|
53
|
-
end
|
54
66
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
def _set_property sym, val
|
60
|
-
fail 'unimplemented'
|
61
|
-
end
|
62
|
-
|
63
|
-
init
|
64
|
-
end
|
67
|
+
class ObjectWithMethods < ObjectWithProperties
|
68
|
+
class << self
|
69
|
+
attr_accessor :methods_desc
|
65
70
|
|
66
|
-
|
67
|
-
|
68
|
-
|
71
|
+
def init name=self.name, props=[], methods={}
|
72
|
+
super name, props
|
73
|
+
@methods_desc = methods
|
69
74
|
|
70
|
-
|
71
|
-
|
72
|
-
|
75
|
+
@methods_desc.each do |k, d|
|
76
|
+
sym = k.to_sym
|
77
|
+
define_method(sym) { |*args| _call sym, *args }
|
78
|
+
define_method(:"#{sym}!") { |*args| _call sym, *args }
|
79
|
+
end
|
80
|
+
end
|
73
81
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
82
|
+
# XXX cache
|
83
|
+
def full_methods_desc
|
84
|
+
(self == ObjectWithMethods ? {} : superclass.full_methods_desc).merge methods_desc
|
85
|
+
end
|
78
86
|
end
|
79
|
-
end
|
80
87
|
|
81
|
-
|
82
|
-
def full_methods_desc
|
83
|
-
(self == ObjectWithMethods ? {} : superclass.full_methods_desc).merge methods_desc
|
88
|
+
init
|
84
89
|
end
|
85
|
-
end
|
86
90
|
|
87
|
-
|
88
|
-
|
91
|
+
class DataObject < ObjectWithProperties
|
92
|
+
attr_reader :props
|
89
93
|
|
90
|
-
|
91
|
-
attr_reader :props
|
94
|
+
def self.kind; :data end
|
92
95
|
|
93
|
-
|
96
|
+
def initialize props={}
|
97
|
+
# Deserialization fast path
|
98
|
+
if props == nil
|
99
|
+
@props = {}
|
100
|
+
return
|
101
|
+
end
|
94
102
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
103
|
+
@props = Hash[props.map { |k, v| [k.to_sym, v] }]
|
104
|
+
#self.class.full_props_desc.each do |desc|
|
105
|
+
#fail "missing required property #{desc['name'].inspect} of #{self.class.wsdl_name}" if @props[desc['name'].to_sym].nil? and not desc['is-optional']
|
106
|
+
#end
|
107
|
+
@props.each do |k, v|
|
108
|
+
raise "unexpected property name #{k}" unless self.class.find_prop_desc(k)
|
109
|
+
end
|
110
|
+
end
|
101
111
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
112
|
+
def initialize_copy(source)
|
113
|
+
super
|
114
|
+
@props = @props.dup
|
115
|
+
end
|
116
|
+
|
117
|
+
def _get_property sym
|
118
|
+
@props[sym]
|
119
|
+
end
|
110
120
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
121
|
+
def [] sym
|
122
|
+
_get_property sym
|
123
|
+
end
|
115
124
|
|
116
|
-
|
117
|
-
|
118
|
-
|
125
|
+
def _set_property sym, val
|
126
|
+
@props[sym] = val
|
127
|
+
end
|
119
128
|
|
120
|
-
|
121
|
-
|
122
|
-
|
129
|
+
def []= sym, val
|
130
|
+
_set_property sym, val
|
131
|
+
end
|
123
132
|
|
124
|
-
|
125
|
-
|
126
|
-
end
|
133
|
+
def == o
|
134
|
+
return false unless o.class == self.class
|
127
135
|
|
128
|
-
|
129
|
-
|
130
|
-
|
136
|
+
keys = (props.keys + o.props.keys).uniq
|
137
|
+
keys.all? { |k| props[k] == o.props[k] }
|
138
|
+
end
|
131
139
|
|
132
|
-
|
133
|
-
return false unless o.class == self.class
|
134
|
-
keys = (props.keys + o.props.keys).uniq
|
135
|
-
keys.all? { |k| props[k] == o.props[k] }
|
136
|
-
end
|
140
|
+
alias eql? ==
|
137
141
|
|
138
|
-
|
142
|
+
def hash
|
143
|
+
props.hash
|
144
|
+
end
|
139
145
|
|
140
|
-
|
141
|
-
|
142
|
-
|
146
|
+
def pretty_print q
|
147
|
+
q.text self.class.wsdl_name
|
148
|
+
q.group 2 do
|
149
|
+
q.text '('
|
150
|
+
q.breakable
|
151
|
+
props = @props.sort_by { |k, v| k.to_s }
|
152
|
+
q.seplist props, nil, :each do |e|
|
153
|
+
k, v = e
|
154
|
+
q.group do
|
155
|
+
q.text k.to_s
|
156
|
+
q.text ': '
|
157
|
+
q.pp v
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
q.breakable
|
162
|
+
q.text ')'
|
163
|
+
end
|
143
164
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
k, v = e
|
152
|
-
q.group do
|
153
|
-
q.text k.to_s
|
154
|
-
q.text ': '
|
155
|
-
q.pp v
|
165
|
+
def as_hash(val)
|
166
|
+
if val.kind_of?(Array)
|
167
|
+
val.map { |v| as_hash(v) }
|
168
|
+
elsif val.respond_to?(:to_hash)
|
169
|
+
val.to_hash
|
170
|
+
else
|
171
|
+
val
|
156
172
|
end
|
157
173
|
end
|
174
|
+
|
175
|
+
def to_hash
|
176
|
+
props.transform_values { |v| as_hash(v) }
|
177
|
+
end
|
178
|
+
|
179
|
+
def to_json(options = nil)
|
180
|
+
to_hash.merge(JSON.create_id => self.class.name).to_json
|
181
|
+
end
|
182
|
+
|
183
|
+
init
|
158
184
|
end
|
159
|
-
q.breakable
|
160
|
-
q.text ')'
|
161
|
-
end
|
162
185
|
|
163
|
-
|
164
|
-
|
165
|
-
m = h.merge({ JSON.create_id => self.class.name })
|
166
|
-
m.to_json(*args)
|
167
|
-
end
|
186
|
+
class ManagedObject < ObjectWithMethods
|
187
|
+
def self.kind; :managed end
|
168
188
|
|
169
|
-
|
170
|
-
|
189
|
+
def initialize connection, ref
|
190
|
+
super()
|
191
|
+
@connection = connection
|
192
|
+
@soap = @connection # XXX deprecated
|
193
|
+
@ref = ref
|
194
|
+
end
|
171
195
|
|
172
|
-
|
173
|
-
|
196
|
+
def _connection
|
197
|
+
@connection
|
198
|
+
end
|
174
199
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
@soap = @connection # XXX deprecated
|
179
|
-
@ref = ref
|
180
|
-
end
|
200
|
+
def _ref
|
201
|
+
@ref
|
202
|
+
end
|
181
203
|
|
182
|
-
|
183
|
-
|
184
|
-
|
204
|
+
def _get_property sym
|
205
|
+
ret = @connection.propertyCollector.RetrieveProperties(specSet: [{
|
206
|
+
propSet: [{ type: self.class.wsdl_name, pathSet: [sym.to_s] }],
|
207
|
+
objectSet: [{ obj: self }],
|
208
|
+
}])[0]
|
185
209
|
|
186
|
-
|
187
|
-
|
188
|
-
|
210
|
+
if !ret
|
211
|
+
return nil
|
212
|
+
elsif ret.propSet.empty?
|
213
|
+
return nil if ret.missingSet.empty?
|
189
214
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
if !ret
|
197
|
-
return nil
|
198
|
-
elsif ret.propSet.empty?
|
199
|
-
return nil if ret.missingSet.empty?
|
200
|
-
raise ret.missingSet[0].fault
|
201
|
-
else
|
202
|
-
ret.propSet[0].val
|
203
|
-
end
|
204
|
-
end
|
215
|
+
raise ret.missingSet[0].fault
|
216
|
+
else
|
217
|
+
ret.propSet[0].val
|
218
|
+
end
|
219
|
+
end
|
205
220
|
|
206
|
-
|
207
|
-
|
208
|
-
|
221
|
+
def _set_property sym, val
|
222
|
+
raise 'unimplemented'
|
223
|
+
end
|
209
224
|
|
210
|
-
|
211
|
-
|
212
|
-
desc = self.class.full_methods_desc[method.to_s] or fail "unknown method"
|
213
|
-
@connection.call method, desc, self, o
|
214
|
-
end
|
225
|
+
def _call method, o={}
|
226
|
+
raise 'parameters must be passed as a hash' unless o.is_a? Hash
|
215
227
|
|
216
|
-
|
217
|
-
|
218
|
-
|
228
|
+
desc = self.class.full_methods_desc[method.to_s] or raise 'unknown method'
|
229
|
+
@connection.call method, desc, self, o
|
230
|
+
end
|
219
231
|
|
220
|
-
|
221
|
-
|
222
|
-
|
232
|
+
def to_s
|
233
|
+
"#{self.class.wsdl_name}(#{@ref.inspect})"
|
234
|
+
end
|
223
235
|
|
224
|
-
|
225
|
-
|
226
|
-
|
236
|
+
def to_hash
|
237
|
+
to_s
|
238
|
+
end
|
227
239
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
out
|
232
|
-
end
|
240
|
+
def pretty_print pp
|
241
|
+
pp.text to_s
|
242
|
+
end
|
233
243
|
|
234
|
-
|
244
|
+
def [] k
|
245
|
+
_get_property k
|
246
|
+
end
|
235
247
|
|
236
|
-
|
237
|
-
|
238
|
-
|
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
|
239
253
|
|
240
|
-
|
241
|
-
end
|
254
|
+
alias eql? ==
|
242
255
|
|
243
|
-
|
244
|
-
|
245
|
-
|
256
|
+
def hash
|
257
|
+
[self.class, @ref].hash
|
258
|
+
end
|
246
259
|
|
247
|
-
|
248
|
-
super name
|
249
|
-
@values = values
|
260
|
+
init 'ManagedObject'
|
250
261
|
end
|
251
|
-
end
|
252
262
|
|
253
|
-
|
263
|
+
class Enum < Base
|
264
|
+
class << self
|
265
|
+
attr_accessor :values
|
254
266
|
|
255
|
-
|
267
|
+
def init name=self.name, values=[]
|
268
|
+
super name
|
269
|
+
@values = values
|
270
|
+
end
|
271
|
+
end
|
256
272
|
|
257
|
-
|
258
|
-
@value = value
|
259
|
-
end
|
273
|
+
def self.kind; :enum end
|
260
274
|
|
261
|
-
|
262
|
-
end
|
275
|
+
attr_reader :value
|
263
276
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
'name' => 'faultCause',
|
268
|
-
'wsdl_type' => 'LocalizedMethodFault',
|
269
|
-
'is-array' => false,
|
270
|
-
'is-optional' => true,
|
271
|
-
}, {
|
272
|
-
'name' => 'faultMessage',
|
273
|
-
'wsdl_type' => 'LocalizableMessage',
|
274
|
-
'is-array' => true,
|
275
|
-
'is-optional' => true,
|
276
|
-
},
|
277
|
-
]
|
278
|
-
|
279
|
-
def self.=== exn
|
280
|
-
exn.class == RbVmomi::Fault and self <= exn.fault.class
|
281
|
-
end
|
282
|
-
end
|
277
|
+
def initialize value
|
278
|
+
@value = value
|
279
|
+
end
|
283
280
|
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
'name' => 'fault',
|
288
|
-
'wsdl_type' => 'MethodFault',
|
289
|
-
'is-array' => false,
|
290
|
-
'is-optional' => false,
|
291
|
-
}, {
|
292
|
-
'name' => 'localizedMessage',
|
293
|
-
'wsdl_type' => 'xsd:string',
|
294
|
-
'is-array' => false,
|
295
|
-
'is-optional' => true,
|
296
|
-
},
|
297
|
-
]
|
298
|
-
|
299
|
-
def exception
|
300
|
-
RbVmomi::Fault.new(self.localizedMessage, self.fault)
|
301
|
-
end
|
302
|
-
end
|
281
|
+
def to_hash
|
282
|
+
value
|
283
|
+
end
|
303
284
|
|
304
|
-
|
305
|
-
|
306
|
-
end
|
285
|
+
init
|
286
|
+
end
|
307
287
|
|
308
|
-
class
|
309
|
-
|
310
|
-
|
288
|
+
class MethodFault < DataObject
|
289
|
+
init 'MethodFault', [
|
290
|
+
{
|
291
|
+
'name' => 'faultCause',
|
292
|
+
'wsdl_type' => 'LocalizedMethodFault',
|
293
|
+
'is-array' => false,
|
294
|
+
'is-optional' => true,
|
295
|
+
}, {
|
296
|
+
'name' => 'faultMessage',
|
297
|
+
'wsdl_type' => 'LocalizableMessage',
|
298
|
+
'is-array' => true,
|
299
|
+
'is-optional' => true,
|
300
|
+
},
|
301
|
+
]
|
302
|
+
|
303
|
+
def self.=== exn
|
304
|
+
exn.class == RbVmomi::Fault and self <= exn.fault.class
|
305
|
+
end
|
306
|
+
end
|
311
307
|
|
312
|
-
class
|
313
|
-
|
314
|
-
|
308
|
+
class LocalizedMethodFault < DataObject
|
309
|
+
init 'LocalizedMethodFault', [
|
310
|
+
{
|
311
|
+
'name' => 'fault',
|
312
|
+
'wsdl_type' => 'MethodFault',
|
313
|
+
'is-array' => false,
|
314
|
+
'is-optional' => false,
|
315
|
+
}, {
|
316
|
+
'name' => 'localizedMessage',
|
317
|
+
'wsdl_type' => 'xsd:string',
|
318
|
+
'is-array' => false,
|
319
|
+
'is-optional' => true,
|
320
|
+
},
|
321
|
+
]
|
322
|
+
|
323
|
+
def exception
|
324
|
+
RbVmomi::Fault.new(self.localizedMessage, self.fault)
|
325
|
+
end
|
326
|
+
end
|
315
327
|
|
316
|
-
class
|
317
|
-
|
318
|
-
end
|
328
|
+
class RuntimeFault < MethodFault
|
329
|
+
init
|
330
|
+
end
|
319
331
|
|
320
|
-
class
|
321
|
-
|
322
|
-
end
|
332
|
+
class MethodName < String
|
333
|
+
def self.wsdl_name; 'MethodName' end
|
334
|
+
end
|
323
335
|
|
324
|
-
class
|
325
|
-
|
326
|
-
end
|
336
|
+
class PropertyPath < String
|
337
|
+
def self.wsdl_name; 'PropertyPath' end
|
338
|
+
end
|
327
339
|
|
328
|
-
class
|
329
|
-
|
330
|
-
end
|
340
|
+
class TypeName < String
|
341
|
+
def self.wsdl_name; 'TypeName' end
|
342
|
+
end
|
331
343
|
|
332
|
-
class
|
333
|
-
|
334
|
-
end
|
344
|
+
class ManagedObjectReference
|
345
|
+
def self.wsdl_name; 'ManagedObjectReference' end
|
346
|
+
end
|
335
347
|
|
336
|
-
class
|
337
|
-
|
338
|
-
end
|
348
|
+
class Boolean
|
349
|
+
def self.wsdl_name; 'xsd:boolean' end
|
350
|
+
end
|
339
351
|
|
340
|
-
class
|
341
|
-
|
342
|
-
end
|
352
|
+
class AnyType
|
353
|
+
def self.wsdl_name; 'xsd:anyType' end
|
354
|
+
end
|
343
355
|
|
344
|
-
class
|
345
|
-
|
346
|
-
end
|
356
|
+
class Binary
|
357
|
+
def self.wsdl_name; 'xsd:base64Binary' end
|
358
|
+
end
|
347
359
|
|
348
|
-
class ::
|
349
|
-
|
350
|
-
end
|
360
|
+
class ::Class
|
361
|
+
def wsdl_name; self.class.name end
|
362
|
+
end
|
351
363
|
|
352
|
-
class
|
353
|
-
|
354
|
-
|
355
|
-
def initialize x
|
356
|
-
@val = x
|
357
|
-
end
|
358
|
-
|
359
|
-
def to_s
|
360
|
-
@val.to_s
|
361
|
-
end
|
362
|
-
end
|
364
|
+
class ::String
|
365
|
+
def self.wsdl_name; 'xsd:string' end
|
366
|
+
end
|
363
367
|
|
364
|
-
class
|
365
|
-
|
366
|
-
|
368
|
+
class ::Integer
|
369
|
+
def self.wsdl_name; 'xsd:int' end
|
370
|
+
end
|
367
371
|
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
+
class ::Float
|
373
|
+
def self.wsdl_name; 'xsd:float' end
|
374
|
+
end
|
375
|
+
|
376
|
+
class Int
|
377
|
+
def self.wsdl_name; 'xsd:int' end
|
378
|
+
|
379
|
+
def initialize x
|
380
|
+
@val = x
|
381
|
+
end
|
372
382
|
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
else fail "invalid index #{i.inspect}"
|
383
|
+
def to_s
|
384
|
+
@val.to_s
|
385
|
+
end
|
377
386
|
end
|
378
|
-
end
|
379
|
-
end
|
380
387
|
|
388
|
+
class KeyValue
|
389
|
+
def self.wsdl_name; 'KeyValue' end
|
390
|
+
attr_accessor :key, :value
|
381
391
|
|
382
|
-
|
392
|
+
def initialize k, v
|
393
|
+
@key = k
|
394
|
+
@value = v
|
395
|
+
end
|
396
|
+
|
397
|
+
def [] i
|
398
|
+
if i == 0 then @key
|
399
|
+
elsif i == 1 then @value
|
400
|
+
else raise "invalid index #{i.inspect}"
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
|
406
|
+
end
|
383
407
|
end
|