right_flexiscale 0.1.0
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.
- 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,42 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2008-2009 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
|
+
$:.unshift(File.dirname(__FILE__))
|
25
|
+
$:.unshift(File.dirname(__FILE__) + "/api")
|
26
|
+
|
27
|
+
require 'rubygems'
|
28
|
+
gem 'soap4r'
|
29
|
+
require 'benchmark'
|
30
|
+
require 'api/benchmark_fix'
|
31
|
+
require 'api/right_flexiscale_api'
|
32
|
+
|
33
|
+
|
34
|
+
module RightFlexiscale
|
35
|
+
module VERSION #:nodoc:
|
36
|
+
MAJOR = 0
|
37
|
+
MINOR = 1
|
38
|
+
TINY = 0
|
39
|
+
|
40
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
41
|
+
end
|
42
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
|
+
|
3
|
+
class TestRightFlexiscale < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@flexiscale = Rightscale::FlexiscaleApi.new(TestFlexiscaleCredentials.username,
|
7
|
+
TestFlexiscaleCredentials.password,
|
8
|
+
:skip_logging => true)
|
9
|
+
@test_server_name = "right_flexiscale_awesome_test_server_1234567890"
|
10
|
+
end
|
11
|
+
|
12
|
+
#=begin
|
13
|
+
|
14
|
+
def test_01_list_credits
|
15
|
+
result = @flexiscale.list_credits
|
16
|
+
assert result.is_a?(Array)
|
17
|
+
end
|
18
|
+
|
19
|
+
# def test_02_list_debit_items
|
20
|
+
# result = @flexiscale.list_debit_items(a,b)
|
21
|
+
# assert result.is_a?(Array)
|
22
|
+
# end
|
23
|
+
|
24
|
+
def test_03_list_debits
|
25
|
+
result = @flexiscale.list_debits
|
26
|
+
assert result.is_a?(Array)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_04_list_disks
|
30
|
+
result = @flexiscale.list_disks
|
31
|
+
assert result.is_a?(Array)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_05_list_firewall_protocols
|
35
|
+
result = @flexiscale.list_firewall_protocols
|
36
|
+
assert result.is_a?(Array)
|
37
|
+
end
|
38
|
+
|
39
|
+
# def test_06_list_firewall_rules
|
40
|
+
# result = @flexiscale.list_firewall_rules(a)
|
41
|
+
# assert result.is_a?(Array)
|
42
|
+
# end
|
43
|
+
|
44
|
+
# def test_07_list_firewall_template_rules
|
45
|
+
# result = @flexiscale.list_firewall_template_rules(a)
|
46
|
+
# assert result.is_a?(Array)
|
47
|
+
# end
|
48
|
+
|
49
|
+
def test_08_list_firewall_templates
|
50
|
+
result = @flexiscale.list_firewall_templates
|
51
|
+
assert result.is_a?(Array)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_09_list_firewalls
|
55
|
+
result = @flexiscale.list_firewalls
|
56
|
+
assert result.is_a?(Array)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_10_list_icmp_protocols
|
60
|
+
result = @flexiscale.list_icmp_protocols
|
61
|
+
assert result.is_a?(Array)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_11_list_ip_blocks
|
65
|
+
result = @flexiscale.list_ip_blocks
|
66
|
+
assert result.is_a?(Array)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_12_list_jobs
|
70
|
+
result = @flexiscale.list_jobs
|
71
|
+
assert result.is_a?(Array)
|
72
|
+
#filter_jobs
|
73
|
+
#list_running_jobs
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_13_list_network_interfaces
|
77
|
+
result = @flexiscale.list_network_interfaces
|
78
|
+
assert result.is_a?(Array)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_14_list_operating_system_images
|
82
|
+
result = @flexiscale.list_operating_system_images
|
83
|
+
assert result.is_a?(Array)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_15_list_packages
|
87
|
+
result = @flexiscale.list_packages
|
88
|
+
assert result.is_a?(Array)
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_16_list_vlans
|
92
|
+
result = @flexiscale.list_vlans
|
93
|
+
assert result.is_a?(Array)
|
94
|
+
end
|
95
|
+
|
96
|
+
#=end
|
97
|
+
|
98
|
+
#---------------------------
|
99
|
+
# Servers
|
100
|
+
#---------------------------
|
101
|
+
|
102
|
+
def test_30_remove_test_server
|
103
|
+
@flexiscale.destroy_server(@test_server_name) rescue nil
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_31_list_servers
|
107
|
+
result = @flexiscale.list_servers
|
108
|
+
assert result.is_a?(Array)
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_32_create_server
|
112
|
+
image = @flexiscale.list_operating_system_images.first
|
113
|
+
package = @flexiscale.list_packages.first
|
114
|
+
vlan = @flexiscale.list_vlans.first
|
115
|
+
server_id = @flexiscale.create_server(@test_server_name, package[:fxs_id], 2, 2048, 20, image[:fxs_id], vlan[:fxs_id])
|
116
|
+
assert server_id.is_a?(Fixnum)
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_33_modify_server
|
120
|
+
server = nil
|
121
|
+
assert_nothing_raised do
|
122
|
+
server = @flexiscale.list_servers(@test_server_name).first
|
123
|
+
end
|
124
|
+
assert_equal(2, server[:processors])
|
125
|
+
assert_equal(2048, server[:memory])
|
126
|
+
# update the server and make sure the modifications were applied
|
127
|
+
modified_server = @flexiscale.modify_server(server[:fxs_id], 1, 1024)
|
128
|
+
assert_equal(1, modified_server[:processors])
|
129
|
+
assert_equal(1024, modified_server[:memory])
|
130
|
+
end
|
131
|
+
|
132
|
+
# TODO:reboot_server start_server stop_server stop_start_server
|
133
|
+
|
134
|
+
def test_39_destroy_server
|
135
|
+
assert_nothing_raised do
|
136
|
+
assert @flexiscale.destroy_server(@test_server_name)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
metadata
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: right_flexiscale
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- RightScale, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-23 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: soap4r
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.5.8
|
24
|
+
version:
|
25
|
+
description: "== DESCRIPTION: The RightScale GoGrid gem has been designed to provide a robust interface to Flexiscale\xE2\x80\x98s existing API. == FEATURES/PROBLEMS: * Full programmatic access to the Flexiscale API. * Complete error handling: all operations check for errors and report complete error information."
|
26
|
+
email: rubygems@rightscale.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- History.txt
|
33
|
+
- Manifest.txt
|
34
|
+
- README.txt
|
35
|
+
files:
|
36
|
+
- History.txt
|
37
|
+
- Manifest.txt
|
38
|
+
- README.txt
|
39
|
+
- Rakefile
|
40
|
+
- lib/right_flexiscale.rb
|
41
|
+
- lib/api/Flexiscale APIAddons.rb
|
42
|
+
- lib/api/Flexiscale APIDriver.rb
|
43
|
+
- lib/api/Flexiscale APIMappingRegistry.rb
|
44
|
+
- lib/api/Flexiscale API.rb
|
45
|
+
- lib/api/right_flexiscale_api.rb
|
46
|
+
- lib/api/benchmark_fix.rb
|
47
|
+
- test/test_helper.rb
|
48
|
+
- test/test_right_flexiscale.rb
|
49
|
+
has_rdoc: true
|
50
|
+
homepage:
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options:
|
53
|
+
- --main
|
54
|
+
- README.txt
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project: rightscale
|
72
|
+
rubygems_version: 1.3.1
|
73
|
+
signing_key:
|
74
|
+
specification_version: 2
|
75
|
+
summary: Interface classes for the FlexiScale Web Services
|
76
|
+
test_files: []
|
77
|
+
|