cloudlb 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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f6b120dd0d87b50924d7975ea15974d621ddf02c
4
+ data.tar.gz: fded12db2cf676f45f3767d3ecd7521dac3b3a6c
5
+ SHA512:
6
+ metadata.gz: fd9a38a2354677f7f40ce5434c083823d260195ea005d992f2b8fc279c8b7217a2fd5f4d6997a056c512a42521481f32c37bc319c289591e29106a9ffab72e39
7
+ data.tar.gz: 988213b506b87ca22b3f9f97b7886333cb98d1273e237e7860382ee87c8ee0cd3a98113c1068c18711f82e67ace058dc6192fac9c0c5a8b3caa9446a38bdb50e
@@ -1,5 +1,9 @@
1
1
  = Rackspace Cloud Load Balancers
2
2
 
3
+ == Deprecation Notice
4
+
5
+ This project is deprecated. New projects should use fog[https://github.com/fog/fog] instead.
6
+
3
7
  == Description
4
8
 
5
9
  This is a Ruby interface into the Rackspace[http://rackspace.com/] {Cloud Load Balancers}[http://www.rackspace.com/cloud/blog/2011/02/24/rackspace-cloud-load-balancers-beta-now-available-for-all-cloud-customers/] service. Mission-critical web-based applications and workloads require high availability. Load balancing
@@ -62,5 +66,3 @@ See the class definitions for documentation on specific methods and operations.
62
66
 
63
67
  See COPYING for license information.
64
68
  Copyright (c) 2011, Rackspace US, Inc.
65
-
66
-
@@ -13,6 +13,13 @@ Gem::Specification.new do |s|
13
13
  s.homepage = "http://github.com/rackspace/ruby-cloudlb"
14
14
  s.summary = "Ruby API into the Rackspace Cloud Load Balancers product"
15
15
  s.description = "A Ruby API to manage the Rackspace Cloud Load Balancers product"
16
+ s.post_install_message = %Q{
17
+ **** PLEASE NOTE **********************************************************************************************
18
+
19
+ #{s.name} has been deprecated. Please consider using fog (http://github.com/fog/fog) for all new projects.
20
+
21
+ ***************************************************************************************************************
22
+ } if s.respond_to? :post_install_message
16
23
 
17
24
  s.required_rubygems_version = ">= 1.3.6"
18
25
 
@@ -10,8 +10,7 @@ module CloudLB
10
10
  def initialize(connection)
11
11
  request = Typhoeus::Request.new(connection.auth_url,
12
12
  :method => :get,
13
- :headers => { "X-Auth-User" => connection.authuser, "X-Auth-Key" => connection.authkey },
14
- :user_agent => "Cloud Load Balancers Ruby API #{VERSION}",
13
+ :headers => { "X-Auth-User" => connection.authuser, "X-Auth-Key" => connection.authkey, "User-Agent" => "Cloud Load Balancers Ruby API #{VERSION}" },
15
14
  :verbose => ENV['LOADBALANCERS_VERBOSE'] ? true : false)
16
15
  CloudLB.hydra.queue(request)
17
16
  CloudLB.hydra.run
@@ -83,7 +83,45 @@ module CloudLB
83
83
  body = JSON.parse(response.body)['nodes'][0]
84
84
  return get_node(body["id"])
85
85
  end
86
-
86
+
87
+ # Add multiple nodes to a load balancer. Returns the new Node objects.
88
+ #
89
+ # Use this if you're adding multiple nodes to a load balancer, as adding
90
+ # subsequent nodes while the first one is queued may fail.
91
+ #
92
+ # +nodes+ is an array of options given to #create_node.
93
+ #
94
+ def create_nodes(nodes)
95
+ nodes.each do |node|
96
+ (raise CloudLB::Exception::MissingArgument, "Must provide :address for all nodes") if node[:address].to_s.empty?
97
+ (raise CloudLB::Exception::MissingArgument, "Must provide :port for all nodes") if node[:port].to_s.empty?
98
+ node[:condition] ||= "ENABLED"
99
+ end
100
+ body = {:nodes => nodes}.to_json
101
+ response = @connection.lbreq("POST", @lbmgmthost, "#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/nodes",@lbmgmtport,@lbmgmtscheme,{},body)
102
+ CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)
103
+ JSON.parse(response.body)['nodes'].map { |node| get_node(node["id"]) }
104
+ end
105
+
106
+ # Remove nodes from a load balancer. Returns true if successful, raises an exception otherwise.
107
+ #
108
+ def destroy_nodes(nodes)
109
+ ids = nodes.map do |node|
110
+ case node
111
+ when Node
112
+ node.id
113
+ when Hash
114
+ node[:id] || node['id']
115
+ else
116
+ node
117
+ end
118
+ end
119
+ ids_query = ids.map { |id| "id=#{id}" }.join('&')
120
+ response = @connection.lbreq("DELETE", @lbmgmthost, "#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/nodes?#{ids_query}",@lbmgmtport,@lbmgmtscheme)
121
+ CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)
122
+ true
123
+ end
124
+
87
125
  # Deletes the current load balancer object. Returns true if successful, raises an exception otherwise.
88
126
  def destroy!
89
127
  response = @connection.lbreq("DELETE", @lbmgmthost, "#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}",@lbmgmtport,@lbmgmtscheme)
@@ -159,7 +159,6 @@ module CloudLB
159
159
  :body => data,
160
160
  :method => method.downcase.to_sym,
161
161
  :headers => hdrhash,
162
- :user_agent => "Cloud Load Balancers Ruby API #{VERSION}",
163
162
  :verbose => ENV['LOADBALANCERS_VERBOSE'] ? true : false)
164
163
  CloudLB.hydra.queue(request)
165
164
  CloudLB.hydra.run
@@ -192,6 +191,7 @@ module CloudLB
192
191
  default_headers["Connection"] = "Keep-Alive"
193
192
  default_headers["Accept"] = "application/json"
194
193
  default_headers["Content-Type"] = "application/json"
194
+ default_headers["User-Agent"] = "Cloud Load Balancers Ruby API #{VERSION}"
195
195
  default_headers.merge(headers)
196
196
  end
197
197
 
@@ -1,3 +1,3 @@
1
1
  module CloudLB
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,109 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cloudlb
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - H. Wade Minter
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-11-05 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: typhoeus
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
27
17
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: json
37
21
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
41
31
  - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
47
34
  type: :runtime
48
- version_requirements: *id002
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
49
41
  description: A Ruby API to manage the Rackspace Cloud Load Balancers product
50
- email:
42
+ email:
51
43
  - minter@lunenburg.org
52
44
  executables: []
53
-
54
45
  extensions: []
55
-
56
46
  extra_rdoc_files: []
57
-
58
- files:
47
+ files:
48
+ - ".gitignore"
59
49
  - COPYING
60
- - .gitignore
61
50
  - README.rdoc
62
51
  - cloudlb.gemspec
63
52
  - lib/cloudlb.rb
64
53
  - lib/cloudlb/authentication.rb
65
54
  - lib/cloudlb/balancer.rb
66
55
  - lib/cloudlb/connection.rb
56
+ - lib/cloudlb/connection_throttle.rb
67
57
  - lib/cloudlb/exception.rb
68
- - lib/cloudlb/node.rb
69
58
  - lib/cloudlb/health_monitor.rb
70
- - lib/cloudlb/connection_throttle.rb
59
+ - lib/cloudlb/node.rb
71
60
  - lib/cloudlb/version.rb
72
- has_rdoc: true
73
61
  homepage: http://github.com/rackspace/ruby-cloudlb
74
62
  licenses: []
63
+ metadata: {}
64
+ post_install_message: |2
75
65
 
76
- post_install_message:
77
- rdoc_options: []
66
+ **** PLEASE NOTE **********************************************************************************************
78
67
 
79
- require_paths:
68
+ cloudlb has been deprecated. Please consider using fog (http://github.com/fog/fog) for all new projects.
69
+
70
+ ***************************************************************************************************************
71
+ rdoc_options: []
72
+ require_paths:
80
73
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
84
76
  - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
90
- required_rubygems_version: !ruby/object:Gem::Requirement
91
- none: false
92
- requirements:
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
93
81
  - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 23
96
- segments:
97
- - 1
98
- - 3
99
- - 6
82
+ - !ruby/object:Gem::Version
100
83
  version: 1.3.6
101
84
  requirements: []
102
-
103
85
  rubyforge_project:
104
- rubygems_version: 1.6.0
86
+ rubygems_version: 2.2.2
105
87
  signing_key:
106
- specification_version: 3
88
+ specification_version: 4
107
89
  summary: Ruby API into the Rackspace Cloud Load Balancers product
108
90
  test_files: []
109
-