aws 2.5.6 → 2.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/awsbase/awsbase.rb +1 -1
- data/lib/awsbase/errors.rb +1 -1
- data/lib/awsbase/parsers.rb +4 -4
- data/lib/awsbase/require_relative.rb +13 -4
- data/lib/ec2/ec2.rb +246 -48
- data/lib/s3/bucket.rb +2 -2
- data/lib/sdb/sdb_interface.rb +6 -1
- metadata +61 -52
data/lib/awsbase/awsbase.rb
CHANGED
@@ -314,12 +314,12 @@ module Aws
|
|
314
314
|
puts 'RETRYING QUERY due to QueryTimeout...' if count > 0
|
315
315
|
begin
|
316
316
|
ret = request_info_impl(http_conn, bench, request, parser, options, &block)
|
317
|
-
break
|
318
317
|
rescue Aws::AwsError => ex
|
319
318
|
if !ex.include?(/QueryTimeout/) || count == retry_count
|
320
319
|
raise ex
|
321
320
|
end
|
322
321
|
end
|
322
|
+
break if ret
|
323
323
|
count += 1
|
324
324
|
end
|
325
325
|
ensure
|
data/lib/awsbase/errors.rb
CHANGED
@@ -214,7 +214,7 @@ module Aws
|
|
214
214
|
last_errors_text = @aws.last_errors.flatten.join("\n")
|
215
215
|
# on redirect :
|
216
216
|
if redirect_detected
|
217
|
-
location = response['location']
|
217
|
+
location = response['location'] || "#{request[:protocol]}://#{error_parser.instance_variable_get(:'@endpoint')}"
|
218
218
|
# ... log information and ...
|
219
219
|
@aws.logger.info("##### #{@aws.class.name} redirect requested: #{response.code} #{response.message} #####")
|
220
220
|
@aws.logger.info("##### New location: #{location} #####")
|
data/lib/awsbase/parsers.rb
CHANGED
@@ -196,9 +196,9 @@ module Aws
|
|
196
196
|
@code = @text
|
197
197
|
when 'Message';
|
198
198
|
@message = @text
|
199
|
-
|
200
|
-
|
201
|
-
|
199
|
+
when 'Endpoint' ; @endpoint = @text
|
200
|
+
when 'HostId' ; @host_id = @text
|
201
|
+
when 'Bucket' ; @bucket = @text
|
202
202
|
when 'Error';
|
203
203
|
@errors << [@code, @message]
|
204
204
|
end
|
@@ -224,4 +224,4 @@ module Aws
|
|
224
224
|
@result = response.is_a?(Net::HTTPSuccess)
|
225
225
|
end
|
226
226
|
end
|
227
|
-
end
|
227
|
+
end
|
@@ -1,11 +1,20 @@
|
|
1
1
|
# require_relative was introduced in 1.9.2. This makes it
|
2
|
-
# available to younger rubies.
|
3
|
-
#
|
2
|
+
# available to younger rubies. It trys hard to not re-require
|
3
|
+
# files.
|
4
|
+
|
4
5
|
unless Kernel.respond_to?(:require_relative)
|
5
6
|
module Kernel
|
6
7
|
def require_relative(path)
|
7
|
-
|
8
|
-
|
8
|
+
desired_path = File.expand_path('../' + path.to_str, caller[0])
|
9
|
+
shortest = desired_path
|
10
|
+
$:.each do |path|
|
11
|
+
path += '/'
|
12
|
+
if desired_path.index(path) == 0
|
13
|
+
candidate = desired_path.sub(path, '')
|
14
|
+
shortest = candidate if candidate.size < shortest.size
|
15
|
+
end
|
16
|
+
end
|
17
|
+
require shortest
|
9
18
|
end
|
10
19
|
end
|
11
20
|
end
|
data/lib/ec2/ec2.rb
CHANGED
@@ -183,6 +183,12 @@ module Aws
|
|
183
183
|
return groups
|
184
184
|
end
|
185
185
|
|
186
|
+
def hash_params_with_suffix(prefix, suffix, list) #:nodoc:
|
187
|
+
groups = {}
|
188
|
+
list.each_index { |i| groups.update("#{prefix}.#{i+1}.suffix"=>list[i]) }
|
189
|
+
return groups
|
190
|
+
end
|
191
|
+
|
186
192
|
#-----------------------------------------------------------------
|
187
193
|
# Images
|
188
194
|
#-----------------------------------------------------------------
|
@@ -321,19 +327,18 @@ module Aws
|
|
321
327
|
# instead of modify_image_attribute because the signature of
|
322
328
|
# modify_image_attribute may change with EC2 service changes.
|
323
329
|
#
|
324
|
-
#
|
325
|
-
# operation_type : currently, only 'add' & 'remove' are supported.
|
330
|
+
# operation_type : currently, only 'Add' & 'Remove' are supported.
|
326
331
|
# vars:
|
327
332
|
# :user_group : currently, only 'all' is supported.
|
328
333
|
# :user_id
|
329
334
|
# :product_code
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
params
|
334
|
-
params.update(
|
335
|
-
params.update(hash_params('UserGroup', vars[:user_group].to_a)) if vars[:user_group]
|
335
|
+
# :description
|
336
|
+
def modify_image_attribute(image_id, operation_type = nil, vars = {})
|
337
|
+
params = {'ImageId' => image_id }
|
338
|
+
params.update(hash_params_with_suffix("LaunchPermission.#{operation_type}", 'UserId', vars[:user_id].to_a)) if vars[:user_id]
|
339
|
+
params.update(hash_params_with_suffix("LaunchPermission.#{operation_type}", 'Group', vars[:user_group].to_a)) if vars[:user_group]
|
336
340
|
params.update(hash_params('ProductCode', vars[:product_code])) if vars[:product_code]
|
341
|
+
params.update('Description.Value' => vars[:description].to_s) if vars[:description]
|
337
342
|
link = generate_request("ModifyImageAttribute", params)
|
338
343
|
request_info(link, RightBoolResponseParser.new(:logger => @logger))
|
339
344
|
rescue Exception
|
@@ -346,7 +351,7 @@ module Aws
|
|
346
351
|
#
|
347
352
|
# ec2.modify_image_launch_perm_add_users('ami-e444444d',['000000000777','000000000778']) #=> true
|
348
353
|
def modify_image_launch_perm_add_users(image_id, user_id=[])
|
349
|
-
modify_image_attribute(image_id, '
|
354
|
+
modify_image_attribute(image_id, 'Add', :user_id => user_id.to_a)
|
350
355
|
end
|
351
356
|
|
352
357
|
# Revokes image launch permissions for users. +userId+ is a list of users AWS accounts ids. Returns +true+ or an exception.
|
@@ -354,7 +359,7 @@ module Aws
|
|
354
359
|
# ec2.modify_image_launch_perm_remove_users('ami-e444444d',['000000000777','000000000778']) #=> true
|
355
360
|
#
|
356
361
|
def modify_image_launch_perm_remove_users(image_id, user_id=[])
|
357
|
-
modify_image_attribute(image_id, '
|
362
|
+
modify_image_attribute(image_id, 'Remove', :user_id => user_id.to_a)
|
358
363
|
end
|
359
364
|
|
360
365
|
# Add image launch permissions for users groups (currently only 'all' is supported, which gives public launch permissions).
|
@@ -363,7 +368,7 @@ module Aws
|
|
363
368
|
# ec2.modify_image_launch_perm_add_groups('ami-e444444d') #=> true
|
364
369
|
#
|
365
370
|
def modify_image_launch_perm_add_groups(image_id, user_group=['all'])
|
366
|
-
modify_image_attribute(image_id, '
|
371
|
+
modify_image_attribute(image_id, 'Add', :user_group => user_group.to_a)
|
367
372
|
end
|
368
373
|
|
369
374
|
# Remove image launch permissions for users groups (currently only 'all' is supported, which gives public launch permissions).
|
@@ -371,7 +376,7 @@ module Aws
|
|
371
376
|
# ec2.modify_image_launch_perm_remove_groups('ami-e444444d') #=> true
|
372
377
|
#
|
373
378
|
def modify_image_launch_perm_remove_groups(image_id, user_group=['all'])
|
374
|
-
modify_image_attribute(image_id, '
|
379
|
+
modify_image_attribute(image_id, 'Remove', :user_group => user_group.to_a)
|
375
380
|
end
|
376
381
|
|
377
382
|
# Add product code to image
|
@@ -379,7 +384,15 @@ module Aws
|
|
379
384
|
# ec2.modify_image_product_code('ami-e444444d','0ABCDEF') #=> true
|
380
385
|
#
|
381
386
|
def modify_image_product_code(image_id, product_code=[])
|
382
|
-
modify_image_attribute(image_id,
|
387
|
+
modify_image_attribute(image_id, nil, :product_code => product_code.to_a)
|
388
|
+
end
|
389
|
+
|
390
|
+
# Change image description
|
391
|
+
#
|
392
|
+
# ec2.modify_image_description('ami-e444444d','My new AMI') #=> true
|
393
|
+
#
|
394
|
+
def modify_image_description(image_id, description='')
|
395
|
+
modify_image_attribute(image_id, nil, :description => description)
|
383
396
|
end
|
384
397
|
|
385
398
|
#-----------------------------------------------------------------
|
@@ -562,13 +575,13 @@ module Aws
|
|
562
575
|
unless Aws::Utils.blank?(options[:block_device_mappings])
|
563
576
|
options[:block_device_mappings].size.times do |n|
|
564
577
|
if options[:block_device_mappings][n][:virtual_name]
|
565
|
-
params["BlockDeviceMapping.#{n+1}.VirtualName"] = options[:block_device_mappings][n][:virtual_name]
|
578
|
+
params["BlockDeviceMapping.#{n+1}.VirtualName"] = options[:block_device_mappings][n][:virtual_name]
|
566
579
|
end
|
567
580
|
if options[:block_device_mappings][n][:device_name]
|
568
|
-
params["BlockDeviceMapping.#{n+1}.DeviceName"] = options[:block_device_mappings][n][:device_name]
|
581
|
+
params["BlockDeviceMapping.#{n+1}.DeviceName"] = options[:block_device_mappings][n][:device_name]
|
569
582
|
end
|
570
583
|
if options[:block_device_mappings][n][:ebs_snapshot_id]
|
571
|
-
params["BlockDeviceMapping.#{n+1}.Ebs.SnapshotId"] = options[:block_device_mappings][n][:ebs_snapshot_id]
|
584
|
+
params["BlockDeviceMapping.#{n+1}.Ebs.SnapshotId"] = options[:block_device_mappings][n][:ebs_snapshot_id]
|
572
585
|
end
|
573
586
|
end
|
574
587
|
end
|
@@ -607,7 +620,7 @@ module Aws
|
|
607
620
|
rescue Exception
|
608
621
|
on_exception
|
609
622
|
end
|
610
|
-
|
623
|
+
|
611
624
|
# Stop EBS-backed EC2 instances. Returns a list of instance state changes or an exception.
|
612
625
|
#
|
613
626
|
# ec2.stop_instances(['i-f222222d', 'i-f222222e']) #=>
|
@@ -628,7 +641,7 @@ module Aws
|
|
628
641
|
rescue Exception
|
629
642
|
on_exception
|
630
643
|
end
|
631
|
-
|
644
|
+
|
632
645
|
# Start EBS-backed EC2 instances. Returns a list of instance state changes or an exception.
|
633
646
|
#
|
634
647
|
# ec2.start_instances(['i-f222222d', 'i-f222222e']) #=>
|
@@ -649,7 +662,7 @@ module Aws
|
|
649
662
|
rescue Exception
|
650
663
|
on_exception
|
651
664
|
end
|
652
|
-
|
665
|
+
|
653
666
|
# Retreive EC2 instance OS logs. Returns a hash of data or an exception.
|
654
667
|
#
|
655
668
|
# ec2.get_console_output('i-f222222d') =>
|
@@ -806,23 +819,23 @@ module Aws
|
|
806
819
|
# :aws_owner => "000000000888",
|
807
820
|
# :aws_description => "a default security group",
|
808
821
|
# :aws_perms =>
|
809
|
-
# [ {:protocol => "tcp", :from_port=>"1000", :to_port=>"2000",
|
822
|
+
# [ {:protocol => "tcp", :from_port=>"1000", :to_port=>"2000",
|
810
823
|
# :ip_ranges=>[{cidr_ip=>"10.1.2.3/32"}, {cidr_ip=>"192.168.1.10/24"}],
|
811
824
|
# :groups => [{:owner=>"123456789012", :group_name="default"}] },
|
812
|
-
#
|
825
|
+
#
|
813
826
|
# {:protocol ="icmp", :from_port="-1", :to_port=>"-1",
|
814
|
-
# :ip_ranges=>[{:cidr_ip=>"0.0.0.0/0"}],
|
827
|
+
# :ip_ranges=>[{:cidr_ip=>"0.0.0.0/0"}],
|
815
828
|
# :groups=>[] },
|
816
|
-
#
|
817
|
-
# {:protocol=>"udp", :from_port=>"0", :to_port=>"65535",
|
818
|
-
# :ip_ranges=>[],
|
819
|
-
# :groups=>[{:owner=>"123456789012", :group_name=>"newgroup"}, {:owner=>"123456789012", :group_name=>"default"}],
|
820
|
-
#
|
829
|
+
#
|
830
|
+
# {:protocol=>"udp", :from_port=>"0", :to_port=>"65535",
|
831
|
+
# :ip_ranges=>[],
|
832
|
+
# :groups=>[{:owner=>"123456789012", :group_name=>"newgroup"}, {:owner=>"123456789012", :group_name=>"default"}],
|
833
|
+
#
|
821
834
|
# {:protocol=>"tcp", :from_port="22", :to_port=>"22",
|
822
835
|
# :ip_ranges=>[{:cidr_ip=>"0.0.0.0/0"}],
|
823
836
|
# :groups=>[{:owner=>"", :group_name=>"default"}] },
|
824
|
-
#
|
825
|
-
# ..., {...}
|
837
|
+
#
|
838
|
+
# ..., {...}
|
826
839
|
# ]
|
827
840
|
#
|
828
841
|
def describe_security_groups(list=[])
|
@@ -883,19 +896,19 @@ module Aws
|
|
883
896
|
end
|
884
897
|
|
885
898
|
# Authorize OR Revoke ingress for security group, depending on the value of the 'action' parameter.
|
886
|
-
# If you 'authorize' then you allow instances that are member of some other
|
887
|
-
# security groups, or some range of ip addresses to open connections to instances in
|
899
|
+
# If you 'authorize' then you allow instances that are member of some other
|
900
|
+
# security groups, or some range of ip addresses to open connections to instances in
|
888
901
|
# my group. Can specify an array of ip addresses, source groups or mix of both in a single rule:
|
889
902
|
#
|
890
903
|
# ec2.manage_security_group_ingress('authorize', 'new_firewall', 80, 80, 'tcp', ['192.168.0.1/32', '10.0.0.1/24'],
|
891
904
|
# [{'group_name'=>'default', 'owner'=>'297467797945'}, {'group_name'=>'test', 'owner'=>'123456789012'}])
|
892
905
|
#
|
893
|
-
# ec2.manage_security_group_ingress('new_firewall', 0, 1000, 'udp', 'revoke', [],
|
906
|
+
# ec2.manage_security_group_ingress('new_firewall', 0, 1000, 'udp', 'revoke', [],
|
894
907
|
# [{'group_name'=>'default', 'owner'=>'123456789012'}])
|
895
908
|
#
|
896
|
-
# ec2.manage_security_group_ingress('new_firewall', 0, 1000, 'udp', 'authorize', ['0.0.0.0/0'])
|
909
|
+
# ec2.manage_security_group_ingress('new_firewall', 0, 1000, 'udp', 'authorize', ['0.0.0.0/0'])
|
897
910
|
#
|
898
|
-
# Similarly, if you specify 'revoke' as the action parameter then you will remove the specified
|
911
|
+
# Similarly, if you specify 'revoke' as the action parameter then you will remove the specified
|
899
912
|
# source ip addresses or source groups from access to instances in the named group:
|
900
913
|
#
|
901
914
|
def manage_security_group_ingress(name, from_port, to_port, protocol, action, source_ip_ranges, source_groups = [])
|
@@ -903,11 +916,11 @@ module Aws
|
|
903
916
|
'IpPermissions.1.IpProtocol' => protocol.to_s,
|
904
917
|
'IpPermissions.1.FromPort' => from_port.to_s,
|
905
918
|
'IpPermissions.1.ToPort' => to_port.to_s }
|
906
|
-
source_ip_ranges.each_index do |i|
|
919
|
+
source_ip_ranges.each_index do |i|
|
907
920
|
call_params.merge!({"IpPermissions.1.IpRanges.#{i+1}.CidrIp" => source_ip_ranges[i].to_s})
|
908
921
|
end
|
909
922
|
source_groups.each_index do |i|
|
910
|
-
call_params.merge!({"IpPermissions.1.Groups.#{i+1}.GroupName" => source_groups[i]['group_name'].to_s,
|
923
|
+
call_params.merge!({"IpPermissions.1.Groups.#{i+1}.GroupName" => source_groups[i]['group_name'].to_s,
|
911
924
|
"IpPermissions.1.Groups.#{i+1}.UserId"=> source_groups[i]['owner'].to_s.gsub(/-/,'')})
|
912
925
|
end
|
913
926
|
unless ['Authorize', 'Revoke'].include?(action.capitalize)
|
@@ -916,7 +929,7 @@ module Aws
|
|
916
929
|
link = generate_request("#{action.capitalize}SecurityGroupIngress", call_params)
|
917
930
|
request_info(link, RightBoolResponseParser.new(:logger => @logger))
|
918
931
|
rescue Exception
|
919
|
-
on_exception
|
932
|
+
on_exception
|
920
933
|
end
|
921
934
|
|
922
935
|
# Authorize named ingress for security group. Allows instances that are member of someone
|
@@ -1310,6 +1323,18 @@ module Aws
|
|
1310
1323
|
on_exception
|
1311
1324
|
end
|
1312
1325
|
|
1326
|
+
def describe_owned_snapshots(list=[])
|
1327
|
+
params = {"Owner" => "self"}
|
1328
|
+
snap_ids = hash_params('SnapshotId', list.to_a)
|
1329
|
+
params.update(snap_ids)
|
1330
|
+
link = generate_request("DescribeSnapshots",
|
1331
|
+
params)
|
1332
|
+
request_cache_or_info :describe_owned_snapshots, link, QEc2DescribeSnapshotsParser, @@bench, list.nil? || list.empty?
|
1333
|
+
rescue Exception
|
1334
|
+
on_exception
|
1335
|
+
end
|
1336
|
+
|
1337
|
+
|
1313
1338
|
# Create a snapshot of specified volume.
|
1314
1339
|
#
|
1315
1340
|
# ec2.create_snapshot('vol-898a6fe0') #=>
|
@@ -1430,6 +1455,102 @@ module Aws
|
|
1430
1455
|
on_exception
|
1431
1456
|
end
|
1432
1457
|
|
1458
|
+
#-----------------------------------------------------------------
|
1459
|
+
# VPC related
|
1460
|
+
#-----------------------------------------------------------------
|
1461
|
+
|
1462
|
+
# Create VPC
|
1463
|
+
# http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateVpc.html
|
1464
|
+
#
|
1465
|
+
# ec2.create_vpc("10.0.0.0/16")
|
1466
|
+
# FIXME: EVen though the EC2 docs describe the parameter instanceTenancy,
|
1467
|
+
# I could not get it to recognize that
|
1468
|
+
def create_vpc(cidr_block = "10.0.0.0/16")
|
1469
|
+
params = { "CidrBlock" => cidr_block }
|
1470
|
+
link = generate_request("CreateVpc", params)
|
1471
|
+
request_info(link, QEc2VpcsParser.new("vpc", :logger => @logger))
|
1472
|
+
rescue Exception
|
1473
|
+
on_exception
|
1474
|
+
end
|
1475
|
+
|
1476
|
+
|
1477
|
+
# Describe VPC's
|
1478
|
+
# http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeVpcs.html
|
1479
|
+
#
|
1480
|
+
# ec2.describe_vpcs
|
1481
|
+
# ec2.describe_vpcs(vpcId1, vpcId2, 'Filter.1.Name' => 'state', 'Filter.1.Value' = > 'pending', ...)
|
1482
|
+
def describe_vpcs(*args)
|
1483
|
+
if args.last.is_a?(Hash)
|
1484
|
+
params = args.pop.dup
|
1485
|
+
else
|
1486
|
+
params = {}
|
1487
|
+
end
|
1488
|
+
1.upto(args.size) { |i| params["VpcId.#{i}"] = args[i-1] }
|
1489
|
+
link = generate_request("DescribeVpcs", params)
|
1490
|
+
request_info(link, QEc2VpcsParser.new("item", :logger => @logger))
|
1491
|
+
rescue Exception
|
1492
|
+
on_exception
|
1493
|
+
end
|
1494
|
+
|
1495
|
+
# Delete VPC
|
1496
|
+
# http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteVpc.html
|
1497
|
+
#
|
1498
|
+
# ec2.delete_vpc(vpc_id)
|
1499
|
+
def delete_vpc(vpc_id)
|
1500
|
+
params = { "VpcId" => vpc_id }
|
1501
|
+
link = generate_request("DeleteVpc", params)
|
1502
|
+
request_info(link, RightBoolResponseParser.new(:logger => @logger))
|
1503
|
+
rescue Exception
|
1504
|
+
on_exception
|
1505
|
+
end
|
1506
|
+
|
1507
|
+
# Create subnet in a VPC
|
1508
|
+
# http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-CreateSubnet.html
|
1509
|
+
#
|
1510
|
+
# ec2.create_subnet(vpc_id, cidr_block)
|
1511
|
+
# ec2.create_subnet(vpc_id, cidr_block, availability_zone))
|
1512
|
+
def create_subnet(vpc_id, cidr_block, availability_zone = nil)
|
1513
|
+
params = { "VpcId" => vpc_id, "CidrBlock" => cidr_block }
|
1514
|
+
params["AvailabilityZone"] = availability_zone if availability_zone
|
1515
|
+
link = generate_request("CreateSubnet", params)
|
1516
|
+
request_info(link, QEc2SubnetsParser.new("subnet", :logger => @logger))
|
1517
|
+
rescue Exception
|
1518
|
+
on_exception
|
1519
|
+
end
|
1520
|
+
|
1521
|
+
# Describe subnets
|
1522
|
+
# http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSubnets.html
|
1523
|
+
#
|
1524
|
+
# ec2.describe_subnets
|
1525
|
+
# ecs.describe_subnets(subnetId1, SubnetId2, ...,
|
1526
|
+
# 'Filter.1.Name' => 'state',
|
1527
|
+
# 'Filter.1.Value.1' => 'pending',
|
1528
|
+
# 'Filter.2.Name' => ...)
|
1529
|
+
def describe_subnets(*args)
|
1530
|
+
if args.last.is_a?(Hash)
|
1531
|
+
params = args.pop.dup
|
1532
|
+
else
|
1533
|
+
params = {}
|
1534
|
+
end
|
1535
|
+
1.upto(args.size) { |i| params["SubnetId.#{i}"] = args[i-1] }
|
1536
|
+
link = generate_request("DescribeSubnets", params)
|
1537
|
+
request_info(link, QEc2SubnetsParser.new("item", :logger => @logger))
|
1538
|
+
rescue Exception
|
1539
|
+
on_exception
|
1540
|
+
end
|
1541
|
+
|
1542
|
+
# Delete Subnet
|
1543
|
+
# http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DeleteSubnet.html
|
1544
|
+
#
|
1545
|
+
# ec2.delete_subnet(subnet_id)
|
1546
|
+
def delete_subnet(subnet_id)
|
1547
|
+
params = { "SubnetId" => subnet_id }
|
1548
|
+
link = generate_request("DeleteSubnet", params)
|
1549
|
+
request_info(link, RightBoolResponseParser.new(:logger => @logger))
|
1550
|
+
rescue Exception
|
1551
|
+
on_exception
|
1552
|
+
end
|
1553
|
+
|
1433
1554
|
#-----------------------------------------------------------------
|
1434
1555
|
# PARSERS: Boolean Response Parser
|
1435
1556
|
#-----------------------------------------------------------------
|
@@ -1493,7 +1614,7 @@ module Aws
|
|
1493
1614
|
|
1494
1615
|
class QEc2IpRangeItemType #:nodoc:
|
1495
1616
|
attr_accessor :cidrIp
|
1496
|
-
end
|
1617
|
+
end
|
1497
1618
|
|
1498
1619
|
class QEc2IpPermissionType #:nodoc:
|
1499
1620
|
attr_accessor :ipProtocol
|
@@ -1600,6 +1721,12 @@ module Aws
|
|
1600
1721
|
@image[:aws_kernel_id] = @text
|
1601
1722
|
when 'ramdiskId' then
|
1602
1723
|
@image[:aws_ramdisk_id] = @text
|
1724
|
+
when 'rootDeviceType' then
|
1725
|
+
@image[:aws_root_device_type] = @text
|
1726
|
+
when 'rootDeviceName' then
|
1727
|
+
@image[:aws_root_device_name] = @text
|
1728
|
+
when 'hypervisor' then
|
1729
|
+
@image[:aws_hypervisor] = @text
|
1603
1730
|
when 'item' then
|
1604
1731
|
@result << @image if @xmlpath[%r{.*/imagesSet$}]
|
1605
1732
|
end
|
@@ -1686,6 +1813,8 @@ module Aws
|
|
1686
1813
|
:root_device_type => '',
|
1687
1814
|
:root_device_name => '',
|
1688
1815
|
:architecture => '',
|
1816
|
+
:subnet_id => '',
|
1817
|
+
:vpc_id => '',
|
1689
1818
|
:block_device_mappings => [],
|
1690
1819
|
:aws_product_codes => [],
|
1691
1820
|
:tags => {}}
|
@@ -1742,6 +1871,10 @@ module Aws
|
|
1742
1871
|
@instance[:aws_availability_zone] = @text
|
1743
1872
|
when 'privateIpAddress' then
|
1744
1873
|
@instance[:aws_private_ip_address] = @text
|
1874
|
+
when 'subnetId' then
|
1875
|
+
@instance[:subnet_id] = @text
|
1876
|
+
when 'vpcId' then
|
1877
|
+
@instance[:vpc_id] = @text
|
1745
1878
|
when 'key' then
|
1746
1879
|
@tag_key = @text
|
1747
1880
|
when 'value' then
|
@@ -1840,12 +1973,12 @@ module Aws
|
|
1840
1973
|
@result = []
|
1841
1974
|
end
|
1842
1975
|
end
|
1843
|
-
|
1976
|
+
|
1844
1977
|
class QEc2StopInstancesParser < AwsParser #:nodoc:
|
1845
1978
|
def tagstart(name, attributes)
|
1846
1979
|
@instance = {} if name == 'item'
|
1847
1980
|
end
|
1848
|
-
|
1981
|
+
|
1849
1982
|
def tagend(name)
|
1850
1983
|
case name
|
1851
1984
|
when 'instanceId' then
|
@@ -1866,7 +1999,7 @@ module Aws
|
|
1866
1999
|
@result << @instance
|
1867
2000
|
end
|
1868
2001
|
end
|
1869
|
-
|
2002
|
+
|
1870
2003
|
def reset
|
1871
2004
|
@result = []
|
1872
2005
|
end
|
@@ -1876,7 +2009,7 @@ module Aws
|
|
1876
2009
|
def tagstart(name, attributes)
|
1877
2010
|
@instance = {} if name == 'item'
|
1878
2011
|
end
|
1879
|
-
|
2012
|
+
|
1880
2013
|
def tagend(name)
|
1881
2014
|
case name
|
1882
2015
|
when 'instanceId' then
|
@@ -1897,12 +2030,12 @@ module Aws
|
|
1897
2030
|
@result << @instance
|
1898
2031
|
end
|
1899
2032
|
end
|
1900
|
-
|
2033
|
+
|
1901
2034
|
def reset
|
1902
2035
|
@result = []
|
1903
2036
|
end
|
1904
2037
|
end
|
1905
|
-
|
2038
|
+
|
1906
2039
|
|
1907
2040
|
#-----------------------------------------------------------------
|
1908
2041
|
# PARSERS: Console
|
@@ -2176,12 +2309,12 @@ module Aws
|
|
2176
2309
|
#-----------------------------------------------------------------
|
2177
2310
|
|
2178
2311
|
class QEc2DescribeSnapshotsParser < AwsParser #:nodoc:
|
2179
|
-
|
2312
|
+
|
2180
2313
|
def initialize (params={})
|
2181
2314
|
@inside_tagset = false
|
2182
2315
|
super(params)
|
2183
2316
|
end
|
2184
|
-
|
2317
|
+
|
2185
2318
|
def tagstart(name, attributes)
|
2186
2319
|
case name
|
2187
2320
|
when 'tagSet'
|
@@ -2275,8 +2408,73 @@ module Aws
|
|
2275
2408
|
end
|
2276
2409
|
end
|
2277
2410
|
|
2278
|
-
|
2411
|
+
#-----------------------------------------------------------------
|
2412
|
+
# PARSERS: Vpc
|
2413
|
+
#-----------------------------------------------------------------
|
2279
2414
|
|
2280
|
-
|
2415
|
+
class QEc2VpcsParser < AwsParser #:nodoc:
|
2416
|
+
def initialize(wrapper, opts = {})
|
2417
|
+
super(opts)
|
2418
|
+
@wrapper = wrapper
|
2419
|
+
end
|
2420
|
+
|
2421
|
+
def tagstart(name, attribute)
|
2422
|
+
@vpc = {} if name == @wrapper
|
2423
|
+
end
|
2424
|
+
|
2425
|
+
def tagend(name)
|
2426
|
+
case name
|
2427
|
+
when 'vpcId' then
|
2428
|
+
@vpc[:vpc_id] = @text
|
2429
|
+
when 'state' then
|
2430
|
+
@vpc[:state] = @text
|
2431
|
+
when 'cidrBlock' then
|
2432
|
+
@vpc[:cidr_block] = @text
|
2433
|
+
when 'dhcpOptionsId' then
|
2434
|
+
@vpc[:dhcp_options_id] = @text
|
2435
|
+
when @wrapper
|
2436
|
+
@result << @vpc
|
2437
|
+
end
|
2438
|
+
end
|
2439
|
+
|
2440
|
+
def reset
|
2441
|
+
@result = []
|
2442
|
+
end
|
2443
|
+
end
|
2281
2444
|
|
2445
|
+
class QEc2SubnetsParser < AwsParser #:nodoc
|
2446
|
+
def initialize(wrapper, opts = {})
|
2447
|
+
super(opts)
|
2448
|
+
@wrapper = wrapper
|
2449
|
+
end
|
2282
2450
|
|
2451
|
+
def tagstart(name, attribute)
|
2452
|
+
@subnet = {} if name == @wrapper
|
2453
|
+
end
|
2454
|
+
|
2455
|
+
def tagend(name)
|
2456
|
+
case name
|
2457
|
+
when 'subnetId' then
|
2458
|
+
@subnet[:subnet_id] = @text
|
2459
|
+
when 'state' then
|
2460
|
+
@subnet[:state] = @text
|
2461
|
+
when 'vpcId' then
|
2462
|
+
@subnet[:vpc_id] = @text
|
2463
|
+
when 'cidrBlock' then
|
2464
|
+
@subnet[:cidr_block] = @text
|
2465
|
+
when 'availableIpAddressCount' then
|
2466
|
+
@subnet[:available_ip_address_count] = @text
|
2467
|
+
when 'availabilityZone' then
|
2468
|
+
@subnet[:availability_zone] = @text
|
2469
|
+
when @wrapper
|
2470
|
+
@result << @subnet
|
2471
|
+
end
|
2472
|
+
end
|
2473
|
+
|
2474
|
+
def reset
|
2475
|
+
@result = []
|
2476
|
+
end
|
2477
|
+
end
|
2478
|
+
end
|
2479
|
+
|
2480
|
+
end
|
data/lib/s3/bucket.rb
CHANGED
@@ -181,9 +181,9 @@ module Aws
|
|
181
181
|
# data = bucket.get('logs/today/1.log') #=>
|
182
182
|
# puts data #=> 'sasfasfasdf'
|
183
183
|
#
|
184
|
-
def get(key, headers={})
|
184
|
+
def get(key, headers={}, &block)
|
185
185
|
key = S3::Key.create(self, key.to_s) unless key.is_a?(S3::Key)
|
186
|
-
key.get(headers)
|
186
|
+
key.get(headers, &block)
|
187
187
|
end
|
188
188
|
|
189
189
|
# Retrieve object data from Amazon.
|
data/lib/sdb/sdb_interface.rb
CHANGED
@@ -183,7 +183,12 @@ module Aws
|
|
183
183
|
if $1 # if escaped '\?' is found - replace it by '?' without backslash
|
184
184
|
"?"
|
185
185
|
else # well, if no backslash precedes '?' then replace it by next param from the list
|
186
|
-
|
186
|
+
case params[i]
|
187
|
+
when Array
|
188
|
+
ret = "(#{params[i].map{|p| escape(p)}.join(",")})"
|
189
|
+
else
|
190
|
+
ret = escape(params[i])
|
191
|
+
end
|
187
192
|
i +=1
|
188
193
|
ret
|
189
194
|
end
|
metadata
CHANGED
@@ -1,61 +1,74 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.5.7
|
4
5
|
prerelease:
|
5
|
-
version: 2.5.6
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Travis Reeder
|
9
9
|
- Chad Arimura
|
10
10
|
- RightScale
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2012-09-09 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
18
17
|
name: uuidtools
|
19
|
-
|
20
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
21
19
|
none: false
|
22
|
-
requirements:
|
23
|
-
- -
|
24
|
-
- !ruby/object:Gem::Version
|
25
|
-
version:
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '0'
|
26
24
|
type: :runtime
|
27
|
-
version_requirements: *id001
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: http_connection
|
30
25
|
prerelease: false
|
31
|
-
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
27
|
none: false
|
33
|
-
requirements:
|
34
|
-
- -
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version:
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
- !ruby/object:Gem::Dependency
|
33
|
+
name: http_connection
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
37
40
|
type: :runtime
|
38
|
-
version_requirements: *id002
|
39
|
-
- !ruby/object:Gem::Dependency
|
40
|
-
name: xml-simple
|
41
41
|
prerelease: false
|
42
|
-
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
none: false
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version:
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: xml-simple
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
48
56
|
type: :runtime
|
49
|
-
|
50
|
-
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
description: AWS Ruby Library for interfacing with Amazon Web Services including EC2,
|
65
|
+
S3, SQS, SimpleDB and most of their other services as well. By http://www.appoxy.com
|
51
66
|
email: travis@appoxy.com
|
52
67
|
executables: []
|
53
|
-
|
54
68
|
extensions: []
|
55
|
-
|
56
|
-
extra_rdoc_files:
|
69
|
+
extra_rdoc_files:
|
57
70
|
- README.markdown
|
58
|
-
files:
|
71
|
+
files:
|
59
72
|
- lib/acf/acf_interface.rb
|
60
73
|
- lib/aws.rb
|
61
74
|
- lib/awsbase/aws_response_array.rb
|
@@ -84,30 +97,26 @@ files:
|
|
84
97
|
- README.markdown
|
85
98
|
homepage: http://github.com/appoxy/aws/
|
86
99
|
licenses: []
|
87
|
-
|
88
100
|
post_install_message:
|
89
101
|
rdoc_options: []
|
90
|
-
|
91
|
-
require_paths:
|
102
|
+
require_paths:
|
92
103
|
- lib
|
93
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
105
|
none: false
|
95
|
-
requirements:
|
96
|
-
- -
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version:
|
99
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
111
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version:
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
105
116
|
requirements: []
|
106
|
-
|
107
117
|
rubyforge_project:
|
108
|
-
rubygems_version: 1.8.
|
118
|
+
rubygems_version: 1.8.24
|
109
119
|
signing_key:
|
110
120
|
specification_version: 3
|
111
121
|
summary: AWS Ruby Library for interfacing with Amazon Web Services. By http://www.appoxy.com
|
112
122
|
test_files: []
|
113
|
-
|