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.
- data/lib/cloudstack_ruby_client.rb +6 -1
- data/lib/cloudstack_ruby_client/api/accounts_api.rb +59 -57
- data/lib/cloudstack_ruby_client/api/autoscale_api.rb +23 -21
- data/lib/cloudstack_ruby_client/api/configuration_api.rb +13 -11
- data/lib/cloudstack_ruby_client/api/firewall_api.rb +13 -11
- data/lib/cloudstack_ruby_client/api/infra_api.rb +40 -38
- data/lib/cloudstack_ruby_client/api/network_api.rb +112 -110
- data/lib/cloudstack_ruby_client/api/project_api.rb +13 -11
- data/lib/cloudstack_ruby_client/api/securitygroup_api.rb +10 -8
- data/lib/cloudstack_ruby_client/api/serviceoffering_api.rb +14 -12
- data/lib/cloudstack_ruby_client/api/snapshot_api.rb +10 -8
- data/lib/cloudstack_ruby_client/api/storage_api.rb +16 -14
- data/lib/cloudstack_ruby_client/api/systemvm_api.rb +22 -20
- data/lib/cloudstack_ruby_client/api/template_api.rb +31 -29
- data/lib/cloudstack_ruby_client/api/vm_api.rb +28 -26
- data/lib/cloudstack_ruby_client/api/volume_api.rb +12 -10
- data/lib/cloudstack_ruby_client/base_client.rb +11 -20
- data/lib/cloudstack_ruby_client/client.rb +43 -43
- data/lib/cloudstack_ruby_client/client_helper.rb +64 -17
- data/lib/cloudstack_ruby_client/version.rb +1 -1
- data/test/unit/accounts_test.rb +284 -0
- data/test/unit/autoscale_test.rb +134 -0
- data/test/unit/configuration_test.rb +55 -0
- data/test/unit/firewall_test.rb +77 -0
- data/test/unit/infra_test.rb +79 -22
- data/test/unit/network_test.rb +190 -0
- data/test/unit/project_test.rb +73 -0
- data/test/unit/securitygroup_test.rb +64 -0
- data/test/unit/serviceoffering_test.rb +69 -0
- data/test/unit/snapshot_test.rb +52 -0
- data/test/unit/storage_test.rb +76 -0
- data/test/unit/systemvm_test.rb +115 -0
- data/test/unit/template_test.rb +153 -0
- data/test/unit/vm_test.rb +151 -0
- data/test/unit/volume_test.rb +76 -0
- metadata +26 -3
- data/lib/cloudstack_ruby_client/api/config.rb +0 -15
@@ -1,14 +1,16 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module Project
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
3
|
+
module Project
|
4
|
+
cmd_processor :create_project,
|
5
|
+
:delete_project,
|
6
|
+
:update_project,
|
7
|
+
:activate_project,
|
8
|
+
:suspend_project,
|
9
|
+
:list_projects,
|
10
|
+
:list_project_invitations,
|
11
|
+
:update_project_invitation,
|
12
|
+
:delete_project_invitation
|
13
|
+
|
14
|
+
end
|
13
15
|
end
|
14
16
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module SecurityGroup
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module SecurityGroup
|
4
|
+
cmd_processor :create_security_group,
|
5
|
+
:delete_security_group,
|
6
|
+
:authorize_security_group_ingress,
|
7
|
+
:revoke_security_group_ingress,
|
8
|
+
:authorize_security_group_egress,
|
9
|
+
:revoke_security_group_egress,
|
10
|
+
:list_security_groups
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
@@ -1,15 +1,17 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module ServiceOffering
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
3
|
+
module ServiceOffering
|
4
|
+
cmd_processor :create_service_offering,
|
5
|
+
:delete_service_offering,
|
6
|
+
:update_service_offering,
|
7
|
+
:list_service_offerings
|
8
|
+
end
|
9
|
+
|
10
|
+
module DiskOffering
|
11
|
+
cmd_processor :create_disk_offering,
|
12
|
+
:update_disk_offering,
|
13
|
+
:delete_disk_offering,
|
14
|
+
:list_disk_offerings
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module Snapshot
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
module Snapshot
|
4
|
+
cmd_processor :create_snapshot,
|
5
|
+
:list_snapshots,
|
6
|
+
:delete_snapshot,
|
7
|
+
:create_snapshot_policy,
|
8
|
+
# FIXME: Weird deleteSnapshotPolicies command
|
9
|
+
:delete_snapshot_policies,
|
10
|
+
:list_snapshot_policies
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
-
module
|
2
|
-
module
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
module CloudstackRubyClient
|
2
|
+
module Storage
|
3
|
+
module StoragePool
|
4
|
+
cmd_processor :list_storage_pools,
|
5
|
+
:create_storage_pool,
|
6
|
+
:update_storage_pool,
|
7
|
+
:delete_storage_pool,
|
8
|
+
:enable_storage_maintenance,
|
9
|
+
:cancel_storage_maintenance
|
10
|
+
end
|
11
|
+
|
12
|
+
module ImageStore
|
13
|
+
cmd_processor :list_image_stores,
|
14
|
+
:add_image_store,
|
15
|
+
:delete_image_store
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,23 +1,25 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module SystemVm
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
module SystemVm
|
4
|
+
cmd_processor :start_system_vm,
|
5
|
+
:reboot_system_vm,
|
6
|
+
:stop_system_vm,
|
7
|
+
:destroy_system_vm,
|
8
|
+
:list_system_vms,
|
9
|
+
:migrate_system_vm,
|
10
|
+
:change_service_for_system_vm
|
11
|
+
end
|
12
|
+
|
13
|
+
module Router
|
14
|
+
cmd_processor :start_router,
|
15
|
+
:reboot_router,
|
16
|
+
:stop_router,
|
17
|
+
:destroy_router,
|
18
|
+
:change_service_for_router,
|
19
|
+
:list_routers,
|
20
|
+
:list_virtual_router_elements,
|
21
|
+
:configure_virtual_router_element,
|
22
|
+
:create_virtual_router_element
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
@@ -1,32 +1,34 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module Template
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
3
|
+
module Template
|
4
|
+
cmd_processor :create_template,
|
5
|
+
:update_template,
|
6
|
+
:copy_template,
|
7
|
+
:delete_template,
|
8
|
+
:list_templates,
|
9
|
+
:update_template_permissions,
|
10
|
+
:list_template_permissions,
|
11
|
+
:extract_template,
|
12
|
+
:prepare_template
|
13
|
+
end
|
14
|
+
|
15
|
+
module ISO
|
16
|
+
cmd_processor :attach_iso,
|
17
|
+
:detach_iso,
|
18
|
+
:list_isos,
|
19
|
+
:update_iso,
|
20
|
+
:delete_iso,
|
21
|
+
:copy_iso,
|
22
|
+
:update_iso_permissions,
|
23
|
+
:list_iso_permissions,
|
24
|
+
:extract_iso
|
25
|
+
end
|
26
|
+
|
27
|
+
module Registration
|
28
|
+
cmd_processor :register_template,
|
29
|
+
:register_iso,
|
30
|
+
:register_user_keys,
|
31
|
+
:register_ssh_key_pair
|
32
|
+
end
|
31
33
|
end
|
32
34
|
end
|
@@ -1,29 +1,31 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module VirtualMachine
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
3
|
+
module VirtualMachine
|
4
|
+
cmd_processor :deploy_virtual_machine,
|
5
|
+
:destroy_virtual_machine,
|
6
|
+
:reboot_virtual_machine,
|
7
|
+
:start_virtual_machine,
|
8
|
+
:stop_virtual_machine,
|
9
|
+
:reset_password_for_virtual_machine,
|
10
|
+
:reset_ssh_key_for_virtual_machine,
|
11
|
+
:update_virtual_machine,
|
12
|
+
:list_virtual_machines,
|
13
|
+
:get_vm_password,
|
14
|
+
:restore_virtual_machine,
|
15
|
+
:change_service_for_virtual_machine,
|
16
|
+
:assign_virtual_machine,
|
17
|
+
:migrate_virtual_machine,
|
18
|
+
:recover_virtual_machine,
|
19
|
+
:add_nic_to_virtual_machine,
|
20
|
+
:remove_nic_from_virtual_machine,
|
21
|
+
:update_default_nic_for_virtual_machine
|
22
|
+
end
|
23
|
+
|
24
|
+
module VMGroup
|
25
|
+
cmd_processor :create_instance_group,
|
26
|
+
:delete_instance_group,
|
27
|
+
:update_instance_group,
|
28
|
+
:list_instance_groups
|
29
|
+
end
|
28
30
|
end
|
29
31
|
end
|
@@ -1,13 +1,15 @@
|
|
1
|
-
module
|
1
|
+
module CloudstackRubyClient
|
2
2
|
module Volume
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
module Volume
|
4
|
+
cmd_processor :attach_volume,
|
5
|
+
:upload_volume,
|
6
|
+
:detach_volume,
|
7
|
+
:create_volume,
|
8
|
+
:delete_volume,
|
9
|
+
:list_volumes,
|
10
|
+
:extract_volume,
|
11
|
+
:migrate_volume,
|
12
|
+
:resize_volume
|
13
|
+
end
|
12
14
|
end
|
13
15
|
end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'base64'
|
3
|
-
require 'openssl'
|
4
|
-
require 'uri'
|
5
|
-
require 'cgi'
|
6
|
-
require 'net/http'
|
7
|
-
require 'json'
|
1
|
+
# require 'rubygems'
|
2
|
+
# require 'base64'
|
3
|
+
# require 'openssl'
|
4
|
+
# require 'uri'
|
5
|
+
# require 'cgi'
|
6
|
+
# require 'net/http'
|
7
|
+
# require 'json'
|
8
8
|
|
9
9
|
class CloudstackRubyClient::BaseClient
|
10
10
|
|
@@ -20,12 +20,12 @@ class CloudstackRubyClient::BaseClient
|
|
20
20
|
params['apiKey'] = @api_key
|
21
21
|
|
22
22
|
params_arr = []
|
23
|
-
params.
|
23
|
+
params.each do |elem|
|
24
24
|
params_arr << elem[0].to_s + '=' + CGI.escape(elem[1].to_s)\
|
25
|
-
|
25
|
+
.gsub('+', '%20').gsub(' ','%20')
|
26
26
|
end
|
27
27
|
|
28
|
-
data = params_arr.join '&'
|
28
|
+
data = params_arr.sort.join '&'
|
29
29
|
|
30
30
|
signature = OpenSSL::HMAC.digest 'sha1', @secret_key, data.downcase
|
31
31
|
signature = Base64.encode64(signature).chomp
|
@@ -39,15 +39,6 @@ class CloudstackRubyClient::BaseClient
|
|
39
39
|
request = Net::HTTP::Get.new(uri.request_uri)
|
40
40
|
|
41
41
|
http.request(request)
|
42
|
-
|
43
|
-
# if !response.is_a?(Net::HTTPOK)
|
44
|
-
# puts "Error #{response.code}: #{response.message}"
|
45
|
-
# puts JSON.pretty_generate(JSON.parse(response.body))
|
46
|
-
# puts "URL: #{url}"
|
47
|
-
# exit 1
|
48
|
-
# end
|
49
|
-
|
50
|
-
# json = JSON.parse(response.body)
|
51
|
-
# json[params['command'].downcase + 'response']
|
52
42
|
end
|
43
|
+
|
53
44
|
end
|
@@ -1,75 +1,75 @@
|
|
1
|
-
require_relative "client_helper"
|
2
|
-
require_relative "api/config"
|
3
|
-
|
4
1
|
class CloudstackRubyClient::Client < CloudstackRubyClient::BaseClient
|
5
2
|
|
6
3
|
## Infra Api commands injection
|
7
|
-
include Infrastructure::Region
|
8
|
-
include Infrastructure::Zone
|
9
|
-
include Infrastructure::Pod
|
10
|
-
include Infrastructure::Cluster
|
11
|
-
include Infrastructure::Host
|
4
|
+
include CloudstackRubyClient::Infrastructure::Region
|
5
|
+
include CloudstackRubyClient::Infrastructure::Zone
|
6
|
+
include CloudstackRubyClient::Infrastructure::Pod
|
7
|
+
include CloudstackRubyClient::Infrastructure::Cluster
|
8
|
+
include CloudstackRubyClient::Infrastructure::Host
|
12
9
|
|
13
10
|
|
14
11
|
## Accounts Api command injection
|
15
|
-
include Accounts::Domain
|
16
|
-
include Accounts::Account
|
17
|
-
include Accounts::User
|
18
|
-
include Accounts::Limit
|
19
|
-
include Accounts::Usage
|
12
|
+
include CloudstackRubyClient::Accounts::Domain
|
13
|
+
include CloudstackRubyClient::Accounts::Account
|
14
|
+
include CloudstackRubyClient::Accounts::User
|
15
|
+
include CloudstackRubyClient::Accounts::Limit
|
16
|
+
include CloudstackRubyClient::Accounts::Usage
|
20
17
|
|
21
18
|
## System VM commands injection
|
22
|
-
include VirtualMachine::VirtualMachine
|
23
|
-
include VirtualMachine::VMGroup
|
19
|
+
include CloudstackRubyClient::VirtualMachine::VirtualMachine
|
20
|
+
include CloudstackRubyClient::VirtualMachine::VMGroup
|
24
21
|
|
25
22
|
## Virtual Machine commands insjection
|
26
|
-
include SystemVm::SystemVm
|
27
|
-
include SystemVm::Router
|
23
|
+
include CloudstackRubyClient::SystemVm::SystemVm
|
24
|
+
include CloudstackRubyClient::SystemVm::Router
|
28
25
|
|
29
26
|
## Storage commands injection
|
30
|
-
include Storage::StoragePool
|
31
|
-
include Storage::ImageStore
|
27
|
+
include CloudstackRubyClient::Storage::StoragePool
|
28
|
+
include CloudstackRubyClient::Storage::ImageStore
|
32
29
|
|
33
30
|
## Network commands injection
|
34
|
-
include Network::NetworkOffering
|
35
|
-
include Network::Network
|
36
|
-
include Network::PhysicalNetwork
|
37
|
-
include Network::NetworkServiceProvider
|
38
|
-
include Network::StorageIpRange
|
39
|
-
include Network::NetworkDevice
|
40
|
-
include Network::NetworkACL
|
41
|
-
include Network::Vlan
|
42
|
-
include Network::Nat
|
43
|
-
include Network::VPN
|
44
|
-
include Network::LoadBalancer
|
45
|
-
include Network::VPC
|
31
|
+
include CloudstackRubyClient::Network::NetworkOffering
|
32
|
+
include CloudstackRubyClient::Network::Network
|
33
|
+
include CloudstackRubyClient::Network::PhysicalNetwork
|
34
|
+
include CloudstackRubyClient::Network::NetworkServiceProvider
|
35
|
+
include CloudstackRubyClient::Network::StorageIpRange
|
36
|
+
include CloudstackRubyClient::Network::NetworkDevice
|
37
|
+
include CloudstackRubyClient::Network::NetworkACL
|
38
|
+
include CloudstackRubyClient::Network::Vlan
|
39
|
+
include CloudstackRubyClient::Network::Nat
|
40
|
+
include CloudstackRubyClient::Network::VPN
|
41
|
+
include CloudstackRubyClient::Network::LoadBalancer
|
42
|
+
include CloudstackRubyClient::Network::VPC
|
46
43
|
|
47
44
|
## Volume command injection
|
48
|
-
include Volume::Volume
|
45
|
+
include CloudstackRubyClient::Volume::Volume
|
49
46
|
|
50
47
|
## Templdate command injection
|
51
|
-
include Template::Template
|
52
|
-
include Template::ISO
|
53
|
-
include Template::Registration
|
48
|
+
include CloudstackRubyClient::Template::Template
|
49
|
+
include CloudstackRubyClient::Template::ISO
|
50
|
+
include CloudstackRubyClient::Template::Registration
|
54
51
|
|
55
52
|
## Security group command injection
|
56
|
-
include SecurityGroup::SecurityGroup
|
53
|
+
include CloudstackRubyClient::SecurityGroup::SecurityGroup
|
57
54
|
|
58
55
|
## Project command injection
|
59
|
-
include Project::Project
|
56
|
+
include CloudstackRubyClient::Project::Project
|
60
57
|
|
61
58
|
## Snapshot command injection
|
62
|
-
include Snapshot::Snapshot
|
59
|
+
include CloudstackRubyClient::Snapshot::Snapshot
|
63
60
|
|
64
61
|
## Configuraion command injection
|
65
|
-
include Configuration::Configuration
|
66
|
-
include Configuration::Event
|
62
|
+
include CloudstackRubyClient::Configuration::Configuration
|
63
|
+
include CloudstackRubyClient::Configuration::Event
|
67
64
|
|
68
65
|
## Service offering command injection
|
69
|
-
include ServiceOffering::ServiceOffering
|
70
|
-
include ServiceOffering::DiskOffering
|
66
|
+
include CloudstackRubyClient::ServiceOffering::ServiceOffering
|
67
|
+
include CloudstackRubyClient::ServiceOffering::DiskOffering
|
71
68
|
|
72
69
|
## Auto scale command injection
|
73
|
-
include AutoScale::AutoScale
|
70
|
+
include CloudstackRubyClient::AutoScale::AutoScale
|
71
|
+
|
72
|
+
## Firewall command injection
|
73
|
+
include CloudstackRubyClient::Firewall::Firewall
|
74
74
|
|
75
75
|
end
|