redaranj-right_aws 1.10.5 → 1.11
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/History.txt +8 -0
- data/Manifest.txt +10 -0
- data/README.txt +9 -6
- data/Rakefile +7 -0
- data/lib/awsbase/right_awsbase.rb +57 -29
- data/lib/ec2/right_ec2.rb +4 -1224
- data/lib/right_aws.rb +9 -2
- data/lib/s3/right_s3.rb +14 -6
- data/lib/s3/right_s3_interface.rb +49 -39
- data/lib/sdb/active_sdb.rb +2 -2
- data/lib/sqs/right_sqs_gen2_interface.rb +4 -2
- metadata +5 -3
data/lib/right_aws.rb
CHANGED
@@ -39,6 +39,12 @@ 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_ec2_images'
|
43
|
+
require 'ec2/right_ec2_instances'
|
44
|
+
require 'ec2/right_ec2_ebs'
|
45
|
+
require 'ec2/right_ec2_reserved_instances'
|
46
|
+
require 'ec2/right_ec2_vpc'
|
47
|
+
require 'ec2/right_ec2_monitoring'
|
42
48
|
require 'elb/right_elb_interface'
|
43
49
|
require 'acw/right_acw_interface'
|
44
50
|
require 'as/right_as_interface'
|
@@ -50,13 +56,14 @@ require 'sqs/right_sqs_gen2_interface'
|
|
50
56
|
require 'sqs/right_sqs_gen2'
|
51
57
|
require 'sdb/right_sdb_interface'
|
52
58
|
require 'acf/right_acf_interface'
|
59
|
+
require 'rds/right_rds_interface'
|
53
60
|
|
54
61
|
|
55
62
|
module RightAws #:nodoc:
|
56
63
|
module VERSION #:nodoc:
|
57
64
|
MAJOR = 1
|
58
|
-
MINOR =
|
59
|
-
TINY =
|
65
|
+
MINOR = 11
|
66
|
+
TINY = 0
|
60
67
|
|
61
68
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
62
69
|
end
|
data/lib/s3/right_s3.rb
CHANGED
@@ -761,9 +761,9 @@ module RightAws
|
|
761
761
|
@name = name
|
762
762
|
@perms = perms.to_a
|
763
763
|
case action
|
764
|
-
when :apply
|
765
|
-
when :refresh
|
766
|
-
when :apply_and_refresh
|
764
|
+
when :apply then apply
|
765
|
+
when :refresh then refresh
|
766
|
+
when :apply_and_refresh then apply; refresh
|
767
767
|
end
|
768
768
|
end
|
769
769
|
|
@@ -775,9 +775,13 @@ module RightAws
|
|
775
775
|
false
|
776
776
|
end
|
777
777
|
|
778
|
-
# Return Grantee type (+String+): "Group" or "CanonicalUser".
|
778
|
+
# Return Grantee type (+String+): "Group", "AmazonCustomerByEmail" or "CanonicalUser".
|
779
779
|
def type
|
780
|
-
@id
|
780
|
+
case @id
|
781
|
+
when /^http:/ then "Group"
|
782
|
+
when /@/ then "AmazonCustomerByEmail"
|
783
|
+
else "CanonicalUser"
|
784
|
+
end
|
781
785
|
end
|
782
786
|
|
783
787
|
# Return a name or an id.
|
@@ -872,7 +876,11 @@ module RightAws
|
|
872
876
|
end
|
873
877
|
|
874
878
|
def to_xml # :nodoc:
|
875
|
-
id_str =
|
879
|
+
id_str = case @id
|
880
|
+
when /^http/ then "<URI>#{@id}</URI>"
|
881
|
+
when /@/ then "<EmailAddress>#{@id}</EmailAddress>"
|
882
|
+
else "<ID>#{@id}</ID>"
|
883
|
+
end
|
876
884
|
grants = ''
|
877
885
|
@perms.each do |perm|
|
878
886
|
grants << "<Grant>" +
|
@@ -204,8 +204,14 @@ module RightAws
|
|
204
204
|
#
|
205
205
|
def create_bucket(bucket, headers={})
|
206
206
|
data = nil
|
207
|
-
|
208
|
-
|
207
|
+
location = case headers[:location].to_s
|
208
|
+
when 'us','US' then ''
|
209
|
+
when 'eu' then 'EU'
|
210
|
+
else headers[:location].to_s
|
211
|
+
end
|
212
|
+
|
213
|
+
unless location.blank?
|
214
|
+
data = "<CreateBucketConfiguration><LocationConstraint>#{location}</LocationConstraint></CreateBucketConfiguration>"
|
209
215
|
end
|
210
216
|
req_hash = generate_rest_request('PUT', headers.merge(:url=>bucket, :data => data))
|
211
217
|
request_info(req_hash, RightHttp2xxParser.new)
|
@@ -988,11 +994,11 @@ module RightAws
|
|
988
994
|
end
|
989
995
|
def tagend(name)
|
990
996
|
case name
|
991
|
-
when 'ID'
|
992
|
-
when 'DisplayName'
|
993
|
-
when 'Name'
|
994
|
-
when 'CreationDate'
|
995
|
-
when 'Bucket'
|
997
|
+
when 'ID' then @owner[:owner_id] = @text
|
998
|
+
when 'DisplayName' then @owner[:owner_display_name] = @text
|
999
|
+
when 'Name' then @current_bucket[:name] = @text
|
1000
|
+
when 'CreationDate'then @current_bucket[:creation_date] = @text
|
1001
|
+
when 'Bucket' then @result << @current_bucket.merge(@owner)
|
996
1002
|
end
|
997
1003
|
end
|
998
1004
|
end
|
@@ -1009,21 +1015,23 @@ module RightAws
|
|
1009
1015
|
def tagend(name)
|
1010
1016
|
case name
|
1011
1017
|
# service info
|
1012
|
-
when 'Name'
|
1013
|
-
when 'Prefix'
|
1014
|
-
when 'Marker'
|
1015
|
-
when 'MaxKeys'
|
1016
|
-
when 'Delimiter'
|
1017
|
-
when 'IsTruncated'
|
1018
|
+
when 'Name' then @service['name'] = @text
|
1019
|
+
when 'Prefix' then @service['prefix'] = @text
|
1020
|
+
when 'Marker' then @service['marker'] = @text
|
1021
|
+
when 'MaxKeys' then @service['max-keys'] = @text
|
1022
|
+
when 'Delimiter' then @service['delimiter'] = @text
|
1023
|
+
when 'IsTruncated' then @service['is_truncated'] = (@text =~ /false/ ? false : true)
|
1018
1024
|
# key data
|
1019
|
-
when 'Key'
|
1020
|
-
when 'LastModified'
|
1021
|
-
when 'ETag'
|
1022
|
-
when 'Size'
|
1023
|
-
when 'StorageClass'
|
1024
|
-
when 'ID'
|
1025
|
-
when 'DisplayName'
|
1026
|
-
when 'Contents'
|
1025
|
+
when 'Key' then @current_key[:key] = @text
|
1026
|
+
when 'LastModified'then @current_key[:last_modified] = @text
|
1027
|
+
when 'ETag' then @current_key[:e_tag] = @text
|
1028
|
+
when 'Size' then @current_key[:size] = @text.to_i
|
1029
|
+
when 'StorageClass'then @current_key[:storage_class] = @text
|
1030
|
+
when 'ID' then @current_key[:owner_id] = @text
|
1031
|
+
when 'DisplayName' then @current_key[:owner_display_name] = @text
|
1032
|
+
when 'Contents'
|
1033
|
+
@current_key[:service] = @service
|
1034
|
+
@result << @current_key
|
1027
1035
|
end
|
1028
1036
|
end
|
1029
1037
|
end
|
@@ -1045,27 +1053,29 @@ module RightAws
|
|
1045
1053
|
def tagend(name)
|
1046
1054
|
case name
|
1047
1055
|
# service info
|
1048
|
-
when 'Name'
|
1056
|
+
when 'Name' then @result[:name] = @text
|
1049
1057
|
# Amazon uses the same tag for the search prefix and for the entries
|
1050
1058
|
# in common prefix...so use our simple flag to see which element
|
1051
1059
|
# we are parsing
|
1052
|
-
when 'Prefix'
|
1053
|
-
when 'Marker'
|
1054
|
-
when 'MaxKeys'
|
1055
|
-
when 'Delimiter'
|
1056
|
-
when 'IsTruncated'
|
1057
|
-
when 'NextMarker'
|
1060
|
+
when 'Prefix' then @in_common_prefixes ? @common_prefixes << @text : @result[:prefix] = @text
|
1061
|
+
when 'Marker' then @result[:marker] = @text
|
1062
|
+
when 'MaxKeys' then @result[:max_keys] = @text
|
1063
|
+
when 'Delimiter' then @result[:delimiter] = @text
|
1064
|
+
when 'IsTruncated' then @result[:is_truncated] = (@text =~ /false/ ? false : true)
|
1065
|
+
when 'NextMarker' then @result[:next_marker] = @text
|
1058
1066
|
# key data
|
1059
|
-
when 'Key'
|
1060
|
-
when 'LastModified'
|
1061
|
-
when 'ETag'
|
1062
|
-
when 'Size'
|
1063
|
-
when 'StorageClass'
|
1064
|
-
when 'ID'
|
1065
|
-
when 'DisplayName'
|
1066
|
-
when 'Contents'
|
1067
|
+
when 'Key' then @current_key[:key] = @text
|
1068
|
+
when 'LastModified'then @current_key[:last_modified] = @text
|
1069
|
+
when 'ETag' then @current_key[:e_tag] = @text
|
1070
|
+
when 'Size' then @current_key[:size] = @text.to_i
|
1071
|
+
when 'StorageClass'then @current_key[:storage_class] = @text
|
1072
|
+
when 'ID' then @current_key[:owner_id] = @text
|
1073
|
+
when 'DisplayName' then @current_key[:owner_display_name] = @text
|
1074
|
+
when 'Contents' then @result[:contents] << @current_key
|
1067
1075
|
# Common Prefix stuff
|
1068
|
-
when 'CommonPrefixes'
|
1076
|
+
when 'CommonPrefixes'
|
1077
|
+
@result[:common_prefixes] = @common_prefixes
|
1078
|
+
@in_common_prefixes = false
|
1069
1079
|
end
|
1070
1080
|
end
|
1071
1081
|
end
|
@@ -1140,8 +1150,8 @@ module RightAws
|
|
1140
1150
|
end
|
1141
1151
|
def tagend(name)
|
1142
1152
|
case name
|
1143
|
-
when 'LastModified'
|
1144
|
-
when 'ETag'
|
1153
|
+
when 'LastModified' then @result[:last_modified] = @text
|
1154
|
+
when 'ETag' then @result[:e_tag] = @text
|
1145
1155
|
end
|
1146
1156
|
end
|
1147
1157
|
end
|
data/lib/sdb/active_sdb.rb
CHANGED
@@ -364,7 +364,7 @@ module RightAws
|
|
364
364
|
end
|
365
365
|
|
366
366
|
def generate_id # :nodoc:
|
367
|
-
UUID.timestamp_create().to_s
|
367
|
+
UUIDTools::UUID.timestamp_create().to_s
|
368
368
|
end
|
369
369
|
|
370
370
|
protected
|
@@ -927,4 +927,4 @@ module RightAws
|
|
927
927
|
end
|
928
928
|
end
|
929
929
|
end
|
930
|
-
end
|
930
|
+
end
|
@@ -127,7 +127,7 @@ module RightAws
|
|
127
127
|
#
|
128
128
|
service_params = signed_service_params(@aws_secret_access_key, service_hash, :post, @params[:server], service)
|
129
129
|
request = Net::HTTP::Post.new(AwsUtils::URLencode(service))
|
130
|
-
request['Content-Type'] = 'application/x-www-form-urlencoded'
|
130
|
+
request['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'
|
131
131
|
request.body = service_params
|
132
132
|
# prepare output hash
|
133
133
|
{ :request => request,
|
@@ -387,7 +387,9 @@ module RightAws
|
|
387
387
|
# sqs.get_queue_length('https://queue.amazonaws.com/ZZ7XXXYYYBINS/my_awesome_queue') #=> 3
|
388
388
|
#
|
389
389
|
def get_queue_length(queue_url)
|
390
|
-
get_queue_attributes(queue_url)
|
390
|
+
attrs = get_queue_attributes(queue_url)
|
391
|
+
attrs['ApproximateNumberOfMessages'].to_i +
|
392
|
+
attrs['ApproximateNumberOfMessagesNotVisible'].to_i
|
391
393
|
rescue
|
392
394
|
on_exception
|
393
395
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redaranj-right_aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: "1.11"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RightScale, Inc.
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-04-06 00:00:00 -
|
13
|
+
date: 2009-04-06 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -73,6 +73,8 @@ files:
|
|
73
73
|
- test/acf/test_right_acf.rb
|
74
74
|
has_rdoc: true
|
75
75
|
homepage:
|
76
|
+
licenses: []
|
77
|
+
|
76
78
|
post_install_message:
|
77
79
|
rdoc_options:
|
78
80
|
- --main
|
@@ -94,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
96
|
requirements: []
|
95
97
|
|
96
98
|
rubyforge_project: rightscale
|
97
|
-
rubygems_version: 1.
|
99
|
+
rubygems_version: 1.3.5
|
98
100
|
signing_key:
|
99
101
|
specification_version: 2
|
100
102
|
summary: Interface classes for the Amazon EC2/EBS, SQS, S3, SDB, and ACF Web Services
|