cloudstack_ruby_client 0.1.0 → 0.1.1

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.
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,153 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class TemplateTest < 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
+ ### Template ###
25
+ def test_create_template
26
+ assert_raise(ArgumentError) do
27
+ @client.create_template
28
+ end
29
+ end
30
+
31
+ def test_update_template
32
+ assert_raise(ArgumentError) do
33
+ @client.update_template
34
+ end
35
+ end
36
+
37
+ def test_copy_template
38
+ assert_raise(ArgumentError) do
39
+ @client.copy_template
40
+ end
41
+ end
42
+
43
+ def test_delete_template
44
+ assert_raise(ArgumentError) do
45
+ @client.delete_template
46
+ end
47
+ end
48
+
49
+ def test_list_templates
50
+ assert_raise(ArgumentError) do
51
+ @client.list_templates
52
+ end
53
+ end
54
+
55
+ def test_update_template_permissions
56
+ assert_raise(ArgumentError) do
57
+ @client.update_template_permissions
58
+ end
59
+ end
60
+
61
+ def test_list_template_permissions
62
+ assert_raise(ArgumentError) do
63
+ @client.list_template_permissions
64
+ end
65
+ end
66
+
67
+ def test_extract_template
68
+ assert_raise(ArgumentError) do
69
+ @client.extract_template
70
+ end
71
+ end
72
+
73
+ def test_prepare_template
74
+ assert_raise(ArgumentError) do
75
+ @client.prepare_template
76
+ end
77
+ end
78
+
79
+ ### ISO ###
80
+ def test_attach_iso
81
+ assert_raise(ArgumentError) do
82
+ @client.attach_iso
83
+ end
84
+ end
85
+
86
+ def test_detach_iso
87
+ assert_raise(ArgumentError) do
88
+ @client.detach_iso
89
+ end
90
+ end
91
+
92
+ def test_list_isos
93
+ assert_not_nil(@client.list_isos)
94
+ end
95
+
96
+ def test_update_iso
97
+ assert_raise(ArgumentError) do
98
+ @client.update_iso
99
+ end
100
+ end
101
+
102
+ def test_delete_iso
103
+ assert_raise(ArgumentError) do
104
+ @client.delete_iso
105
+ end
106
+ end
107
+
108
+ def test_copy_iso
109
+ assert_raise(ArgumentError) do
110
+ @client.copy_iso
111
+ end
112
+ end
113
+
114
+ def test_update_iso_permissions
115
+ assert_raise(ArgumentError) do
116
+ @client.update_iso_permissions
117
+ end
118
+ end
119
+
120
+ def test_list_iso_permissions
121
+ assert_raise(ArgumentError) do
122
+ @client.list_iso_permissions
123
+ end
124
+ end
125
+
126
+ def test_extract_iso
127
+ assert_raise(ArgumentError) do
128
+ @client.extract_iso
129
+ end
130
+ end
131
+
132
+ ### Registration ###
133
+ def test_register_template
134
+ assert_raise(ArgumentError) do
135
+ @client.register_template
136
+ end
137
+ end
138
+
139
+ def test_register_iso
140
+ assert_raise(ArgumentError) do
141
+ @client.register_iso
142
+ end
143
+ end
144
+
145
+ def test_register_user_keys
146
+ assert_raise(ArgumentError) do
147
+ @client.register_user_keys
148
+ end
149
+ end
150
+
151
+ def test_register_ssh_key_pair
152
+ end
153
+ end
data/test/unit/vm_test.rb CHANGED
@@ -0,0 +1,151 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class VirtualMachineTest < 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_deploy_virtual_machine
25
+ assert_raise(ArgumentError) do
26
+ @client.deploy_virtual_machine
27
+ end
28
+ end
29
+
30
+ def test_destroy_virtual_machine
31
+ assert_raise(ArgumentError) do
32
+ @client.destroy_virtual_machine
33
+ end
34
+ end
35
+
36
+ def test_reboot_virtual_machine
37
+ assert_raise(ArgumentError) do
38
+ @client.reboot_virtual_machine
39
+ end
40
+ end
41
+
42
+ def test_start_virtual_machine
43
+ assert_raise(ArgumentError) do
44
+ @client.start_virtual_machine
45
+ end
46
+ end
47
+
48
+ def test_stop_virtual_machine
49
+ assert_raise(ArgumentError) do
50
+ @client.stop_virtual_machine
51
+ end
52
+ end
53
+
54
+ def test_reset_password_for_virtual_machine
55
+ assert_raise(ArgumentError) do
56
+ @client.reset_password_for_virtual_machine
57
+ end
58
+ end
59
+
60
+ def test_reset_ssh_key_for_virtual_machine
61
+ assert_raise(ArgumentError) do
62
+ @client.reset_ssh_key_for_virtual_machine
63
+ end
64
+ end
65
+
66
+ def test_update_virtual_machine
67
+ assert_raise(ArgumentError) do
68
+ @client.update_virtual_machine
69
+ end
70
+ end
71
+
72
+ def test_list_virtual_machines
73
+ assert_equal({}, @client.list_virtual_machines)
74
+ end
75
+
76
+ def test_get_vm_password
77
+ assert_raise(ArgumentError) do
78
+ @client.get_vm_password
79
+ end
80
+ end
81
+
82
+ def test_restore_virtual_machine
83
+ assert_raise(ArgumentError) do
84
+ @client.restore_virtual_machine
85
+ end
86
+ end
87
+
88
+ def test_change_service_for_virtual_machine
89
+ assert_raise(ArgumentError) do
90
+ @client.change_service_for_virtual_machine
91
+ end
92
+ end
93
+
94
+ def test_assign_virtual_machine
95
+ assert_raise(ArgumentError) do
96
+ @client.assign_virtual_machine
97
+ end
98
+ end
99
+
100
+ def test_migrate_virtual_machine
101
+ assert_raise(ArgumentError) do
102
+ @client.migrate_virtual_machine
103
+ end
104
+ end
105
+
106
+ def test_recover_virtual_machine
107
+ assert_raise(ArgumentError) do
108
+ @client.recover_virtual_machine
109
+ end
110
+ end
111
+
112
+ def test_add_nic_to_virtual_machine
113
+ assert_raise(ArgumentError) do
114
+ @client.add_nic_to_virtual_machine
115
+ end
116
+ end
117
+
118
+ def test_remove_nic_from_virtual_machine
119
+ assert_raise(ArgumentError) do
120
+ @client.remove_nic_from_virtual_machine
121
+ end
122
+ end
123
+
124
+ def test_update_default_nic_for_virtual_machine
125
+ assert_raise(ArgumentError) do
126
+ @client.update_default_nic_for_virtual_machine
127
+ end
128
+ end
129
+
130
+ def test_create_instance_group
131
+ assert_raise(ArgumentError) do
132
+ @client.create_instance_group
133
+ end
134
+ end
135
+
136
+ def test_delete_instance_group
137
+ assert_raise(ArgumentError) do
138
+ @client.delete_instance_group
139
+ end
140
+ end
141
+
142
+ def test_update_instance_group
143
+ assert_raise(ArgumentError) do
144
+ @client.update_instance_group
145
+ end
146
+ end
147
+
148
+ def test_list_instance_groups
149
+ assert_equal({}, @client.list_instance_groups)
150
+ end
151
+ end
@@ -0,0 +1,76 @@
1
+ require 'test/unit'
2
+ require 'yaml'
3
+ require_relative '../../lib/cloudstack_ruby_client'
4
+
5
+ class VolumeTest < 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_attach_volume
25
+ assert_raise(ArgumentError) do
26
+ @client.attach_volume
27
+ end
28
+ end
29
+
30
+ def test_upload_volume
31
+ assert_raise(ArgumentError) do
32
+ @client.upload_volume
33
+ end
34
+ end
35
+
36
+ # ACS has a bug on this api command
37
+ # def test_detach_volume
38
+ # assert_raise(ArgumentError) do
39
+ # @client.detach_volume
40
+ # end
41
+ # end
42
+
43
+ def test_create_volume
44
+ assert_raise(ArgumentError) do
45
+ @client.create_volume
46
+ end
47
+ end
48
+
49
+ def test_delete_volume
50
+ assert_raise(ArgumentError) do
51
+ @client.delete_volume
52
+ end
53
+ end
54
+
55
+ def test_list_volumes
56
+ assert_equal({}, @client.list_volumes)
57
+ end
58
+
59
+ def test_extract_volume
60
+ assert_raise(ArgumentError) do
61
+ @client.extract_volume
62
+ end
63
+ end
64
+
65
+ def test_migrate_volume
66
+ assert_raise(ArgumentError) do
67
+ @client.migrate_volume
68
+ end
69
+ end
70
+
71
+ def test_resize_volume
72
+ assert_raise(ArgumentError) do
73
+ @client.resize_volume
74
+ end
75
+ end
76
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_ruby_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-07 00:00:00.000000000 Z
12
+ date: 2013-08-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby client for CloudStack's API, licensed via the Apache Software
15
15
  License v2.
@@ -29,7 +29,6 @@ files:
29
29
  - lib/cloudstack_ruby_client.rb
30
30
  - lib/cloudstack_ruby_client/api/accounts_api.rb
31
31
  - lib/cloudstack_ruby_client/api/autoscale_api.rb
32
- - lib/cloudstack_ruby_client/api/config.rb
33
32
  - lib/cloudstack_ruby_client/api/configuration_api.rb
34
33
  - lib/cloudstack_ruby_client/api/firewall_api.rb
35
34
  - lib/cloudstack_ruby_client/api/infra_api.rb
@@ -50,8 +49,20 @@ files:
50
49
  - test/config.yml
51
50
  - test/integration/client_test.rb
52
51
  - test/unit/accounts_test.rb
52
+ - test/unit/autoscale_test.rb
53
+ - test/unit/configuration_test.rb
54
+ - test/unit/firewall_test.rb
53
55
  - test/unit/infra_test.rb
56
+ - test/unit/network_test.rb
57
+ - test/unit/project_test.rb
58
+ - test/unit/securitygroup_test.rb
59
+ - test/unit/serviceoffering_test.rb
60
+ - test/unit/snapshot_test.rb
61
+ - test/unit/storage_test.rb
62
+ - test/unit/systemvm_test.rb
63
+ - test/unit/template_test.rb
54
64
  - test/unit/vm_test.rb
65
+ - test/unit/volume_test.rb
55
66
  homepage: http://chipchilders.github.io/cloudstack_ruby_client/
56
67
  licenses: []
57
68
  post_install_message:
@@ -80,5 +91,17 @@ test_files:
80
91
  - test/config.yml
81
92
  - test/integration/client_test.rb
82
93
  - test/unit/accounts_test.rb
94
+ - test/unit/autoscale_test.rb
95
+ - test/unit/configuration_test.rb
96
+ - test/unit/firewall_test.rb
83
97
  - test/unit/infra_test.rb
98
+ - test/unit/network_test.rb
99
+ - test/unit/project_test.rb
100
+ - test/unit/securitygroup_test.rb
101
+ - test/unit/serviceoffering_test.rb
102
+ - test/unit/snapshot_test.rb
103
+ - test/unit/storage_test.rb
104
+ - test/unit/systemvm_test.rb
105
+ - test/unit/template_test.rb
84
106
  - test/unit/vm_test.rb
107
+ - test/unit/volume_test.rb
@@ -1,15 +0,0 @@
1
- require_relative "infra_api"
2
- require_relative "accounts_api"
3
- require_relative "vm_api"
4
- require_relative "systemvm_api"
5
- require_relative "storage_api"
6
- require_relative "network_api"
7
- require_relative "volume_api"
8
- require_relative "template_api"
9
- require_relative "securitygroup_api"
10
- require_relative "project_api"
11
- require_relative "firewall_api"
12
- require_relative "snapshot_api"
13
- require_relative "configuration_api"
14
- require_relative "serviceoffering_api"
15
- require_relative "autoscale_api"