Skip to content

Commit

Permalink
Merge pull request #24 from pdion891/timeout
Browse files Browse the repository at this point in the history
adding missing api calls, and add  timeout option for http call
  • Loading branch information
chipchilders committed Nov 17, 2014
2 parents 5b486c8 + 528a649 commit 6c73935
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
12 changes: 9 additions & 3 deletions lib/cloudstack_ruby_client/api/network_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ module NetworkDevice
end

module NetworkACL
cmd_processor :create_network_acl,
:delete_network_acl,
:list_network_acls,
cmd_processor :create_network_a_c_l,
:update_network_a_c_l_item,
:delete_network_a_c_l,
:list_network_a_c_ls,
:create_network_a_c_l_list,
:delete_network_a_c_l_list,
:replace_network_a_c_l_list,
:list_network_a_c_l_lists,
:update_network_a_c_l_list,
:list_nicira_nvp_device_networks
end

Expand Down
12 changes: 7 additions & 5 deletions lib/cloudstack_ruby_client/base_client.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
class CloudstackRubyClient::BaseClient

def initialize(api_url, api_key, secret_key, use_ssl=nil)
@api_url = api_url
@api_key = api_key
@secret_key = secret_key
@use_ssl = use_ssl
def initialize(api_url, api_key, secret_key, use_ssl=nil, open_timeout=20)
@api_url = api_url
@api_key = api_key
@secret_key = secret_key
@use_ssl = use_ssl
@open_timeout = open_timeout
end

def request(params)
Expand All @@ -21,6 +22,7 @@ def request(params)
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = @use_ssl
http.open_timeout = @open_timeout # fail the connection faster if can't open socket
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)

Expand Down
5 changes: 5 additions & 0 deletions lib/cloudstack_ruby_client/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def self.API_LIST
@@API_LIST
end

## CloudStack management server version
def version
self.list_capabilities["capability"]["cloudstackversion"]
end

## login api command
def login(params = {})
auth_request(params, "login")
Expand Down
2 changes: 1 addition & 1 deletion lib/cloudstack_ruby_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CloudstackRubyClient
VERSION = "1.0.1"
VERSION = "1.0.2"
end

0 comments on commit 6c73935

Please sign in to comment.