aws 1.11.38 → 2.1.0
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/README.markdown +20 -23
- data/lib/acf/right_acf_interface.rb +17 -17
- data/lib/aws.rb +27 -0
- data/lib/awsbase/right_awsbase.rb +8 -8
- data/lib/ec2/right_ec2.rb +37 -35
- data/lib/ec2/right_mon_interface.rb +25 -15
- data/lib/elb/right_elb_interface.rb +6 -6
- data/lib/right_aws.rb +6 -17
- data/lib/s3/right_s3.rb +58 -58
- data/lib/s3/right_s3_interface.rb +18 -18
- data/lib/sdb/active_sdb.rb +28 -28
- data/lib/sdb/right_sdb_interface.rb +18 -18
- data/lib/sqs/right_sqs.rb +13 -13
- data/lib/sqs/right_sqs_interface.rb +12 -12
- data/test/acf/test_right_acf.rb +10 -8
- data/test/ec2/test_helper.rb +1 -1
- data/test/ec2/test_mon.rb +17 -0
- data/test/ec2/test_right_ec2.rb +9 -7
- data/test/s3/test_helper.rb +2 -1
- data/test/s3/test_right_s3.rb +417 -411
- data/test/s3/test_right_s3_stubbed.rb +11 -9
- data/test/sdb/test_active_sdb.rb +11 -10
- data/test/sdb/test_right_sdb.rb +210 -242
- data/test/sqs/test_right_sqs.rb +190 -269
- data/test/test_credentials.rb +52 -40
- metadata +4 -3
- data/test/sqs/test_right_sqs_gen2.rb +0 -209
@@ -21,13 +21,13 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#
|
23
23
|
|
24
|
-
module
|
24
|
+
module Aws
|
25
25
|
|
26
|
-
class S3Interface <
|
26
|
+
class S3Interface < AwsBase
|
27
27
|
|
28
28
|
USE_100_CONTINUE_PUT_SIZE = 1_000_000
|
29
29
|
|
30
|
-
include
|
30
|
+
include AwsBaseInterface
|
31
31
|
|
32
32
|
DEFAULT_HOST = 's3.amazonaws.com'
|
33
33
|
DEFAULT_PORT = 80
|
@@ -50,7 +50,7 @@ module RightAws
|
|
50
50
|
|
51
51
|
# Creates new RightS3 instance.
|
52
52
|
#
|
53
|
-
# s3 =
|
53
|
+
# s3 = Aws::S3Interface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX', {:multi_thread => true, :logger => Logger.new('/tmp/x.log')}) #=> #<Aws::S3Interface:0xb7b3c27c>
|
54
54
|
#
|
55
55
|
# Params is a hash:
|
56
56
|
#
|
@@ -165,7 +165,7 @@ module RightAws
|
|
165
165
|
# Raises AwsError if any banana happened.
|
166
166
|
def request_info(request, parser, &block) # :nodoc:
|
167
167
|
thread = @params[:multi_thread] ? Thread.current : Thread.main
|
168
|
-
thread[:s3_connection] ||= Rightscale::HttpConnection.new(:exception =>
|
168
|
+
thread[:s3_connection] ||= Rightscale::HttpConnection.new(:exception => Aws::AwsError, :logger => @logger)
|
169
169
|
request_info_impl(thread[:s3_connection], @@bench, request, parser, &block)
|
170
170
|
end
|
171
171
|
|
@@ -201,7 +201,7 @@ module RightAws
|
|
201
201
|
request_info(req_hash, RightHttp2xxParser.new)
|
202
202
|
rescue Exception => e
|
203
203
|
# if the bucket exists AWS returns an error for the location constraint interface. Drop it
|
204
|
-
e.is_a?(
|
204
|
+
e.is_a?(Aws::AwsError) && e.message.include?('BucketAlreadyOwnedByYou') ? true : on_exception
|
205
205
|
end
|
206
206
|
|
207
207
|
# Retrieve bucket location
|
@@ -407,7 +407,7 @@ module RightAws
|
|
407
407
|
|
408
408
|
|
409
409
|
|
410
|
-
# New experimental API for uploading objects, introduced in
|
410
|
+
# New experimental API for uploading objects, introduced in Aws 1.8.1.
|
411
411
|
# store_object is similar in function to the older function put, but returns the full response metadata. It also allows for optional verification
|
412
412
|
# of object md5 checksums on upload. Parameters are passed as hash entries and are checked for completeness as well as for spurious arguments.
|
413
413
|
# The hash of the response headers contains useful information like the Amazon request ID and the object ETag (MD5 checksum).
|
@@ -472,7 +472,7 @@ module RightAws
|
|
472
472
|
# "content-length"=>"0"}
|
473
473
|
#
|
474
474
|
# s3.store_object_and_verify(:bucket => "foobucket", :key => "foo", :md5 => "a507841b1bc8115094b00bbe8c1b2953", :data => "polemonium" )
|
475
|
-
#
|
475
|
+
# Aws::AwsError: Uploaded object failed MD5 checksum verification: {"x-amz-id-2"=>"HTxVtd2bf7UHHDn+WzEH43MkEjFZ26xuYvUzbstkV6nrWvECRWQWFSx91z/bl03n",
|
476
476
|
# "etag"=>"\"a507841b1bc8115094b00bbe8c1b2954\"",
|
477
477
|
# "date"=>"Mon, 29 Sep 2008 18:38:41 GMT",
|
478
478
|
# :verified_md5=>false,
|
@@ -519,7 +519,7 @@ module RightAws
|
|
519
519
|
on_exception
|
520
520
|
end
|
521
521
|
|
522
|
-
# New experimental API for retrieving objects, introduced in
|
522
|
+
# New experimental API for retrieving objects, introduced in Aws 1.8.1.
|
523
523
|
# retrieve_object is similar in function to the older function get. It allows for optional verification
|
524
524
|
# of object md5 checksums on retrieval. Parameters are passed as hash entries and are checked for completeness as well as for spurious arguments.
|
525
525
|
#
|
@@ -724,7 +724,7 @@ module RightAws
|
|
724
724
|
else
|
725
725
|
result[:grantees][key] =
|
726
726
|
{ :display_name => grantee[:display_name] || grantee[:uri].to_s[/[^\/]*$/],
|
727
|
-
:permissions => grantee[:permissions].to_a,
|
727
|
+
:permissions => grantee[:permissions].lines.to_a,
|
728
728
|
:attributes => grantee[:attributes] }
|
729
729
|
end
|
730
730
|
end
|
@@ -968,7 +968,7 @@ module RightAws
|
|
968
968
|
# PARSERS:
|
969
969
|
#-----------------------------------------------------------------
|
970
970
|
|
971
|
-
class S3ListAllMyBucketsParser <
|
971
|
+
class S3ListAllMyBucketsParser < AwsParser # :nodoc:
|
972
972
|
def reset
|
973
973
|
@result = []
|
974
974
|
@owner = {}
|
@@ -987,7 +987,7 @@ module RightAws
|
|
987
987
|
end
|
988
988
|
end
|
989
989
|
|
990
|
-
class S3ListBucketParser <
|
990
|
+
class S3ListBucketParser < AwsParser # :nodoc:
|
991
991
|
def reset
|
992
992
|
@result = []
|
993
993
|
@service = {}
|
@@ -1018,7 +1018,7 @@ module RightAws
|
|
1018
1018
|
end
|
1019
1019
|
end
|
1020
1020
|
|
1021
|
-
class S3ImprovedListBucketParser <
|
1021
|
+
class S3ImprovedListBucketParser < AwsParser # :nodoc:
|
1022
1022
|
def reset
|
1023
1023
|
@result = {}
|
1024
1024
|
@result[:contents] = []
|
@@ -1060,7 +1060,7 @@ module RightAws
|
|
1060
1060
|
end
|
1061
1061
|
end
|
1062
1062
|
|
1063
|
-
class S3BucketLocationParser <
|
1063
|
+
class S3BucketLocationParser < AwsParser # :nodoc:
|
1064
1064
|
def reset
|
1065
1065
|
@result = ''
|
1066
1066
|
end
|
@@ -1069,7 +1069,7 @@ module RightAws
|
|
1069
1069
|
end
|
1070
1070
|
end
|
1071
1071
|
|
1072
|
-
class S3AclParser <
|
1072
|
+
class S3AclParser < AwsParser # :nodoc:
|
1073
1073
|
def reset
|
1074
1074
|
@result = {:grantees=>[], :owner=>{}}
|
1075
1075
|
@current_grantee = {}
|
@@ -1102,7 +1102,7 @@ module RightAws
|
|
1102
1102
|
end
|
1103
1103
|
end
|
1104
1104
|
|
1105
|
-
class S3LoggingParser <
|
1105
|
+
class S3LoggingParser < AwsParser # :nodoc:
|
1106
1106
|
def reset
|
1107
1107
|
@result = {:enabled => false, :targetbucket => '', :targetprefix => ''}
|
1108
1108
|
@current_grantee = {}
|
@@ -1124,7 +1124,7 @@ module RightAws
|
|
1124
1124
|
end
|
1125
1125
|
end
|
1126
1126
|
|
1127
|
-
class S3CopyParser <
|
1127
|
+
class S3CopyParser < AwsParser # :nodoc:
|
1128
1128
|
def reset
|
1129
1129
|
@result = {}
|
1130
1130
|
end
|
@@ -1148,7 +1148,7 @@ module RightAws
|
|
1148
1148
|
def headers_to_string(headers)
|
1149
1149
|
result = {}
|
1150
1150
|
headers.each do |key, value|
|
1151
|
-
value = value
|
1151
|
+
value = value[0] if value.is_a?(Array) && value.size<2
|
1152
1152
|
result[key] = value
|
1153
1153
|
end
|
1154
1154
|
result
|
data/lib/sdb/active_sdb.rb
CHANGED
@@ -28,27 +28,27 @@ rescue LoadError => e
|
|
28
28
|
exit
|
29
29
|
end
|
30
30
|
|
31
|
-
module
|
31
|
+
module Aws
|
32
32
|
|
33
|
-
# =
|
34
|
-
# The
|
33
|
+
# = Aws::ActiveSdb -- RightScale SDB interface (alpha release)
|
34
|
+
# The Aws::ActiveSdb class provides a complete interface to Amazon's Simple
|
35
35
|
# Database Service.
|
36
36
|
#
|
37
|
-
# ActiveSdb is in alpha and does not load by default with the rest of
|
37
|
+
# ActiveSdb is in alpha and does not load by default with the rest of Aws. You must use an additional require statement to load the ActiveSdb class. For example:
|
38
38
|
#
|
39
39
|
# require 'right_aws'
|
40
40
|
# require 'sdb/active_sdb'
|
41
41
|
#
|
42
|
-
# Additionally, the ActiveSdb class requires the 'uuidtools' gem; this gem is not normally required by
|
43
|
-
# dependency of
|
42
|
+
# Additionally, the ActiveSdb class requires the 'uuidtools' gem; this gem is not normally required by Aws and is not installed as a
|
43
|
+
# dependency of Aws.
|
44
44
|
#
|
45
45
|
# Simple ActiveSdb usage example:
|
46
46
|
#
|
47
|
-
# class Client <
|
47
|
+
# class Client < Aws::ActiveSdb::Base
|
48
48
|
# end
|
49
49
|
#
|
50
50
|
# # connect to SDB
|
51
|
-
#
|
51
|
+
# Aws::ActiveSdb.establish_connection
|
52
52
|
#
|
53
53
|
# # create domain
|
54
54
|
# Client.create_domain
|
@@ -101,7 +101,7 @@ module RightAws
|
|
101
101
|
|
102
102
|
# Create a new handle to an Sdb account. All handles share the same per process or per thread
|
103
103
|
# HTTP connection to Amazon Sdb. Each handle is for a specific account.
|
104
|
-
# The +params+ are passed through as-is to
|
104
|
+
# The +params+ are passed through as-is to Aws::SdbInterface.new
|
105
105
|
# Params:
|
106
106
|
# { :server => 'sdb.amazonaws.com' # Amazon service host: 'sdb.amazonaws.com'(default)
|
107
107
|
# :port => 443 # Amazon service port: 80 or 443(default)
|
@@ -118,7 +118,7 @@ module RightAws
|
|
118
118
|
# :service_endpoint => '/' # Set this to /mdb/request.mgwsi for usage with M/DB
|
119
119
|
|
120
120
|
def establish_connection(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
|
121
|
-
@connection =
|
121
|
+
@connection = Aws::SdbInterface.new(aws_access_key_id, aws_secret_access_key, params)
|
122
122
|
end
|
123
123
|
|
124
124
|
def close_connection
|
@@ -134,7 +134,7 @@ module RightAws
|
|
134
134
|
|
135
135
|
# Retreive a list of domains.
|
136
136
|
#
|
137
|
-
# put
|
137
|
+
# put Aws::ActiveSdb.domains #=> ['co-workers','family','friends','clients']
|
138
138
|
#
|
139
139
|
def domains
|
140
140
|
connection.list_domains[:domains]
|
@@ -143,7 +143,7 @@ module RightAws
|
|
143
143
|
# Create new domain.
|
144
144
|
# Raises no errors if the domain already exists.
|
145
145
|
#
|
146
|
-
#
|
146
|
+
# Aws::ActiveSdb.create_domain('alpha') #=> {:request_id=>"6fc652a0-0000-41d5-91f4-3ed390a3d3b2", :box_usage=>"0.0055590278"}
|
147
147
|
#
|
148
148
|
def create_domain(domain_name)
|
149
149
|
connection.create_domain(domain_name)
|
@@ -152,7 +152,7 @@ module RightAws
|
|
152
152
|
# Remove domain from SDB.
|
153
153
|
# Raises no errors if the domain does not exist.
|
154
154
|
#
|
155
|
-
#
|
155
|
+
# Aws::ActiveSdb.create_domain('alpha') #=> {:request_id=>"6fc652a0-0000-41c6-91f4-3ed390a3d3b2", :box_usage=>"0.0055590001"}
|
156
156
|
#
|
157
157
|
def delete_domain(domain_name)
|
158
158
|
connection.delete_domain(domain_name)
|
@@ -167,25 +167,25 @@ module RightAws
|
|
167
167
|
# next_token value returned by last find: is useful to continue finding
|
168
168
|
attr_accessor :next_token
|
169
169
|
|
170
|
-
# Returns a
|
170
|
+
# Returns a Aws::SdbInterface object
|
171
171
|
#
|
172
|
-
# class A <
|
172
|
+
# class A < Aws::ActiveSdb::Base
|
173
173
|
# end
|
174
174
|
#
|
175
|
-
# class B <
|
175
|
+
# class B < Aws::ActiveSdb::Base
|
176
176
|
# end
|
177
177
|
#
|
178
|
-
# class C <
|
178
|
+
# class C < Aws::ActiveSdb::Base
|
179
179
|
# end
|
180
180
|
#
|
181
|
-
#
|
181
|
+
# Aws::ActiveSdb.establish_connection 'key_id_1', 'secret_key_1'
|
182
182
|
#
|
183
183
|
# C.establish_connection 'key_id_2', 'secret_key_2'
|
184
184
|
#
|
185
185
|
# # A and B uses the default connection, C - uses its own
|
186
|
-
# puts A.connection #=> #<
|
187
|
-
# puts B.connection #=> #<
|
188
|
-
# puts C.connection #=> #<
|
186
|
+
# puts A.connection #=> #<Aws::SdbInterface:0xb76d6d7c>
|
187
|
+
# puts B.connection #=> #<Aws::SdbInterface:0xb76d6d7c>
|
188
|
+
# puts C.connection #=> #<Aws::SdbInterface:0xb76d6ca0>
|
189
189
|
#
|
190
190
|
def connection
|
191
191
|
@connection || ActiveSdb::connection
|
@@ -196,18 +196,18 @@ module RightAws
|
|
196
196
|
# Current domain name.
|
197
197
|
#
|
198
198
|
# # if 'ActiveSupport' is not loaded then class name converted to downcase
|
199
|
-
# class Client <
|
199
|
+
# class Client < Aws::ActiveSdb::Base
|
200
200
|
# end
|
201
201
|
# puts Client.domain #=> 'client'
|
202
202
|
#
|
203
203
|
# # if 'ActiveSupport' is loaded then class name being tableized
|
204
204
|
# require 'activesupport'
|
205
|
-
# class Client <
|
205
|
+
# class Client < Aws::ActiveSdb::Base
|
206
206
|
# end
|
207
207
|
# puts Client.domain #=> 'clients'
|
208
208
|
#
|
209
209
|
# # Explicit domain name definition
|
210
|
-
# class Client <
|
210
|
+
# class Client < Aws::ActiveSdb::Base
|
211
211
|
# set_domain_name :foreign_clients
|
212
212
|
# end
|
213
213
|
# puts Client.domain #=> 'foreign_clients'
|
@@ -225,7 +225,7 @@ module RightAws
|
|
225
225
|
|
226
226
|
# Change the default domain name to user defined.
|
227
227
|
#
|
228
|
-
# class Client <
|
228
|
+
# class Client < Aws::ActiveSdb::Base
|
229
229
|
# set_domain_name :foreign_clients
|
230
230
|
# end
|
231
231
|
#
|
@@ -236,7 +236,7 @@ module RightAws
|
|
236
236
|
# Create domain at SDB.
|
237
237
|
# Raises no errors if the domain already exists.
|
238
238
|
#
|
239
|
-
# class Client <
|
239
|
+
# class Client < Aws::ActiveSdb::Base
|
240
240
|
# end
|
241
241
|
# Client.create_domain #=> {:request_id=>"6fc652a0-0000-41d5-91f4-3ed390a3d3b2", :box_usage=>"0.0055590278"}
|
242
242
|
#
|
@@ -247,7 +247,7 @@ module RightAws
|
|
247
247
|
# Remove domain from SDB.
|
248
248
|
# Raises no errors if the domain does not exist.
|
249
249
|
#
|
250
|
-
# class Client <
|
250
|
+
# class Client < Aws::ActiveSdb::Base
|
251
251
|
# end
|
252
252
|
# Client.delete_domain #=> {:request_id=>"e14d90d3-0000-4898-9995-0de28cdda270", :box_usage=>"0.0055590278"}
|
253
253
|
#
|
@@ -297,7 +297,7 @@ module RightAws
|
|
297
297
|
# Client.select('1234987b4583475347523948')
|
298
298
|
# Client.select('1','2','3','4', :conditions=> ["toys=?", "beer"])
|
299
299
|
#
|
300
|
-
# Find helpers:
|
300
|
+
# Find helpers: Aws::ActiveSdb::Base.select_by_... and Aws::ActiveSdb::Base.select_all_by_...
|
301
301
|
#
|
302
302
|
# Client.select_by_name('Matias Rust')
|
303
303
|
# Client.select_by_name_and_city('Putin','Moscow')
|
@@ -21,13 +21,13 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#
|
23
23
|
|
24
|
-
require "
|
24
|
+
require "aws"
|
25
25
|
|
26
|
-
module
|
26
|
+
module Aws
|
27
27
|
|
28
|
-
class SdbInterface <
|
28
|
+
class SdbInterface < AwsBase
|
29
29
|
|
30
|
-
include
|
30
|
+
include AwsBaseInterface
|
31
31
|
|
32
32
|
DEFAULT_HOST = 'sdb.amazonaws.com'
|
33
33
|
DEFAULT_PORT = 443
|
@@ -61,7 +61,7 @@ module RightAws
|
|
61
61
|
#
|
62
62
|
# Example:
|
63
63
|
#
|
64
|
-
# sdb =
|
64
|
+
# sdb = Aws::SdbInterface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX', {:connection_mode => :per_request, :logger => Logger.new('/tmp/x.log')}) #=> #<RightSdb:0xa6b8c27c>
|
65
65
|
#
|
66
66
|
# see: http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/
|
67
67
|
#
|
@@ -243,7 +243,7 @@ module RightAws
|
|
243
243
|
#
|
244
244
|
# Example:
|
245
245
|
#
|
246
|
-
# sdb =
|
246
|
+
# sdb = Aws::SdbInterface.new
|
247
247
|
# sdb.list_domains #=> { :box_usage => "0.0000071759",
|
248
248
|
# :request_id => "976709f9-0111-2345-92cb-9ce90acd0982",
|
249
249
|
# :domains => ["toys", "dolls"]}
|
@@ -288,7 +288,7 @@ module RightAws
|
|
288
288
|
#
|
289
289
|
# Example:
|
290
290
|
#
|
291
|
-
# sdb =
|
291
|
+
# sdb = Aws::SdbInterface.new
|
292
292
|
# sdb.list_domains #=> { :box_usage => "0.0000071759",
|
293
293
|
# :request_id => "976709f9-0111-2345-92cb-9ce90acd0982",
|
294
294
|
# :domains => ["toys", "dolls"]}
|
@@ -320,7 +320,7 @@ module RightAws
|
|
320
320
|
#
|
321
321
|
# Example:
|
322
322
|
#
|
323
|
-
# sdb =
|
323
|
+
# sdb = Aws::SdbInterface.new
|
324
324
|
# sdb.create_domain('toys') # => { :box_usage => "0.0000071759",
|
325
325
|
# :request_id => "976709f9-0111-2345-92cb-9ce90acd0982" }
|
326
326
|
#
|
@@ -340,7 +340,7 @@ module RightAws
|
|
340
340
|
#
|
341
341
|
# Example:
|
342
342
|
#
|
343
|
-
# sdb =
|
343
|
+
# sdb = Aws::SdbInterface.new
|
344
344
|
# sdb.delete_domain('toys') # => { :box_usage => "0.0000071759",
|
345
345
|
# :request_id => "976709f9-0111-2345-92cb-9ce90acd0982" }
|
346
346
|
#
|
@@ -371,7 +371,7 @@ module RightAws
|
|
371
371
|
#
|
372
372
|
# Example:
|
373
373
|
#
|
374
|
-
# sdb =
|
374
|
+
# sdb = Aws::SdbInterface.new
|
375
375
|
# sdb.create_domain 'family'
|
376
376
|
#
|
377
377
|
# attributes = {}
|
@@ -405,7 +405,7 @@ module RightAws
|
|
405
405
|
end
|
406
406
|
|
407
407
|
#
|
408
|
-
# items is an array of
|
408
|
+
# items is an array of Aws::SdbInterface::Item.new(o.id, o.attributes, true)
|
409
409
|
def batch_put_attributes(domain_name, items)
|
410
410
|
params = { 'DomainName' => domain_name }
|
411
411
|
i = 0
|
@@ -688,7 +688,7 @@ module RightAws
|
|
688
688
|
#-----------------------------------------------------------------
|
689
689
|
# PARSERS:
|
690
690
|
#-----------------------------------------------------------------
|
691
|
-
class QSdbListDomainParser <
|
691
|
+
class QSdbListDomainParser < AwsParser #:nodoc:
|
692
692
|
def reset
|
693
693
|
@result = { :domains => [] }
|
694
694
|
end
|
@@ -702,7 +702,7 @@ module RightAws
|
|
702
702
|
end
|
703
703
|
end
|
704
704
|
|
705
|
-
class QSdbDomainMetadataParser <
|
705
|
+
class QSdbDomainMetadataParser < AwsParser #:nodoc:
|
706
706
|
def reset
|
707
707
|
@result = {}
|
708
708
|
end
|
@@ -721,7 +721,7 @@ module RightAws
|
|
721
721
|
end
|
722
722
|
|
723
723
|
|
724
|
-
class QSdbSimpleParser <
|
724
|
+
class QSdbSimpleParser < AwsParser #:nodoc:
|
725
725
|
def reset
|
726
726
|
@result = {}
|
727
727
|
end
|
@@ -733,7 +733,7 @@ module RightAws
|
|
733
733
|
end
|
734
734
|
end
|
735
735
|
|
736
|
-
class QSdbGetAttributesParser <
|
736
|
+
class QSdbGetAttributesParser < AwsParser #:nodoc:
|
737
737
|
def reset
|
738
738
|
@last_attribute_name = nil
|
739
739
|
@result = { :attributes => {} }
|
@@ -748,7 +748,7 @@ module RightAws
|
|
748
748
|
end
|
749
749
|
end
|
750
750
|
|
751
|
-
class QSdbQueryParser <
|
751
|
+
class QSdbQueryParser < AwsParser #:nodoc:
|
752
752
|
def reset
|
753
753
|
@result = { :items => [] }
|
754
754
|
end
|
@@ -762,7 +762,7 @@ module RightAws
|
|
762
762
|
end
|
763
763
|
end
|
764
764
|
|
765
|
-
class QSdbQueryWithAttributesParser <
|
765
|
+
class QSdbQueryWithAttributesParser < AwsParser #:nodoc:
|
766
766
|
def reset
|
767
767
|
@result = { :items => [] }
|
768
768
|
end
|
@@ -785,7 +785,7 @@ module RightAws
|
|
785
785
|
end
|
786
786
|
end
|
787
787
|
|
788
|
-
class QSdbSelectParser <
|
788
|
+
class QSdbSelectParser < AwsParser #:nodoc:
|
789
789
|
def reset
|
790
790
|
@result = { :items => [] }
|
791
791
|
end
|
data/lib/sqs/right_sqs.rb
CHANGED
@@ -21,28 +21,28 @@
|
|
21
21
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
#
|
23
23
|
|
24
|
-
module
|
24
|
+
module Aws
|
25
25
|
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# Aws::Sqs -- RightScale's Amazon SQS interface, API version
|
28
28
|
# 2008-01-01 and later.
|
29
|
-
# The
|
29
|
+
# The Aws::Sqs class provides a complete interface to the second generation of Amazon's Simple
|
30
30
|
# Queue Service.
|
31
31
|
# For explanations of the semantics
|
32
32
|
# of each call, please refer to Amazon's documentation at
|
33
33
|
# http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=31
|
34
34
|
#
|
35
35
|
#
|
36
|
-
#
|
36
|
+
# Aws::Sqs is built atop Aws::SqsInterface, a lower-level
|
37
37
|
# procedural API that may be appropriate for certain programs.
|
38
38
|
#
|
39
|
-
# Error handling: all operations raise an
|
39
|
+
# Error handling: all operations raise an Aws::AwsError in case
|
40
40
|
# of problems. Note that transient errors are automatically retried.
|
41
41
|
#
|
42
|
-
# sqs =
|
42
|
+
# sqs = Aws::Sqs.new(aws_access_key_id, aws_secret_access_key)
|
43
43
|
# queue1 = sqs.queue('my_awesome_queue')
|
44
44
|
# ...
|
45
|
-
# queue2 =
|
45
|
+
# queue2 = Aws::Sqs::Queue.create(sqs, 'my_cool_queue', true)
|
46
46
|
# puts queue2.size
|
47
47
|
# ...
|
48
48
|
# message1 = queue2.receive
|
@@ -73,7 +73,7 @@ module RightAws
|
|
73
73
|
# Retrieves a list of queues.
|
74
74
|
# Returns an +array+ of +Queue+ instances.
|
75
75
|
#
|
76
|
-
#
|
76
|
+
# Aws::Sqs.queues #=> array of queues
|
77
77
|
#
|
78
78
|
def queues(prefix=nil)
|
79
79
|
@interface.list_queues(prefix).map do |url|
|
@@ -84,7 +84,7 @@ module RightAws
|
|
84
84
|
# Returns Queue instance by queue name.
|
85
85
|
# If the queue does not exist at Amazon SQS and +create+ is true, the method creates it.
|
86
86
|
#
|
87
|
-
#
|
87
|
+
# Aws::Sqs.queue('my_awesome_queue') #=> #<Aws::Sqs::Queue:0xb7b626e4 ... >
|
88
88
|
#
|
89
89
|
def queue(queue_name, create=true, visibility=nil)
|
90
90
|
url = @interface.queue_url_by_name(queue_name)
|
@@ -99,7 +99,7 @@ module RightAws
|
|
99
99
|
# Returns Queue instance by queue name.
|
100
100
|
# If the queue does not exist at Amazon SQS and +create+ is true, the method creates it.
|
101
101
|
#
|
102
|
-
#
|
102
|
+
# Aws::Sqs::Queue.create(sqs, 'my_awesome_queue') #=> #<Aws::Sqs::Queue:0xb7b626e4 ... >
|
103
103
|
#
|
104
104
|
def self.create(sqs, url_or_name, create=true, visibility=nil)
|
105
105
|
sqs.queue(url_or_name, create, visibility)
|
@@ -108,7 +108,7 @@ module RightAws
|
|
108
108
|
# Creates new Queue instance.
|
109
109
|
# Does not create a queue at Amazon.
|
110
110
|
#
|
111
|
-
# queue =
|
111
|
+
# queue = Aws::Sqs::Queue.new(sqs, 'my_awesome_queue')
|
112
112
|
#
|
113
113
|
def initialize(sqs, url_or_name)
|
114
114
|
@sqs = sqs
|
@@ -181,7 +181,7 @@ module RightAws
|
|
181
181
|
# Retrieves first accessible message from queue.
|
182
182
|
# Returns Message instance or +nil+ it the queue is empty.
|
183
183
|
#
|
184
|
-
# queue.receive #=> #<
|
184
|
+
# queue.receive #=> #<Aws::Sqs::Message:0xb7bf0884 ... >
|
185
185
|
#
|
186
186
|
def receive(visibility=nil)
|
187
187
|
list = receive_messages(1, visibility)
|
@@ -191,7 +191,7 @@ module RightAws
|
|
191
191
|
# Pops (and deletes) first accessible message from queue.
|
192
192
|
# Returns Message instance or +nil+ if the queue is empty.
|
193
193
|
#
|
194
|
-
# queue.pop #=> #<
|
194
|
+
# queue.pop #=> #<Aws::Sqs::Message:0xb7bf0884 ... >
|
195
195
|
#
|
196
196
|
def pop
|
197
197
|
list = @sqs.interface.pop_messages(@url, 1)
|