aws 1.11.38 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,7 +1,7 @@
|
|
1
|
-
module
|
1
|
+
module Aws
|
2
2
|
|
3
|
-
class Mon <
|
4
|
-
include
|
3
|
+
class Mon < Aws::AwsBase
|
4
|
+
include Aws::AwsBaseInterface
|
5
5
|
|
6
6
|
|
7
7
|
#Amazon EC2 API version being used
|
@@ -15,7 +15,7 @@ module RightAws
|
|
15
15
|
# NetworkIn NetworkOut DiskReadOps DiskWriteOps DiskReadBytes DiskWriteBytes CPUUtilization
|
16
16
|
measures=%w(NetworkIn NetworkOut DiskReadOps DiskWriteOps DiskReadBytes DiskWriteBytes CPUUtilization)
|
17
17
|
|
18
|
-
@@bench =
|
18
|
+
@@bench = Aws::AwsBenchmarkingBlock.new
|
19
19
|
|
20
20
|
def self.bench_xml
|
21
21
|
@@bench.xml
|
@@ -80,7 +80,7 @@ module RightAws
|
|
80
80
|
# Raises AwsError if any banana happened
|
81
81
|
def request_info(request, parser)
|
82
82
|
thread = @params[:multi_thread] ? Thread.current : Thread.main
|
83
|
-
thread[:elb_connection] ||= Rightscale::HttpConnection.new(:exception =>
|
83
|
+
thread[:elb_connection] ||= Rightscale::HttpConnection.new(:exception => Aws::AwsError, :logger => @logger)
|
84
84
|
request_info_impl(thread[:elb_connection], @@bench, request, parser)
|
85
85
|
end
|
86
86
|
|
@@ -88,9 +88,12 @@ module RightAws
|
|
88
88
|
# REQUESTS
|
89
89
|
#-----------------------------------------------------------------
|
90
90
|
|
91
|
-
def list_metrics
|
91
|
+
def list_metrics(options={})
|
92
|
+
|
93
|
+
next_token = options[:next_token] || nil
|
92
94
|
|
93
95
|
params = { }
|
96
|
+
params['NextToken'] = next_token unless next_token.nil?
|
94
97
|
|
95
98
|
@logger.info("list Metrics ")
|
96
99
|
|
@@ -105,15 +108,22 @@ module RightAws
|
|
105
108
|
# measureName: CPUUtilization (Units: Percent), NetworkIn (Units: Bytes), NetworkOut (Units: Bytes), DiskWriteOps (Units: Count)
|
106
109
|
# DiskReadBytes (Units: Bytes), DiskReadOps (Units: Count), DiskWriteBytes (Units: Bytes)
|
107
110
|
# stats: array containing one or more of Minimum, Maximum, Sum, Average, Samples
|
108
|
-
#
|
109
|
-
#
|
111
|
+
# start_time : Timestamp to start
|
112
|
+
# end_time: Timestamp to end
|
110
113
|
# unit: Either Seconds, Percent, Bytes, Bits, Count, Bytes, Bits/Second, Count/Second, and None
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
114
|
+
#
|
115
|
+
# Optional parameters:
|
116
|
+
# period: Integer 60 or multiple of 60
|
117
|
+
# dimension: Hash containing keys ImageId, AutoScalingGroupName, InstanceId, InstanceType
|
118
|
+
# customUnit: nil. not supported currently.
|
119
|
+
# namespace: AWS/EC2
|
120
|
+
|
121
|
+
def get_metric_statistics ( measure_name, stats, start_time, end_time, unit, options={})
|
115
122
|
|
116
|
-
|
123
|
+
period = options[:period] || 60
|
124
|
+
dimensions = options[:dimensions] || nil
|
125
|
+
custom_unit = options[:custom_unit] || nil
|
126
|
+
namespace = options[:namespace] || "AWS/EC2"
|
117
127
|
|
118
128
|
params = {}
|
119
129
|
params['MeasureName'] = measure_name
|
@@ -152,7 +162,7 @@ module RightAws
|
|
152
162
|
#-----------------------------------------------------------------
|
153
163
|
|
154
164
|
|
155
|
-
class QMonGetMetricStatistics <
|
165
|
+
class QMonGetMetricStatistics < Aws::AwsParser
|
156
166
|
|
157
167
|
def reset
|
158
168
|
@result = []
|
@@ -186,7 +196,7 @@ module RightAws
|
|
186
196
|
end
|
187
197
|
end
|
188
198
|
|
189
|
-
class QMonListMetrics <
|
199
|
+
class QMonListMetrics < Aws::AwsParser
|
190
200
|
|
191
201
|
def reset
|
192
202
|
@result = []
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module
|
1
|
+
module Aws
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
class Elb <
|
6
|
-
include
|
5
|
+
class Elb < AwsBase
|
6
|
+
include AwsBaseInterface
|
7
7
|
|
8
8
|
|
9
9
|
#Amazon EC2 API version being used
|
@@ -76,7 +76,7 @@ module RightAws
|
|
76
76
|
# Raises AwsError if any banana happened
|
77
77
|
def request_info(request, parser)
|
78
78
|
thread = @params[:multi_thread] ? Thread.current : Thread.main
|
79
|
-
thread[:elb_connection] ||= Rightscale::HttpConnection.new(:exception =>
|
79
|
+
thread[:elb_connection] ||= Rightscale::HttpConnection.new(:exception => Aws::AwsError, :logger => @logger)
|
80
80
|
request_info_impl(thread[:elb_connection], @@bench, request, parser)
|
81
81
|
end
|
82
82
|
|
@@ -126,7 +126,7 @@ module RightAws
|
|
126
126
|
# PARSERS: Instances
|
127
127
|
#-----------------------------------------------------------------
|
128
128
|
|
129
|
-
class QElbDescribeLoadBalancersParser <
|
129
|
+
class QElbDescribeLoadBalancersParser < AwsParser
|
130
130
|
|
131
131
|
def reset
|
132
132
|
@result = []
|
@@ -153,7 +153,7 @@ module RightAws
|
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
class QElbRegisterInstanceParser <
|
156
|
+
class QElbRegisterInstanceParser < AwsParser
|
157
157
|
|
158
158
|
def reset
|
159
159
|
@result = []
|
data/lib/right_aws.rb
CHANGED
@@ -39,6 +39,7 @@ require 'awsbase/benchmark_fix'
|
|
39
39
|
require 'awsbase/support'
|
40
40
|
require 'awsbase/right_awsbase'
|
41
41
|
require 'ec2/right_ec2'
|
42
|
+
require 'ec2/right_mon_interface'
|
42
43
|
require 's3/right_s3_interface'
|
43
44
|
require 's3/right_s3'
|
44
45
|
require 'sqs/right_sqs_interface'
|
@@ -48,21 +49,9 @@ require 'acf/right_acf_interface'
|
|
48
49
|
require 'elb/right_elb_interface'
|
49
50
|
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
STRING = [MAJOR, MINOR, TINY].join('.')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
#-
|
62
|
-
|
63
|
-
# We also want everything available in the Rightscale namespace for backward
|
64
|
-
# compatibility reasons.
|
65
|
-
module Rightscale #:nodoc:
|
66
|
-
include RightAws
|
67
|
-
extend RightAws
|
52
|
+
# backwards compatible.
|
53
|
+
# @deprecated
|
54
|
+
module RightAws
|
55
|
+
include Aws
|
56
|
+
extend Aws
|
68
57
|
end
|
data/lib/s3/right_s3.rb
CHANGED
@@ -21,10 +21,10 @@
|
|
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
|
-
# =
|
27
|
-
# The
|
26
|
+
# = Aws::S3 -- RightScale's Amazon S3 interface
|
27
|
+
# The Aws::S3 class provides a complete interface to Amazon's Simple
|
28
28
|
# Storage Service.
|
29
29
|
# For explanations of the semantics
|
30
30
|
# of each call, please refer to Amazon's documentation at
|
@@ -32,7 +32,7 @@ module RightAws
|
|
32
32
|
#
|
33
33
|
# See examples below for the bucket and buckets methods.
|
34
34
|
#
|
35
|
-
# Error handling: all operations raise an
|
35
|
+
# Error handling: all operations raise an Aws::AwsError in case
|
36
36
|
# of problems. Note that transient errors are automatically retried.
|
37
37
|
#
|
38
38
|
# It is a good way to use domain naming style getting a name for the buckets.
|
@@ -52,7 +52,7 @@ module RightAws
|
|
52
52
|
|
53
53
|
# Create a new handle to an S3 account. All handles share the same per process or per thread
|
54
54
|
# HTTP connection to Amazon S3. Each handle is for a specific account.
|
55
|
-
# The +params+ are passed through as-is to
|
55
|
+
# The +params+ are passed through as-is to Aws::S3Interface.new
|
56
56
|
#
|
57
57
|
# Params is a hash:
|
58
58
|
#
|
@@ -66,9 +66,9 @@ module RightAws
|
|
66
66
|
end
|
67
67
|
|
68
68
|
# Retrieve a list of buckets.
|
69
|
-
# Returns an array of
|
69
|
+
# Returns an array of Aws::S3::Bucket instances.
|
70
70
|
# # Create handle to S3 account
|
71
|
-
# s3 =
|
71
|
+
# s3 = Aws::S3.new(aws_access_key_id, aws_secret_access_key)
|
72
72
|
# my_buckets_names = s3.buckets.map{|b| b.name}
|
73
73
|
# puts "Buckets on S3: #{my_bucket_names.join(', ')}"
|
74
74
|
def buckets
|
@@ -82,10 +82,10 @@ module RightAws
|
|
82
82
|
# If the bucket does not exist and +create+ is set, a new bucket
|
83
83
|
# is created on S3. Launching this method with +create+=+true+ may
|
84
84
|
# affect on the bucket's ACL if the bucket already exists.
|
85
|
-
# Returns a
|
85
|
+
# Returns a Aws::S3::Bucket instance or +nil+ if the bucket does not exist
|
86
86
|
# and +create+ is not set.
|
87
87
|
#
|
88
|
-
# s3 =
|
88
|
+
# s3 = Aws::S3.new(aws_access_key_id, aws_secret_access_key)
|
89
89
|
# bucket1 = s3.bucket('my_awesome_bucket_1')
|
90
90
|
# bucket1.keys #=> exception here if the bucket does not exists
|
91
91
|
# ...
|
@@ -115,15 +115,15 @@ module RightAws
|
|
115
115
|
# Returns Bucket instance or +nil+ if the bucket does not exist
|
116
116
|
# and +create+ is not set.
|
117
117
|
#
|
118
|
-
# s3 =
|
118
|
+
# s3 = Aws::S3.new(aws_access_key_id, aws_secret_access_key)
|
119
119
|
# ...
|
120
|
-
# bucket1 =
|
120
|
+
# bucket1 = Aws::S3::Bucket.create(s3, 'my_awesome_bucket_1')
|
121
121
|
# bucket1.keys #=> exception here if the bucket does not exists
|
122
122
|
# ...
|
123
|
-
# bucket2 =
|
123
|
+
# bucket2 = Aws::S3::Bucket.create(s3, 'my_awesome_bucket_2', true)
|
124
124
|
# bucket2.keys #=> list of keys
|
125
125
|
# # create a bucket at the European location with public read access
|
126
|
-
# bucket3 =
|
126
|
+
# bucket3 = Aws::S3::Bucket.create(s3,'my-awesome-bucket-3', true, 'public-read', :location => :eu)
|
127
127
|
#
|
128
128
|
# see http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html
|
129
129
|
# (section: Canned Access Policies)
|
@@ -135,7 +135,7 @@ module RightAws
|
|
135
135
|
|
136
136
|
# Create a bucket instance. In normal use this method should
|
137
137
|
# not be called directly.
|
138
|
-
# Use
|
138
|
+
# Use Aws::S3::Bucket.create or Aws::S3.bucket instead.
|
139
139
|
def initialize(s3, name, creation_date=nil, owner=nil)
|
140
140
|
@s3 = s3
|
141
141
|
@name = name
|
@@ -148,7 +148,7 @@ module RightAws
|
|
148
148
|
|
149
149
|
# Return bucket name as a String.
|
150
150
|
#
|
151
|
-
# bucket =
|
151
|
+
# bucket = Aws::S3.bucket('my_awesome_bucket')
|
152
152
|
# puts bucket #=> 'my_awesome_bucket'
|
153
153
|
#
|
154
154
|
def to_s
|
@@ -243,9 +243,9 @@ module RightAws
|
|
243
243
|
# Retrieves meta-header information if +head+ is +true+.
|
244
244
|
# Returns new Key instance.
|
245
245
|
#
|
246
|
-
# key = bucket.key('logs/today/1.log', true) #=> #<
|
246
|
+
# key = bucket.key('logs/today/1.log', true) #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
247
247
|
# # is the same as:
|
248
|
-
# key =
|
248
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/1.log')
|
249
249
|
# key.head
|
250
250
|
#
|
251
251
|
def key(key_name, head=false)
|
@@ -288,9 +288,9 @@ module RightAws
|
|
288
288
|
key.get(headers)
|
289
289
|
end
|
290
290
|
|
291
|
-
# Rename object. Returns
|
291
|
+
# Rename object. Returns Aws::S3::Key instance.
|
292
292
|
#
|
293
|
-
# new_key = bucket.rename_key('logs/today/1.log','logs/today/2.log') #=> #<
|
293
|
+
# new_key = bucket.rename_key('logs/today/1.log','logs/today/2.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
294
294
|
# puts key.name #=> 'logs/today/2.log'
|
295
295
|
# key.exists? #=> true
|
296
296
|
#
|
@@ -300,9 +300,9 @@ module RightAws
|
|
300
300
|
old_key_or_name
|
301
301
|
end
|
302
302
|
|
303
|
-
# Create an object copy. Returns a destination
|
303
|
+
# Create an object copy. Returns a destination Aws::S3::Key instance.
|
304
304
|
#
|
305
|
-
# new_key = bucket.copy_key('logs/today/1.log','logs/today/2.log') #=> #<
|
305
|
+
# new_key = bucket.copy_key('logs/today/1.log','logs/today/2.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
306
306
|
# puts key.name #=> 'logs/today/2.log'
|
307
307
|
# key.exists? #=> true
|
308
308
|
#
|
@@ -311,9 +311,9 @@ module RightAws
|
|
311
311
|
old_key_or_name.copy(new_key_or_name)
|
312
312
|
end
|
313
313
|
|
314
|
-
# Move an object to other location. Returns a destination
|
314
|
+
# Move an object to other location. Returns a destination Aws::S3::Key instance.
|
315
315
|
#
|
316
|
-
# new_key = bucket.copy_key('logs/today/1.log','logs/today/2.log') #=> #<
|
316
|
+
# new_key = bucket.copy_key('logs/today/1.log','logs/today/2.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
317
317
|
# puts key.name #=> 'logs/today/2.log'
|
318
318
|
# key.exists? #=> true
|
319
319
|
#
|
@@ -396,7 +396,7 @@ module RightAws
|
|
396
396
|
# The +name+ is a +String+.
|
397
397
|
# Returns a new Key instance.
|
398
398
|
#
|
399
|
-
# key =
|
399
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/1.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
400
400
|
# key.exists? #=> true | false
|
401
401
|
# key.put('Woohoo!') #=> true
|
402
402
|
# key.exists? #=> true
|
@@ -407,7 +407,7 @@ module RightAws
|
|
407
407
|
|
408
408
|
# Create a new Key instance, but do not create the actual key.
|
409
409
|
# In normal use this method should not be called directly.
|
410
|
-
# Use
|
410
|
+
# Use Aws::S3::Key.create or bucket.key() instead.
|
411
411
|
#
|
412
412
|
def initialize(bucket, name, data=nil, headers={}, meta_headers={},
|
413
413
|
last_modified=nil, e_tag=nil, size=nil, storage_class=nil, owner=nil)
|
@@ -429,7 +429,7 @@ module RightAws
|
|
429
429
|
|
430
430
|
# Return key name as a String.
|
431
431
|
#
|
432
|
-
# key =
|
432
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/1.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
433
433
|
# puts key #=> 'logs/today/1.log'
|
434
434
|
#
|
435
435
|
def to_s
|
@@ -476,7 +476,7 @@ module RightAws
|
|
476
476
|
# Parameter +data+ is a +String+ or S3Object instance.
|
477
477
|
# Returns +true+.
|
478
478
|
#
|
479
|
-
# key =
|
479
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/1.log')
|
480
480
|
# key.data = 'Qwerty'
|
481
481
|
# key.put #=> true
|
482
482
|
# ...
|
@@ -491,7 +491,7 @@ module RightAws
|
|
491
491
|
|
492
492
|
# Rename an object. Returns new object name.
|
493
493
|
#
|
494
|
-
# key =
|
494
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/1.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
495
495
|
# key.rename('logs/today/2.log') #=> 'logs/today/2.log'
|
496
496
|
# puts key.name #=> 'logs/today/2.log'
|
497
497
|
# key.exists? #=> true
|
@@ -501,21 +501,21 @@ module RightAws
|
|
501
501
|
@name = new_name
|
502
502
|
end
|
503
503
|
|
504
|
-
# Create an object copy. Returns a destination
|
504
|
+
# Create an object copy. Returns a destination Aws::S3::Key instance.
|
505
505
|
#
|
506
506
|
# # Key instance as destination
|
507
|
-
# key1 =
|
508
|
-
# key2 =
|
507
|
+
# key1 = Aws::S3::Key.create(bucket, 'logs/today/1.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
508
|
+
# key2 = Aws::S3::Key.create(bucket, 'logs/today/2.log') #=> #<Aws::S3::Key:0xb7b5e240 ... >
|
509
509
|
# key1.put('Olala!') #=> true
|
510
|
-
# key1.copy(key2) #=> #<
|
510
|
+
# key1.copy(key2) #=> #<Aws::S3::Key:0xb7b5e240 ... >
|
511
511
|
# key1.exists? #=> true
|
512
512
|
# key2.exists? #=> true
|
513
513
|
# puts key2.data #=> 'Olala!'
|
514
514
|
#
|
515
515
|
# # String as destination
|
516
|
-
# key =
|
516
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/777.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
517
517
|
# key.put('Olala!') #=> true
|
518
|
-
# new_key = key.copy('logs/today/888.log') #=> #<
|
518
|
+
# new_key = key.copy('logs/today/888.log') #=> #<Aws::S3::Key:0xb7b5e240 ... >
|
519
519
|
# key.exists? #=> true
|
520
520
|
# new_key.exists? #=> true
|
521
521
|
#
|
@@ -525,21 +525,21 @@ module RightAws
|
|
525
525
|
new_key_or_name
|
526
526
|
end
|
527
527
|
|
528
|
-
# Move an object to other location. Returns a destination
|
528
|
+
# Move an object to other location. Returns a destination Aws::S3::Key instance.
|
529
529
|
#
|
530
530
|
# # Key instance as destination
|
531
|
-
# key1 =
|
532
|
-
# key2 =
|
531
|
+
# key1 = Aws::S3::Key.create(bucket, 'logs/today/1.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
532
|
+
# key2 = Aws::S3::Key.create(bucket, 'logs/today/2.log') #=> #<Aws::S3::Key:0xb7b5e240 ... >
|
533
533
|
# key1.put('Olala!') #=> true
|
534
|
-
# key1.move(key2) #=> #<
|
534
|
+
# key1.move(key2) #=> #<Aws::S3::Key:0xb7b5e240 ... >
|
535
535
|
# key1.exists? #=> false
|
536
536
|
# key2.exists? #=> true
|
537
537
|
# puts key2.data #=> 'Olala!'
|
538
538
|
#
|
539
539
|
# # String as destination
|
540
|
-
# key =
|
540
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/777.log') #=> #<Aws::S3::Key:0xb7b1e240 ... >
|
541
541
|
# key.put('Olala!') #=> true
|
542
|
-
# new_key = key.move('logs/today/888.log') #=> #<
|
542
|
+
# new_key = key.move('logs/today/888.log') #=> #<Aws::S3::Key:0xb7b5e240 ... >
|
543
543
|
# key.exists? #=> false
|
544
544
|
# new_key.exists? #=> true
|
545
545
|
#
|
@@ -553,7 +553,7 @@ module RightAws
|
|
553
553
|
# Refresh meta-headers (by calling +head+ method) if +head+ is set.
|
554
554
|
# Returns +true+ if the key exists in bucket and +false+ otherwise.
|
555
555
|
#
|
556
|
-
# key =
|
556
|
+
# key = Aws::S3::Key.create(bucket, 'logs/today/1.log')
|
557
557
|
# key.e_tag #=> nil
|
558
558
|
# key.meta_headers #=> {}
|
559
559
|
# key.refresh #=> true
|
@@ -611,7 +611,7 @@ module RightAws
|
|
611
611
|
# Check for existence of the key in the given bucket.
|
612
612
|
# Returns +true+ or +false+.
|
613
613
|
#
|
614
|
-
# key =
|
614
|
+
# key = Aws::S3::Key.create(bucket,'logs/today/1.log')
|
615
615
|
# key.exists? #=> false
|
616
616
|
# key.put('Woohoo!') #=> true
|
617
617
|
# key.exists? #=> true
|
@@ -669,13 +669,13 @@ module RightAws
|
|
669
669
|
# 'READ_ACP', 'WRITE_ACP', 'FULL_CONTROL'):
|
670
670
|
#
|
671
671
|
# bucket = s3.bucket('my_awesome_bucket', true)
|
672
|
-
# grantee1 =
|
673
|
-
# grantee2 =
|
672
|
+
# grantee1 = Aws::S3::Grantee.new(bucket, 'a123b...223c', FULL_CONTROL, :apply)
|
673
|
+
# grantee2 = Aws::S3::Grantee.new(bucket, 'xy3v3...5fhp', [READ, WRITE], :apply)
|
674
674
|
#
|
675
675
|
# There is only one way to get and to remove permission (via Grantee instances):
|
676
676
|
#
|
677
677
|
# grantees = bucket.grantees # a list of Grantees that have any access for this bucket
|
678
|
-
# grantee1 =
|
678
|
+
# grantee1 = Aws::S3::Grantee.new(bucket, 'a123b...223c')
|
679
679
|
# grantee1.perms #=> returns a list of perms for this grantee to that bucket
|
680
680
|
# ...
|
681
681
|
# grantee1.drop # remove all perms for this grantee
|
@@ -696,7 +696,7 @@ module RightAws
|
|
696
696
|
#
|
697
697
|
# bucket = s3.bucket('my_awesome_bucket', true, 'public-read')
|
698
698
|
# ...
|
699
|
-
#
|
699
|
+
# Aws::S3::Grantee.owner_and_grantees(bucket) #=> [owner, grantees]
|
700
700
|
#
|
701
701
|
def self.owner_and_grantees(thing)
|
702
702
|
if thing.is_a?(Bucket)
|
@@ -718,7 +718,7 @@ module RightAws
|
|
718
718
|
#
|
719
719
|
# bucket = s3.bucket('my_awesome_bucket', true, 'public-read')
|
720
720
|
# ...
|
721
|
-
#
|
721
|
+
# Aws::S3::Grantee.grantees(bucket) #=> grantees
|
722
722
|
#
|
723
723
|
def self.grantees(thing)
|
724
724
|
owner_and_grantees(thing)[1]
|
@@ -750,10 +750,10 @@ module RightAws
|
|
750
750
|
# this thing before. The default action is :refresh.
|
751
751
|
#
|
752
752
|
# bucket = s3.bucket('my_awesome_bucket', true, 'public-read')
|
753
|
-
# grantee1 =
|
753
|
+
# grantee1 = Aws::S3::Grantee.new(bucket, 'a123b...223c', FULL_CONTROL)
|
754
754
|
# ...
|
755
|
-
# grantee2 =
|
756
|
-
# grantee3 =
|
755
|
+
# grantee2 = Aws::S3::Grantee.new(bucket, 'abcde...asdf', [FULL_CONTROL, READ], :apply)
|
756
|
+
# grantee3 = Aws::S3::Grantee.new(bucket, 'aaaaa...aaaa', 'READ', :apply_and_refresh)
|
757
757
|
#
|
758
758
|
def initialize(thing, id, perms=[], action=:refresh, name=nil)
|
759
759
|
@thing = thing
|
@@ -888,20 +888,20 @@ module RightAws
|
|
888
888
|
|
889
889
|
end
|
890
890
|
|
891
|
-
#
|
891
|
+
# Aws::S3Generator and Aws::S3Generator::Bucket methods:
|
892
892
|
#
|
893
|
-
# s3g =
|
893
|
+
# s3g = Aws::S3Generator.new('1...2', 'nx...Y6') #=> #<Aws::S3Generator:0xb7b5cc94>
|
894
894
|
#
|
895
895
|
# # List all buckets(method 'GET'):
|
896
896
|
# buckets_list = s3g.buckets #=> 'https://s3.amazonaws.com:443/?Signature=Y...D&Expires=1180941864&AWSAccessKeyId=1...2'
|
897
897
|
# # Create bucket link (method 'PUT'):
|
898
|
-
# bucket = s3g.bucket('my_awesome_bucket') #=> #<
|
898
|
+
# bucket = s3g.bucket('my_awesome_bucket') #=> #<Aws::S3Generator::Bucket:0xb7bcbda8>
|
899
899
|
# link_to_create = bucket.create_link(1.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket?Signature=4...D&Expires=1180942132&AWSAccessKeyId=1...2
|
900
900
|
# # ... or:
|
901
|
-
# bucket =
|
901
|
+
# bucket = Aws::S3Generator::Bucket.create(s3g, 'my_awesome_bucket') #=> #<Aws::S3Generator::Bucket:0xb7bcbda8>
|
902
902
|
# link_to_create = bucket.create_link(1.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket?Signature=4...D&Expires=1180942132&AWSAccessKeyId=1...2
|
903
903
|
# # ... or:
|
904
|
-
# bucket =
|
904
|
+
# bucket = Aws::S3Generator::Bucket.new(s3g, 'my_awesome_bucket') #=> #<Aws::S3Generator::Bucket:0xb7bcbda8>
|
905
905
|
# link_to_create = bucket.create_link(1.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket?Signature=4...D&Expires=1180942132&AWSAccessKeyId=1...2
|
906
906
|
# # List bucket(method 'GET'):
|
907
907
|
# bucket.keys(1.day) #=> https://s3.amazonaws.com:443/my_awesome_bucket?Signature=i...D&Expires=1180942620&AWSAccessKeyId=1...2
|
@@ -912,10 +912,10 @@ module RightAws
|
|
912
912
|
# # Delete bucket (method 'DELETE'):
|
913
913
|
# bucket.delete(2.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket/logs%2Ftoday%2F1.log?Signature=4...D&Expires=1180820032&AWSAccessKeyId=1...2
|
914
914
|
#
|
915
|
-
#
|
915
|
+
# Aws::S3Generator::Key methods:
|
916
916
|
#
|
917
917
|
# # Create Key instance:
|
918
|
-
# key =
|
918
|
+
# key = Aws::S3Generator::Key.new(bicket, 'my_cool_key') #=> #<Aws::S3Generator::Key:0xb7b7394c>
|
919
919
|
# # Put key data (method 'PUT'):
|
920
920
|
# key.put #=> https://s3.amazonaws.com:443/my_awesome_bucket/my_cool_key?Signature=2...D&Expires=1180943302&AWSAccessKeyId=1...2
|
921
921
|
# # Get key data (method 'GET'):
|
@@ -1004,7 +1004,7 @@ module RightAws
|
|
1004
1004
|
# puts bucket.put('logs/today/1.log', 2.hour)
|
1005
1005
|
#
|
1006
1006
|
def put(key, meta_headers={}, expires=nil, headers={})
|
1007
|
-
meta =
|
1007
|
+
meta = Aws::S3::Key.add_meta_prefix(meta_headers)
|
1008
1008
|
@s3.interface.put_link(@name, key.to_s, nil, expires, meta.merge(headers))
|
1009
1009
|
end
|
1010
1010
|
|