cloudstack_ruby_client 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/lib/cloudstack_ruby_client.rb +6 -1
  2. data/lib/cloudstack_ruby_client/api/accounts_api.rb +59 -57
  3. data/lib/cloudstack_ruby_client/api/autoscale_api.rb +23 -21
  4. data/lib/cloudstack_ruby_client/api/configuration_api.rb +13 -11
  5. data/lib/cloudstack_ruby_client/api/firewall_api.rb +13 -11
  6. data/lib/cloudstack_ruby_client/api/infra_api.rb +40 -38
  7. data/lib/cloudstack_ruby_client/api/network_api.rb +112 -110
  8. data/lib/cloudstack_ruby_client/api/project_api.rb +13 -11
  9. data/lib/cloudstack_ruby_client/api/securitygroup_api.rb +10 -8
  10. data/lib/cloudstack_ruby_client/api/serviceoffering_api.rb +14 -12
  11. data/lib/cloudstack_ruby_client/api/snapshot_api.rb +10 -8
  12. data/lib/cloudstack_ruby_client/api/storage_api.rb +16 -14
  13. data/lib/cloudstack_ruby_client/api/systemvm_api.rb +22 -20
  14. data/lib/cloudstack_ruby_client/api/template_api.rb +31 -29
  15. data/lib/cloudstack_ruby_client/api/vm_api.rb +28 -26
  16. data/lib/cloudstack_ruby_client/api/volume_api.rb +12 -10
  17. data/lib/cloudstack_ruby_client/base_client.rb +11 -20
  18. data/lib/cloudstack_ruby_client/client.rb +43 -43
  19. data/lib/cloudstack_ruby_client/client_helper.rb +64 -17
  20. data/lib/cloudstack_ruby_client/version.rb +1 -1
  21. data/test/unit/accounts_test.rb +284 -0
  22. data/test/unit/autoscale_test.rb +134 -0
  23. data/test/unit/configuration_test.rb +55 -0
  24. data/test/unit/firewall_test.rb +77 -0
  25. data/test/unit/infra_test.rb +79 -22
  26. data/test/unit/network_test.rb +190 -0
  27. data/test/unit/project_test.rb +73 -0
  28. data/test/unit/securitygroup_test.rb +64 -0
  29. data/test/unit/serviceoffering_test.rb +69 -0
  30. data/test/unit/snapshot_test.rb +52 -0
  31. data/test/unit/storage_test.rb +76 -0
  32. data/test/unit/systemvm_test.rb +115 -0
  33. data/test/unit/template_test.rb +153 -0
  34. data/test/unit/vm_test.rb +151 -0
  35. data/test/unit/volume_test.rb +76 -0
  36. metadata +26 -3
  37. data/lib/cloudstack_ruby_client/api/config.rb +0 -15
@@ -0,0 +1,73 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class ProjectTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ config = YAML.load_file("test/config.yml")
9
+ _host = config['cloudstack']['host']
10
+ _port = config['cloudstack']['port']
11
+ _admin_port = config['cloudstack']['admin_port']
12
+ _api_key = config['cloudstack']['api_key']
13
+ _secret_key = config['cloudstack']['secret_key']
14
+ @client = CloudstackRubyClient::Client.new \
15
+ "http://#{_host}:#{_port}/client/api",
16
+ "#{_api_key}",
17
+ "#{_secret_key}"
18
+ end
19
+
20
+ def teardown
21
+ # Do nothing here!
22
+ end
23
+
24
+ def test_create_project
25
+ assert_raise(ArgumentError) do
26
+ @client.create_project
27
+ end
28
+ end
29
+
30
+ def test_delete_project
31
+ assert_raise(ArgumentError) do
32
+ @client.delete_project
33
+ end
34
+ end
35
+
36
+ def test_update_project
37
+ assert_raise(ArgumentError) do
38
+ @client.update_project
39
+ end
40
+ end
41
+
42
+ def test_activate_project
43
+ assert_raise(ArgumentError) do
44
+ @client.activate_project
45
+ end
46
+ end
47
+
48
+ def test_suspend_project
49
+ assert_raise(ArgumentError) do
50
+ @client.suspend_project
51
+ end
52
+ end
53
+
54
+ def test_list_projects
55
+ assert_equal({}, @client.list_projects)
56
+ end
57
+
58
+ def test_list_project_invitations
59
+ assert_equal({}, @client.list_project_invitations)
60
+ end
61
+
62
+ def test_update_project_invitation
63
+ assert_raise(ArgumentError) do
64
+ @client.update_project_invitation
65
+ end
66
+ end
67
+
68
+ def test_delete_project_invitation
69
+ assert_raise(ArgumentError) do
70
+ @client.delete_project_invitation
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,64 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class SecurityGroupTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ config = YAML.load_file("test/config.yml")
9
+ _host = config['cloudstack']['host']
10
+ _port = config['cloudstack']['port']
11
+ _admin_port = config['cloudstack']['admin_port']
12
+ _api_key = config['cloudstack']['api_key']
13
+ _secret_key = config['cloudstack']['secret_key']
14
+ @client = CloudstackRubyClient::Client.new \
15
+ "http://#{_host}:#{_port}/client/api",
16
+ "#{_api_key}",
17
+ "#{_secret_key}"
18
+ end
19
+
20
+ def teardown
21
+ # Do nothing here!
22
+ end
23
+
24
+ ### Security Group ###
25
+ def test_create_security_group
26
+ assert_raise(ArgumentError) do
27
+ @client.create_security_group
28
+ end
29
+ end
30
+
31
+ def test_delete_securiy_group
32
+ assert_raise(ArgumentError) do
33
+ @client.delete_security_group
34
+ end
35
+ end
36
+
37
+ def test_authorize_security_group_ingress
38
+ assert_raise(ArgumentError) do
39
+ @client.authorize_security_group_ingress
40
+ end
41
+ end
42
+
43
+ def test_revoke_security_group_ingress
44
+ assert_raise(ArgumentError) do
45
+ @client.revoke_security_group_ingress
46
+ end
47
+ end
48
+
49
+ def test_authorize_security_group_egress
50
+ assert_raise(ArgumentError) do
51
+ @client.authorize_security_group_egress
52
+ end
53
+ end
54
+
55
+ def test_revoke_security_group_egress
56
+ assert_raise(ArgumentError) do
57
+ @client.revoke_security_group_egress
58
+ end
59
+ end
60
+
61
+ def test_list_security_groups
62
+ assert_not_nil(@client.list_security_groups)
63
+ end
64
+ end
@@ -0,0 +1,69 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class ServiceOfferingTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ config = YAML.load_file("test/config.yml")
9
+ _host = config['cloudstack']['host']
10
+ _port = config['cloudstack']['port']
11
+ _admin_port = config['cloudstack']['admin_port']
12
+ _api_key = config['cloudstack']['api_key']
13
+ _secret_key = config['cloudstack']['secret_key']
14
+ @client = CloudstackRubyClient::Client.new \
15
+ "http://#{_host}:#{_port}/client/api",
16
+ "#{_api_key}",
17
+ "#{_secret_key}"
18
+ end
19
+
20
+ def teardown
21
+ # Do nothing here!
22
+ end
23
+
24
+ ### Service Offering ###
25
+ def test_create_service_offering
26
+ assert_raise(ArgumentError) do
27
+ @client.create_service_offering
28
+ end
29
+ end
30
+
31
+ def test_delete_service_offering
32
+ assert_raise(ArgumentError) do
33
+ @client.delete_service_offering
34
+ end
35
+ end
36
+
37
+ def test_update_service_offering
38
+ assert_raise(ArgumentError) do
39
+ @client.update_service_offering
40
+ end
41
+ end
42
+
43
+ def test_list_service_offerings
44
+ assert_not_nil(@client.list_service_offerings)
45
+ end
46
+
47
+ ### Disk Offering ###
48
+ def test_create_disk_offering
49
+ assert_raise(ArgumentError) do
50
+ @client.create_disk_offering
51
+ end
52
+ end
53
+
54
+ def test_update_disk_offering
55
+ assert_raise(ArgumentError) do
56
+ @client.update_disk_offering
57
+ end
58
+ end
59
+
60
+ def test_delete_disk_offering
61
+ assert_raise(ArgumentError) do
62
+ @client.delete_disk_offering
63
+ end
64
+ end
65
+
66
+ def test_list_disk_offerings
67
+ assert_not_nil(@client.list_disk_offerings)
68
+ end
69
+ end
@@ -0,0 +1,52 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class SnapshotTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ config = YAML.load_file("test/config.yml")
9
+ _host = config['cloudstack']['host']
10
+ _port = config['cloudstack']['port']
11
+ _admin_port = config['cloudstack']['admin_port']
12
+ _api_key = config['cloudstack']['api_key']
13
+ _secret_key = config['cloudstack']['secret_key']
14
+ @client = CloudstackRubyClient::Client.new \
15
+ "http://#{_host}:#{_port}/client/api",
16
+ "#{_api_key}",
17
+ "#{_secret_key}"
18
+ end
19
+
20
+ def teardown
21
+ # Do nothing here!
22
+ end
23
+
24
+ ### Snapshot ###
25
+ def test_create_snapshot
26
+ assert_raise(ArgumentError) do
27
+ @client.create_snapshot
28
+ end
29
+ end
30
+
31
+ def test_list_snapshots
32
+ assert_equal({}, @client.list_snapshots)
33
+ end
34
+
35
+ def test_create_snapshot_policy
36
+ assert_raise(ArgumentError) do
37
+ @client.create_snapshot_policy
38
+ end
39
+ end
40
+
41
+ def test_delete_snapshot_policies
42
+ assert_raise(ArgumentError) do
43
+ @client.delete_snapshot_policies
44
+ end
45
+ end
46
+
47
+ def test_list_snapshot_policies
48
+ assert_raise(ArgumentError) do
49
+ @client.list_snapshot_policies
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,76 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class StorageTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ config = YAML.load_file("test/config.yml")
9
+ _host = config['cloudstack']['host']
10
+ _port = config['cloudstack']['port']
11
+ _admin_port = config['cloudstack']['admin_port']
12
+ _api_key = config['cloudstack']['api_key']
13
+ _secret_key = config['cloudstack']['secret_key']
14
+ @client = CloudstackRubyClient::Client.new \
15
+ "http://#{_host}:#{_port}/client/api",
16
+ "#{_api_key}",
17
+ "#{_secret_key}"
18
+ end
19
+
20
+ def teardown
21
+ # Do nothing here!
22
+ end
23
+
24
+ def test_list_storage_pools
25
+ assert_equal({}, @client.list_storage_pools)
26
+ end
27
+
28
+ def test_create_storage_pool
29
+ assert_raise(ArgumentError) do
30
+ @client.create_storage_pool
31
+ end
32
+ end
33
+
34
+ def test_update_storage_pool
35
+ assert_raise(ArgumentError) do
36
+ @client.update_storage_pool
37
+ end
38
+ end
39
+
40
+ def test_delete_storage_pool
41
+ assert_raise(ArgumentError) do
42
+ @client.delete_storage_pool
43
+ end
44
+ end
45
+
46
+ def test_enable_storage_maintenance
47
+ assert_raise(ArgumentError) do
48
+ @client.enable_storage_maintenance
49
+ end
50
+ end
51
+
52
+ def test_cancel_storage_maintenance
53
+ assert_raise(ArgumentError) do
54
+ @client.cancel_storage_maintenance
55
+ end
56
+ end
57
+
58
+
59
+ ### Image Store ###
60
+
61
+ def test_list_image_stores
62
+ assert_equal({}, @client.list_image_stores)
63
+ end
64
+
65
+ def add_image_store
66
+ assert_raise(ArgumentError) do
67
+ @client.add_image_store
68
+ end
69
+ end
70
+
71
+ def delete_image_store
72
+ assert_raise(ArgumentError) do
73
+ @client.delete_image_store
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,115 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class SystemVmTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ config = YAML.load_file("test/config.yml")
9
+ _host = config['cloudstack']['host']
10
+ _port = config['cloudstack']['port']
11
+ _admin_port = config['cloudstack']['admin_port']
12
+ _api_key = config['cloudstack']['api_key']
13
+ _secret_key = config['cloudstack']['secret_key']
14
+ @client = CloudstackRubyClient::Client.new \
15
+ "http://#{_host}:#{_port}/client/api",
16
+ "#{_api_key}",
17
+ "#{_secret_key}"
18
+ end
19
+
20
+ def teardown
21
+ # Do nothing here!
22
+ end
23
+
24
+ ### System VM ###
25
+ def test_start_system_vm
26
+ assert_raise(ArgumentError) do
27
+ @client.start_system_vm
28
+ end
29
+ end
30
+
31
+ def test_reboot_system_vm
32
+ assert_raise(ArgumentError) do
33
+ @client.reboot_system_vm
34
+ end
35
+ end
36
+
37
+ def test_stop_system_vm
38
+ assert_raise(ArgumentError) do
39
+ @client.stop_system_vm
40
+ end
41
+ end
42
+
43
+ def test_destroy_system_vm
44
+ assert_raise(ArgumentError) do
45
+ @client.destroy_system_vm
46
+ end
47
+ end
48
+
49
+ def test_list_system_vms
50
+ assert_equal({}, @client.list_system_vms)
51
+ end
52
+
53
+ def test_migrate_system_vm
54
+ assert_raise(ArgumentError) do
55
+ @client.migrate_system_vm
56
+ end
57
+ end
58
+
59
+ def test_change_service_for_system_vm
60
+ assert_raise(ArgumentError) do
61
+ @client.change_service_for_system_vm
62
+ end
63
+ end
64
+
65
+ ### Virtual Router ###
66
+ def test_start_router
67
+ assert_raise(ArgumentError) do
68
+ @client.start_router
69
+ end
70
+ end
71
+
72
+ def test_reboot_router
73
+ assert_raise(ArgumentError) do
74
+ @client.reboot_router
75
+ end
76
+ end
77
+
78
+ def test_stop_router
79
+ assert_raise(ArgumentError) do
80
+ @client.stop_router
81
+ end
82
+ end
83
+
84
+ def test_destroy_router
85
+ assert_raise(ArgumentError) do
86
+ @client.destroy_router
87
+ end
88
+ end
89
+
90
+ def test_change_service_for_router
91
+ assert_raise(ArgumentError) do
92
+ @client.change_service_for_router
93
+ end
94
+ end
95
+
96
+ def test_list_routers
97
+ assert_equal({}, @client.list_routers)
98
+ end
99
+
100
+ def test_list_virtual_router_elements
101
+ assert_equal({}, @client.list_virtual_router_elements)
102
+ end
103
+
104
+ def test_configure_virtual_router_element
105
+ assert_raise(ArgumentError) do
106
+ @client.configure_virtual_router_element
107
+ end
108
+ end
109
+
110
+ def test_create_virtual_router_element
111
+ assert_raise(ArgumentError) do
112
+ @client.create_virtual_router_element
113
+ end
114
+ end
115
+ end