right_flexiscale 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +13 -0
- data/README.txt +78 -0
- data/Rakefile +49 -0
- data/lib/api/Flexiscale API.rb +513 -0
- data/lib/api/Flexiscale APIAddons.rb +228 -0
- data/lib/api/Flexiscale APIDriver.rb +315 -0
- data/lib/api/Flexiscale APIMappingRegistry.rb +597 -0
- data/lib/api/benchmark_fix.rb +39 -0
- data/lib/api/right_flexiscale_api.rb +819 -0
- data/lib/right_flexiscale.rb +42 -0
- data/test/test_helper.rb +6 -0
- data/test/test_right_flexiscale.rb +140 -0
- metadata +77 -0
@@ -0,0 +1,228 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2008 RightScale Inc
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#
|
23
|
+
|
24
|
+
class Date
|
25
|
+
def to_utc_time
|
26
|
+
dest = new_offset
|
27
|
+
# Convert a fraction of a day to a number of microseconds
|
28
|
+
usec = (dest.sec_fraction * 60 * 60 * 24 * (10**6)).to_i
|
29
|
+
Time.send(:utc, dest.year, dest.month, dest.day, dest.hour, dest.min, dest.sec, usec)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module FlexiScale
|
34
|
+
|
35
|
+
def self.attrs_to_hash(*list)
|
36
|
+
result = {}
|
37
|
+
object = list.shift
|
38
|
+
list.each { |attribute| result[attribute] = object.__send__(attribute) }
|
39
|
+
result
|
40
|
+
end
|
41
|
+
|
42
|
+
class OperatingSystemImage
|
43
|
+
def to_handy_hash
|
44
|
+
{ :fxs_id => self.operating_system_image_id,
|
45
|
+
:name => self.operating_system_image_name }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class Disk
|
50
|
+
def to_handy_hash
|
51
|
+
::FlexiScale::attrs_to_hash(self, :capacity, :locked, :package_id, :server_id, :usage).merge(
|
52
|
+
:fxs_id => self.disk_id,
|
53
|
+
:name => self.disk_name
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class NetworkInterface
|
59
|
+
def to_handy_hash
|
60
|
+
::FlexiScale::attrs_to_hash(self, :server_id, :vlan_id, :mac_address).merge(
|
61
|
+
:fxs_id => self.network_interface_id
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class IpBlock
|
67
|
+
def to_handy_hash
|
68
|
+
::FlexiScale::attrs_to_hash(self, :customer_vlan_id, :end_ip, :start_ip, :block_type).merge(
|
69
|
+
:fxs_id => self.ip_block_id
|
70
|
+
)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
class Firewall
|
75
|
+
def to_handy_hash
|
76
|
+
::FlexiScale::attrs_to_hash(self, :ip_address, :default_policy).merge(
|
77
|
+
:fxs_id => self.firewall_id
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class FirewallTemplate
|
83
|
+
def to_handy_hash
|
84
|
+
{ :fxs_id => self.firewall_template_id,
|
85
|
+
:name => self.template_name,
|
86
|
+
:default_policy => self.default_policy }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class FirewallRule
|
91
|
+
def to_handy_hash
|
92
|
+
::FlexiScale::attrs_to_hash(self, :action, :destination_port, :direction, :firewall_id,
|
93
|
+
:icmp_parameter_id, :ip_address, :ip_address_mask,
|
94
|
+
:firewall_protocol_id, :sequence_no,
|
95
|
+
:source_port, :jump_to).merge(
|
96
|
+
:fxs_id => self.firewall_rule_id,
|
97
|
+
:name => self.rule_name
|
98
|
+
)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class FirewallTemplateRule
|
103
|
+
def to_handy_hash
|
104
|
+
::FlexiScale::attrs_to_hash(self, :action, :destination_port, :direction, :firewall_protocol_id,
|
105
|
+
:firewall_template_id, :icmp_parameter_id, :ip_address,
|
106
|
+
:ip_address_mask, :jump_to, :sequence_no, :source_port).merge(
|
107
|
+
:fxs_id => self.firewall_template_rule_id,
|
108
|
+
:name => self.rule_name
|
109
|
+
)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
class IcmpProtocol
|
114
|
+
def to_handy_hash
|
115
|
+
{ :fxs_id => self.icmp_protocol_id,
|
116
|
+
:description => self.description }
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class FirewallProtocol
|
121
|
+
def to_handy_hash
|
122
|
+
{ :fxs_id => self.firewall_protocol_id,
|
123
|
+
:name => self.name }
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
class Vlan
|
128
|
+
def to_handy_hash
|
129
|
+
{ :fxs_id => self.vlan_id,
|
130
|
+
:name => self.vlan_name }
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
class Server
|
135
|
+
STATUS_IN_WORDS = { '1' => 'error',
|
136
|
+
'2' => 'running',
|
137
|
+
'3' => 'starting',
|
138
|
+
'4' => 'stopping',
|
139
|
+
'5' => 'stopped' }
|
140
|
+
def to_handy_hash
|
141
|
+
::FlexiScale::attrs_to_hash(self, :disk_capacity, :disks, :ip_addresses,
|
142
|
+
:memory, :modified, :network_interfaces, :package_id,
|
143
|
+
:processors, :status, :uptime ).merge(
|
144
|
+
:fxs_id => self.server_id,
|
145
|
+
:name => self.server_name,
|
146
|
+
:fxs_status => self.status,
|
147
|
+
# :status => STATUS_IN_WORDS[self.status],
|
148
|
+
:image_id => self.operating_system_image.operating_system_image_id,
|
149
|
+
:image_name => self.operating_system_image.operating_system_image_name,
|
150
|
+
:initial_password => self.initial_password.chop
|
151
|
+
)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
class Job
|
156
|
+
STATUS_IN_WORDS = { 1 => 'running',
|
157
|
+
2 => 'completed',
|
158
|
+
3 => 'failed' }
|
159
|
+
def to_handy_hash
|
160
|
+
::FlexiScale::attrs_to_hash(self, :type_id, :description, :parent_job, :notes ).merge(
|
161
|
+
:fxs_id => self.job_id,
|
162
|
+
:fxs_status => self.status,
|
163
|
+
:status => STATUS_IN_WORDS[self.status],
|
164
|
+
:started_at => self.started.to_utc_time,
|
165
|
+
:finished_at => self.finished ? self.finished.to_utc_time : nil
|
166
|
+
)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
class Package
|
171
|
+
def to_handy_hash
|
172
|
+
{ :fxs_id => self.package_id,
|
173
|
+
:name => self.package_name }
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class DebitItem
|
178
|
+
def to_handy_hash
|
179
|
+
::FlexiScale::attrs_to_hash( self, :debit_id, :item_type, :type_id, :item_value, :item_cost,
|
180
|
+
:description ).merge(
|
181
|
+
:fxs_id => self.debit_item_id,
|
182
|
+
:timestamp => Time.at(self.timestamp.to_i)
|
183
|
+
)
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
class Debit
|
188
|
+
def to_handy_hash
|
189
|
+
::FlexiScale::attrs_to_hash( self, :creation_time, :item_count, :item_cost ).merge(
|
190
|
+
:fxs_id => :debit_id,
|
191
|
+
:creation_time => Time.at(self.creation_time.to_i)
|
192
|
+
)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
class Credit
|
197
|
+
def to_handy_hash
|
198
|
+
{ :fxs_id => self.credit_id,
|
199
|
+
:date => self.credit_date,
|
200
|
+
:amount => self.credit_amount,
|
201
|
+
:unused_credit => self.unused_credit
|
202
|
+
}
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
class CreditDebit
|
207
|
+
def to_handy_hash
|
208
|
+
::FlexiScale::attrs_to_hash( self, :credit_id, :debit_id, :amount ).merge(
|
209
|
+
:fs => self.credit_debit_id
|
210
|
+
)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
%w{ ArrayOf_xsd_int ArrayOf_xsd_string ArrayOfServer ArrayOfCredit
|
215
|
+
ArrayOfOperatingSystemImage ArrayOfFirewall ArrayOfFirewallTemplate
|
216
|
+
ArrayOfFirewallRule ArrayOfFirewallTemplateRule ArrayOfIcmpProtocol
|
217
|
+
ArrayOfFirewallProtocol ArrayOfIpBlock ArrayOfVlan ArrayOfNetworkInterface
|
218
|
+
ArrayOfDisk ArrayOfJob ArrayOfPackage ArrayOfDebitItem ArrayOfDebit }.each do |klass_name|
|
219
|
+
eval <<-EOF
|
220
|
+
class #{klass_name}
|
221
|
+
def to_handy_hash
|
222
|
+
map { |item| item.to_handy_hash }
|
223
|
+
end
|
224
|
+
end
|
225
|
+
EOF
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
@@ -0,0 +1,315 @@
|
|
1
|
+
require 'Flexiscale API.rb'
|
2
|
+
require 'Flexiscale APIMappingRegistry.rb'
|
3
|
+
require 'soap/rpc/driver'
|
4
|
+
|
5
|
+
module FlexiScale # :nodoc:
|
6
|
+
|
7
|
+
class FlexiScale < ::SOAP::RPC::Driver # :nodoc:
|
8
|
+
DefaultEndpointUrl = "https://api.flexiscale.com/0.5/index.php"
|
9
|
+
NsApiFlexiscaleCom = "http://api.flexiscale.com"
|
10
|
+
|
11
|
+
Methods = [
|
12
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListServers"),
|
13
|
+
"http://api.flexiscale.com",
|
14
|
+
"listServers",
|
15
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_string", "http://api.flexiscale.com", "ArrayOf_xsd_string"]],
|
16
|
+
["retval", "ListServersReturn", ["FlexiScale::ArrayOfServer", "http://api.flexiscale.com", "ArrayOfServer"]] ],
|
17
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
18
|
+
:response_style => :rpc, :response_use => :encoded,
|
19
|
+
:faults => {} }
|
20
|
+
],
|
21
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListJobs"),
|
22
|
+
"http://api.flexiscale.com",
|
23
|
+
"listJobs",
|
24
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
25
|
+
["retval", "ListJobsReturn", ["FlexiScale::ArrayOfJob", "http://api.flexiscale.com", "ArrayOfJob"]] ],
|
26
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
27
|
+
:response_style => :rpc, :response_use => :encoded,
|
28
|
+
:faults => {} }
|
29
|
+
],
|
30
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListFirewallTemplates"),
|
31
|
+
"http://api.flexiscale.com",
|
32
|
+
"listFirewallTemplates",
|
33
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
34
|
+
["retval", "ListFirewallTemplatesReturn", ["FlexiScale::ArrayOfFirewallTemplate", "http://api.flexiscale.com", "ArrayOfFirewallTemplate"]] ],
|
35
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
36
|
+
:response_style => :rpc, :response_use => :encoded,
|
37
|
+
:faults => {} }
|
38
|
+
],
|
39
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListFirewallRules"),
|
40
|
+
"http://api.flexiscale.com",
|
41
|
+
"listFirewallRules",
|
42
|
+
[ ["in", "firewall_id", ["::SOAP::SOAPInt"]],
|
43
|
+
["in", "direction", ["::SOAP::SOAPString"]],
|
44
|
+
["retval", "ListFirewallRulesReturn", ["FlexiScale::ArrayOfFirewallRule", "http://api.flexiscale.com", "ArrayOfFirewallRule"]] ],
|
45
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
46
|
+
:response_style => :rpc, :response_use => :encoded,
|
47
|
+
:faults => {} }
|
48
|
+
],
|
49
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListFirewallTemplateRules"),
|
50
|
+
"http://api.flexiscale.com",
|
51
|
+
"listFirewallTemplateRules",
|
52
|
+
[ ["in", "firewall_template_id", ["::SOAP::SOAPInt"]],
|
53
|
+
["in", "direction", ["::SOAP::SOAPString"]],
|
54
|
+
["retval", "ListFirewallTemplateRulesReturn", ["FlexiScale::ArrayOfFirewallTemplateRule", "http://api.flexiscale.com", "ArrayOfFirewallTemplateRule"]] ],
|
55
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
56
|
+
:response_style => :rpc, :response_use => :encoded,
|
57
|
+
:faults => {} }
|
58
|
+
],
|
59
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListFirewalls"),
|
60
|
+
"http://api.flexiscale.com",
|
61
|
+
"listFirewalls",
|
62
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
63
|
+
["retval", "ListFirewallsReturn", ["FlexiScale::ArrayOfFirewall", "http://api.flexiscale.com", "ArrayOfFirewall"]] ],
|
64
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
65
|
+
:response_style => :rpc, :response_use => :encoded,
|
66
|
+
:faults => {} }
|
67
|
+
],
|
68
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListFirewallProtocols"),
|
69
|
+
"http://api.flexiscale.com",
|
70
|
+
"listFirewallProtocols",
|
71
|
+
[ ["retval", "ListFirewallProtocolsReturn", ["FlexiScale::ArrayOfFirewallProtocol", "http://api.flexiscale.com", "ArrayOfFirewallProtocol"]] ],
|
72
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
73
|
+
:response_style => :rpc, :response_use => :encoded,
|
74
|
+
:faults => {} }
|
75
|
+
],
|
76
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListIcmpProtocols"),
|
77
|
+
"http://api.flexiscale.com",
|
78
|
+
"listIcmpProtocols",
|
79
|
+
[ ["retval", "ListIcmpProtocolsReturn", ["FlexiScale::ArrayOfIcmpProtocol", "http://api.flexiscale.com", "ArrayOfIcmpProtocol"]] ],
|
80
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
81
|
+
:response_style => :rpc, :response_use => :encoded,
|
82
|
+
:faults => {} }
|
83
|
+
],
|
84
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListIpBlocks"),
|
85
|
+
"http://api.flexiscale.com",
|
86
|
+
"listIpBlocks",
|
87
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
88
|
+
["retval", "ListIpBlocksReturn", ["FlexiScale::ArrayOfIpBlock", "http://api.flexiscale.com", "ArrayOfIpBlock"]] ],
|
89
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
90
|
+
:response_style => :rpc, :response_use => :encoded,
|
91
|
+
:faults => {} }
|
92
|
+
],
|
93
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "FilterJobs"),
|
94
|
+
"http://api.flexiscale.com",
|
95
|
+
"filterJobs",
|
96
|
+
[ ["in", "limit", ["::SOAP::SOAPInt"]],
|
97
|
+
["in", "order_by", ["::SOAP::SOAPString"]],
|
98
|
+
["in", "direction", ["::SOAP::SOAPString"]],
|
99
|
+
["retval", "ListJobsReturn", ["FlexiScale::ArrayOfJob", "http://api.flexiscale.com", "ArrayOfJob"]] ],
|
100
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
101
|
+
:response_style => :rpc, :response_use => :encoded,
|
102
|
+
:faults => {} }
|
103
|
+
],
|
104
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "Login"),
|
105
|
+
"http://api.flexiscale.com",
|
106
|
+
"login",
|
107
|
+
[ ["in", "username", ["::SOAP::SOAPString"]],
|
108
|
+
["in", "password", ["::SOAP::SOAPString"]] ],
|
109
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
110
|
+
:response_style => :rpc, :response_use => :encoded,
|
111
|
+
:faults => {} }
|
112
|
+
],
|
113
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "Logout"),
|
114
|
+
"https://api.flexiscale.com",
|
115
|
+
"logout",
|
116
|
+
[],
|
117
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
118
|
+
:response_style => :rpc, :response_use => :encoded,
|
119
|
+
:faults => {} }
|
120
|
+
],
|
121
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListRunningJobs"),
|
122
|
+
"https://api.flexiscale.com",
|
123
|
+
"listRunningJobs",
|
124
|
+
[ ["retval", "ListRunningJobsReturn", ["FlexiScale::ArrayOfJob", "http://api.flexiscale.com", "ArrayOfJob"]] ],
|
125
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
126
|
+
:response_style => :rpc, :response_use => :encoded,
|
127
|
+
:faults => {} }
|
128
|
+
],
|
129
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListOperatingSystemImages"),
|
130
|
+
"https://api.flexiscale.com",
|
131
|
+
"listOperatingSystemImages",
|
132
|
+
[ ["retval", "ListOperatingSystemImagesReturn", ["FlexiScale::ArrayOfOperatingSystemImage", "http://api.flexiscale.com", "ArrayOfOperatingSystemImage"]] ],
|
133
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
134
|
+
:response_style => :rpc, :response_use => :encoded,
|
135
|
+
:faults => {} }
|
136
|
+
],
|
137
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListDisks"),
|
138
|
+
"https://api.flexiscale.com",
|
139
|
+
"listDisks",
|
140
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
141
|
+
["retval", "ListDisksReturn", ["FlexiScale::ArrayOfDisk", "http://api.flexiscale.com", "ArrayOfDisk"]] ],
|
142
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
143
|
+
:response_style => :rpc, :response_use => :encoded,
|
144
|
+
:faults => {} }
|
145
|
+
],
|
146
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListDebitItems"),
|
147
|
+
"https://api.flexiscale.com",
|
148
|
+
"listDebitItems",
|
149
|
+
[ ["in", "item_type", ["::SOAP::SOAPString"]],
|
150
|
+
["in", "type_id", ["::SOAP::SOAPInt"]],
|
151
|
+
["in", "start_date", ["::SOAP::SOAPInt"]],
|
152
|
+
["in", "end_date", ["::SOAP::SOAPInt"]],
|
153
|
+
["retval", "ListDebitItemsReturn", ["FlexiScale::ArrayOfDebitItem", "http://api.flexiscale.com", "ArrayOfDebitItem"]] ],
|
154
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
155
|
+
:response_style => :rpc, :response_use => :encoded,
|
156
|
+
:faults => {} }
|
157
|
+
],
|
158
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListCredits"),
|
159
|
+
"https://api.flexiscale.com",
|
160
|
+
"listCredits",
|
161
|
+
[ ["in", "start_date", ["::SOAP::SOAPInt"]],
|
162
|
+
["in", "end_date", ["::SOAP::SOAPInt"]],
|
163
|
+
["retval", "ListCreditsReturn", ["FlexiScale::ArrayOfCredit", "http://api.flexiscale.com", "ArrayOfCredit"]] ],
|
164
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
165
|
+
:response_style => :rpc, :response_use => :encoded,
|
166
|
+
:faults => {} }
|
167
|
+
],
|
168
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListDebits"),
|
169
|
+
"https://api.flexiscale.com",
|
170
|
+
"listDebits",
|
171
|
+
[ ["in", "start_date", ["::SOAP::SOAPInt"]],
|
172
|
+
["in", "end_date", ["::SOAP::SOAPInt"]],
|
173
|
+
["retval", "ListDebitsReturn", ["FlexiScale::ArrayOfDebit", "http://api.flexiscale.com", "ArrayOfDebit"]] ],
|
174
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
175
|
+
:response_style => :rpc, :response_use => :encoded,
|
176
|
+
:faults => {} }
|
177
|
+
],
|
178
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListNetworkInterfaces"),
|
179
|
+
"https://api.flexiscale.com",
|
180
|
+
"listNetworkInterfaces",
|
181
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
182
|
+
["retval", "ListNetworkInterfacesReturn", ["FlexiScale::ArrayOfNetworkInterface", "http://api.flexiscale.com", "ArrayOfNetworkInterface"]] ],
|
183
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
184
|
+
:response_style => :rpc, :response_use => :encoded,
|
185
|
+
:faults => {} }
|
186
|
+
],
|
187
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListVlans"),
|
188
|
+
"https://api.flexiscale.com",
|
189
|
+
"listVlans",
|
190
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
191
|
+
["retval", "ListVlansReturn", ["FlexiScale::ArrayOfVlan", "http://api.flexiscale.com", "ArrayOfVlan"]] ],
|
192
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
193
|
+
:response_style => :rpc, :response_use => :encoded,
|
194
|
+
:faults => {} }
|
195
|
+
],
|
196
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ListPackages"),
|
197
|
+
"https://api.flexiscale.com",
|
198
|
+
"listPackages",
|
199
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
200
|
+
["retval", "ListPackagesReturn", ["FlexiScale::ArrayOfPackage", "http://api.flexiscale.com", "ArrayOfPackage"]] ],
|
201
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
202
|
+
:response_style => :rpc, :response_use => :encoded,
|
203
|
+
:faults => {} }
|
204
|
+
],
|
205
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "StartServer"),
|
206
|
+
"https://api.flexiscale.com",
|
207
|
+
"startServer",
|
208
|
+
[ ["in", "server_name", ["::SOAP::SOAPString"]],
|
209
|
+
["in", "notes", ["::SOAP::SOAPString"]],
|
210
|
+
["retval", "StartServerReturn", ["::SOAP::SOAPInt"]] ],
|
211
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
212
|
+
:response_style => :rpc, :response_use => :encoded,
|
213
|
+
:faults => {} }
|
214
|
+
],
|
215
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "StopServer"),
|
216
|
+
"https://api.flexiscale.com",
|
217
|
+
"stopServer",
|
218
|
+
[ ["in", "server_name", ["::SOAP::SOAPString"]],
|
219
|
+
["in", "stop_method", ["::SOAP::SOAPInt"]],
|
220
|
+
["in", "notes", ["::SOAP::SOAPString"]],
|
221
|
+
["retval", "StopServerReturn", ["::SOAP::SOAPInt"]] ],
|
222
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
223
|
+
:response_style => :rpc, :response_use => :encoded,
|
224
|
+
:faults => {} }
|
225
|
+
],
|
226
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "RebootServer"),
|
227
|
+
"https://api.flexiscale.com",
|
228
|
+
"rebootServer",
|
229
|
+
[ ["in", "server_name", ["::SOAP::SOAPString"]],
|
230
|
+
["in", "notes", ["::SOAP::SOAPString"]],
|
231
|
+
["retval", "RebootServerReturn", ["::SOAP::SOAPInt"]] ],
|
232
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
233
|
+
:response_style => :rpc, :response_use => :encoded,
|
234
|
+
:faults => {} }
|
235
|
+
],
|
236
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "StopStartServer"),
|
237
|
+
"https://api.flexiscale.com",
|
238
|
+
"stopStartServer",
|
239
|
+
[ ["in", "server_name", ["::SOAP::SOAPString"]],
|
240
|
+
["in", "notes", ["::SOAP::SOAPString"]],
|
241
|
+
["retval", "StopStartServerReturn", ["::SOAP::SOAPInt"]] ],
|
242
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
243
|
+
:response_style => :rpc, :response_use => :encoded,
|
244
|
+
:faults => {} }
|
245
|
+
],
|
246
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "WaitForJobs"),
|
247
|
+
"https://api.flexiscale.com",
|
248
|
+
"waitForJobs",
|
249
|
+
[ ["in", "list", ["FlexiScale::ArrayOf_xsd_int", "http://api.flexiscale.com", "ArrayOf_xsd_int"]],
|
250
|
+
["retval", "WaitForJobsReturn", ["::SOAP::SOAPBoolean"]] ],
|
251
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
252
|
+
:response_style => :rpc, :response_use => :encoded,
|
253
|
+
:faults => {} }
|
254
|
+
],
|
255
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "DestroyServer"),
|
256
|
+
"https://api.flexiscale.com",
|
257
|
+
"destroyServer",
|
258
|
+
[ ["in", "server_name", ["::SOAP::SOAPString"]],
|
259
|
+
["retval", "DestroyServerReturn", ["::SOAP::SOAPInt"]] ],
|
260
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
261
|
+
:response_style => :rpc, :response_use => :encoded,
|
262
|
+
:faults => {} }
|
263
|
+
],
|
264
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "CreateServer"),
|
265
|
+
"https://api.flexiscale.com",
|
266
|
+
"createServer",
|
267
|
+
[ ["in", "specification", ["FlexiScale::Server", "http://api.flexiscale.com", "Server"]],
|
268
|
+
["in", "vlan", ["FlexiScale::Vlan", "http://api.flexiscale.com", "Vlan"]],
|
269
|
+
["retval", "CreateServerReturn", ["::SOAP::SOAPInt"]] ],
|
270
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
271
|
+
:response_style => :rpc, :response_use => :encoded,
|
272
|
+
:faults => {} }
|
273
|
+
],
|
274
|
+
[ XSD::QName.new(NsApiFlexiscaleCom, "ModifyServer"),
|
275
|
+
"https://api.flexiscale.com",
|
276
|
+
"modifyServer",
|
277
|
+
[ ["in", "specification", ["FlexiScale::Server", "http://api.flexiscale.com", "Server"]],
|
278
|
+
["retval", "ModifyServerReturn", ["FlexiScale::Server", "http://api.flexiscale.com", "Server"]] ],
|
279
|
+
{ :request_style => :rpc, :request_use => :encoded,
|
280
|
+
:response_style => :rpc, :response_use => :encoded,
|
281
|
+
:faults => {} }
|
282
|
+
]
|
283
|
+
]
|
284
|
+
|
285
|
+
def initialize(endpoint_url = nil)
|
286
|
+
endpoint_url ||= DefaultEndpointUrl
|
287
|
+
super(endpoint_url, nil)
|
288
|
+
self.mapping_registry = FlexiscaleAPIMappingRegistry::EncodedRegistry
|
289
|
+
self.literal_mapping_registry = FlexiscaleAPIMappingRegistry::LiteralRegistry
|
290
|
+
init_methods
|
291
|
+
end
|
292
|
+
|
293
|
+
private
|
294
|
+
|
295
|
+
def init_methods
|
296
|
+
Methods.each do |definitions|
|
297
|
+
opt = definitions.last
|
298
|
+
if opt[:request_style] == :document
|
299
|
+
add_document_operation(*definitions)
|
300
|
+
else
|
301
|
+
add_rpc_operation(*definitions)
|
302
|
+
qname = definitions[0]
|
303
|
+
name = definitions[2]
|
304
|
+
if qname.name != name and qname.name.capitalize == name.capitalize
|
305
|
+
::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
|
306
|
+
__send__(name, *arg)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
|
315
|
+
end
|