ovirt-engine-sdk 4.0.0.alpha9 → 4.0.0.alpha10
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/ext/ovirtsdk4c/ov_xml_reader.c +107 -14
- data/ext/ovirtsdk4c/ovirtsdk4c.c +0 -2
- data/lib/ovirtsdk4.rb +0 -1
- data/lib/ovirtsdk4/http.rb +20 -6
- data/lib/ovirtsdk4/reader.rb +168 -0
- data/lib/ovirtsdk4/readers.rb +1023 -1742
- data/lib/ovirtsdk4/services.rb +227 -121
- data/lib/ovirtsdk4/version.rb +1 -1
- data/lib/ovirtsdk4/writer.rb +100 -0
- data/lib/ovirtsdk4/writers.rb +928 -928
- metadata +2 -5
- data/ext/ovirtsdk4c/ov_xml_constants.c +0 -36
- data/ext/ovirtsdk4c/ov_xml_constants.h +0 -26
- data/lib/ovirtsdk4/xml.rb +0 -244
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ovirt-engine-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.alpha10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Hernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -67,8 +67,6 @@ files:
|
|
67
67
|
- ext/ovirtsdk4c/ov_error.h
|
68
68
|
- ext/ovirtsdk4c/ov_module.c
|
69
69
|
- ext/ovirtsdk4c/ov_module.h
|
70
|
-
- ext/ovirtsdk4c/ov_xml_constants.c
|
71
|
-
- ext/ovirtsdk4c/ov_xml_constants.h
|
72
70
|
- ext/ovirtsdk4c/ov_xml_reader.c
|
73
71
|
- ext/ovirtsdk4c/ov_xml_reader.h
|
74
72
|
- ext/ovirtsdk4c/ov_xml_writer.c
|
@@ -85,7 +83,6 @@ files:
|
|
85
83
|
- lib/ovirtsdk4/version.rb
|
86
84
|
- lib/ovirtsdk4/writer.rb
|
87
85
|
- lib/ovirtsdk4/writers.rb
|
88
|
-
- lib/ovirtsdk4/xml.rb
|
89
86
|
homepage: http://ovirt.org
|
90
87
|
licenses:
|
91
88
|
- Apache-2.0
|
@@ -1,36 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2015-2016 Red Hat, Inc.
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
#include <ruby.h>
|
18
|
-
|
19
|
-
#include <libxml/xmlreader.h>
|
20
|
-
|
21
|
-
#include "ov_module.h"
|
22
|
-
#include "ov_xml_constants.h"
|
23
|
-
|
24
|
-
static void ov_xml_constants_define_integer(char *name, int value) {
|
25
|
-
rb_define_const(ov_xml_constants_module, name, INT2NUM(value));
|
26
|
-
}
|
27
|
-
|
28
|
-
void ov_xml_constants_define(void) {
|
29
|
-
// Define the module:
|
30
|
-
ov_xml_constants_module = rb_define_module_under(ov_module, "XmlConstants");
|
31
|
-
|
32
|
-
// Define the constants:
|
33
|
-
ov_xml_constants_define_integer("TYPE_NONE", XML_READER_TYPE_NONE);
|
34
|
-
ov_xml_constants_define_integer("TYPE_ELEMENT", XML_READER_TYPE_ELEMENT);
|
35
|
-
ov_xml_constants_define_integer("TYPE_END_ELEMENT", XML_READER_TYPE_END_ELEMENT);
|
36
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2015-2016 Red Hat, Inc.
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
#ifndef __OV_XML_CONSTANTS_H__
|
18
|
-
#define __OV_XML_CONSTANTS_H__
|
19
|
-
|
20
|
-
// Classes:
|
21
|
-
VALUE ov_xml_constants_module;
|
22
|
-
|
23
|
-
// Initialization function:
|
24
|
-
extern void ov_xml_constants_define(void);
|
25
|
-
|
26
|
-
#endif
|
data/lib/ovirtsdk4/xml.rb
DELETED
@@ -1,244 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Copyright (c) 2015-2016 Red Hat, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#++
|
16
|
-
|
17
|
-
require 'date'
|
18
|
-
|
19
|
-
module OvirtSDK4
|
20
|
-
|
21
|
-
##
|
22
|
-
# This is an utility class used to format objects for use in HTTP requests. It is inteded for use by other
|
23
|
-
# components of the SDK. Refrain from using it directly, as backwards compatibility isn't guaranteed.
|
24
|
-
#
|
25
|
-
# @api private
|
26
|
-
#
|
27
|
-
class XmlFormatter
|
28
|
-
|
29
|
-
##
|
30
|
-
# Formats a boolean value.
|
31
|
-
#
|
32
|
-
def self.format_boolean(value)
|
33
|
-
if value
|
34
|
-
return 'true'
|
35
|
-
else
|
36
|
-
return 'false'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
##
|
43
|
-
# This is an utility class used to read XML documents using an streaming approach. It is inteded for use by
|
44
|
-
# other components of the SDK. Refrain from using it directly, as backwards compatibility isn't guaranteed.
|
45
|
-
#
|
46
|
-
# The part of the code that requires calls to _libxml_ is written in C, as an extension.
|
47
|
-
#
|
48
|
-
# @api private
|
49
|
-
#
|
50
|
-
class XmlReader
|
51
|
-
|
52
|
-
##
|
53
|
-
# Jumps to the next start tag, end tag or end of document. Returns `true` if stopped at an start tag, `false`
|
54
|
-
# otherwise.
|
55
|
-
#
|
56
|
-
def forward
|
57
|
-
loop do
|
58
|
-
case node_type
|
59
|
-
when XmlConstants::TYPE_ELEMENT
|
60
|
-
return true
|
61
|
-
when XmlConstants::TYPE_END_ELEMENT, XmlConstants::TYPE_NONE
|
62
|
-
return false
|
63
|
-
else
|
64
|
-
read
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
##
|
70
|
-
# Reads a string value, assuming that the cursor is positioned at the start element that contains the value.
|
71
|
-
#
|
72
|
-
def read_string
|
73
|
-
return read_element
|
74
|
-
end
|
75
|
-
|
76
|
-
##
|
77
|
-
# Reads a boolean value, assuming that the cursor is positioned at the start element that contains the value.
|
78
|
-
#
|
79
|
-
def read_boolean
|
80
|
-
image = read_element
|
81
|
-
begin
|
82
|
-
case image.downcase
|
83
|
-
when 'false', '0'
|
84
|
-
return false
|
85
|
-
when 'true', '1'
|
86
|
-
return true
|
87
|
-
else
|
88
|
-
raise Error.new("The text \"#{image}\" isn't a valid boolean value.")
|
89
|
-
end
|
90
|
-
ensure
|
91
|
-
next_element
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
##
|
96
|
-
# Reads a list of boolean values, assuming that the cursor is positioned at the start element that contains
|
97
|
-
# the values.
|
98
|
-
#
|
99
|
-
def read_booleans
|
100
|
-
list = []
|
101
|
-
loop do
|
102
|
-
case node_type
|
103
|
-
when XmlConstants::TYPE_ELEMENT
|
104
|
-
list << read_boolean
|
105
|
-
when XmlConstants::TYPE_END_ELEMENT, XmlConstants::TYPE_NONE
|
106
|
-
break
|
107
|
-
end
|
108
|
-
end
|
109
|
-
return list
|
110
|
-
end
|
111
|
-
|
112
|
-
##
|
113
|
-
# Reads an integer value, assuming that the cursor is positioned at the start element that contains the value.
|
114
|
-
#
|
115
|
-
def read_integer
|
116
|
-
image = read_element
|
117
|
-
begin
|
118
|
-
return Integer(image, 10)
|
119
|
-
rescue
|
120
|
-
raise Error.new("The text \"#{image}\" isn't a valid integer value.")
|
121
|
-
ensure
|
122
|
-
next_element
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
##
|
127
|
-
# Reads a list of integer values, assuming that the cursor is positioned at the start element that contains the
|
128
|
-
# values.
|
129
|
-
#
|
130
|
-
def read_integers
|
131
|
-
list = []
|
132
|
-
loop do
|
133
|
-
case node_type
|
134
|
-
when XmlConstants::TYPE_ELEMENT
|
135
|
-
list << read_integer
|
136
|
-
when XmlConstants::TYPE_END_ELEMENT, XmlConstants::TYPE_NONE
|
137
|
-
break
|
138
|
-
end
|
139
|
-
end
|
140
|
-
return list
|
141
|
-
end
|
142
|
-
|
143
|
-
##
|
144
|
-
# Reads a decimal value, assuming that the cursor is positioned at the start element that contains the value.
|
145
|
-
#
|
146
|
-
def read_decimal
|
147
|
-
image = read_element
|
148
|
-
begin
|
149
|
-
return Float(image)
|
150
|
-
rescue
|
151
|
-
raise Error.new("The text \"#{image}\" isn't a valid decimal value.")
|
152
|
-
ensure
|
153
|
-
next_element
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
##
|
158
|
-
# Reads a list of decimal values, assuming that the cursor is positioned at the start element that contains the
|
159
|
-
# values.
|
160
|
-
#
|
161
|
-
def read_decimals
|
162
|
-
list = []
|
163
|
-
loop do
|
164
|
-
case node_type
|
165
|
-
when XmlConstants::TYPE_ELEMENT
|
166
|
-
list << read_decimal
|
167
|
-
when XmlConstants::TYPE_END_ELEMENT, XmlConstants::TYPE_NONE
|
168
|
-
break
|
169
|
-
end
|
170
|
-
end
|
171
|
-
return list
|
172
|
-
end
|
173
|
-
|
174
|
-
##
|
175
|
-
# Reads a date value, assuming that the cursor is positioned at the start element # that contains the value.
|
176
|
-
#
|
177
|
-
def read_date
|
178
|
-
image = read_element
|
179
|
-
begin
|
180
|
-
return DateTime.xmlschema(image)
|
181
|
-
rescue
|
182
|
-
raise Error.new("The text \"#{image}\" isn't a valid date.")
|
183
|
-
ensure
|
184
|
-
next_element
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
##
|
189
|
-
# Reads a list of dates values, assuming that the cursor is positioned at the start element that contains the
|
190
|
-
# values.
|
191
|
-
#
|
192
|
-
def read_dates
|
193
|
-
list = []
|
194
|
-
loop do
|
195
|
-
case node_type
|
196
|
-
when XmlConstants::TYPE_ELEMENT
|
197
|
-
list << read_date
|
198
|
-
when XmlConstants::TYPE_END_ELEMENT, XmlConstants::TYPE_NONE
|
199
|
-
break
|
200
|
-
end
|
201
|
-
end
|
202
|
-
return list
|
203
|
-
end
|
204
|
-
|
205
|
-
end
|
206
|
-
|
207
|
-
##
|
208
|
-
# This is an utility class used to generate XML documents using an streaming approach. It is inteded for use by
|
209
|
-
# other components of the SDK. Refrain from using it directly, as backwards compatibility isn't guaranteed.
|
210
|
-
#
|
211
|
-
# The part of the code that requires calls to _libxml_ is written in C, as an extension.
|
212
|
-
#
|
213
|
-
# @api private
|
214
|
-
#
|
215
|
-
class XmlWriter
|
216
|
-
|
217
|
-
##
|
218
|
-
# Writes an string value.
|
219
|
-
#
|
220
|
-
def write_string(name, value)
|
221
|
-
write_element(name, value)
|
222
|
-
end
|
223
|
-
|
224
|
-
##
|
225
|
-
# Writes a boolean value.
|
226
|
-
#
|
227
|
-
def write_boolean(name, value)
|
228
|
-
if value
|
229
|
-
write_element(name, 'true')
|
230
|
-
else
|
231
|
-
write_element(name, 'false')
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
##
|
236
|
-
# Writes an integer value.
|
237
|
-
#
|
238
|
-
def write_integer(name, value)
|
239
|
-
write_element(name, value.to_s)
|
240
|
-
end
|
241
|
-
|
242
|
-
end
|
243
|
-
|
244
|
-
end
|