aws-sdk 1.3.5 → 1.3.6

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.
Files changed (57) hide show
  1. data/lib/aws/api_config/EC2-2011-12-15.yml +2791 -0
  2. data/lib/aws/core.rb +4 -4
  3. data/lib/aws/core/client.rb +1 -0
  4. data/lib/aws/core/client_logging.rb +9 -2
  5. data/lib/aws/core/lazy_error_classes.rb +1 -1
  6. data/lib/aws/core/response.rb +5 -0
  7. data/lib/aws/core/service_interface.rb +3 -2
  8. data/lib/aws/core/uri_escape.rb +1 -2
  9. data/lib/aws/ec2.rb +80 -1
  10. data/lib/aws/ec2/client.rb +29 -10
  11. data/lib/aws/ec2/client/xml.rb +51 -1
  12. data/lib/aws/ec2/customer_gateway.rb +90 -0
  13. data/lib/aws/ec2/customer_gateway_collection.rb +73 -0
  14. data/lib/aws/ec2/dhcp_options.rb +106 -0
  15. data/lib/aws/ec2/dhcp_options_collection.rb +87 -0
  16. data/lib/aws/ec2/filtered_collection.rb +27 -2
  17. data/lib/aws/ec2/image.rb +7 -4
  18. data/lib/aws/ec2/instance.rb +54 -2
  19. data/lib/aws/ec2/instance_collection.rb +5 -3
  20. data/lib/aws/ec2/internet_gateway.rb +122 -0
  21. data/lib/aws/ec2/internet_gateway/attachment.rb +78 -0
  22. data/lib/aws/ec2/internet_gateway_collection.rb +54 -0
  23. data/lib/aws/ec2/network_acl.rb +254 -0
  24. data/lib/aws/ec2/network_acl/association.rb +56 -0
  25. data/lib/aws/ec2/network_acl/entry.rb +147 -0
  26. data/lib/aws/ec2/network_acl_collection.rb +65 -0
  27. data/lib/aws/ec2/network_interface.rb +174 -0
  28. data/lib/aws/ec2/network_interface/attachment.rb +100 -0
  29. data/lib/aws/ec2/network_interface_collection.rb +103 -0
  30. data/lib/aws/ec2/region.rb +11 -1
  31. data/lib/aws/ec2/resource.rb +6 -2
  32. data/lib/aws/ec2/route_table.rb +204 -0
  33. data/lib/aws/ec2/route_table/association.rb +119 -0
  34. data/lib/aws/ec2/route_table/route.rb +113 -0
  35. data/lib/aws/ec2/route_table_collection.rb +73 -0
  36. data/lib/aws/ec2/security_group.rb +15 -5
  37. data/lib/aws/ec2/security_group_collection.rb +15 -12
  38. data/lib/aws/ec2/subnet.rb +161 -0
  39. data/lib/aws/ec2/subnet_collection.rb +115 -0
  40. data/lib/aws/ec2/vpc.rb +166 -0
  41. data/lib/aws/ec2/vpc_collection.rb +71 -0
  42. data/lib/aws/ec2/vpn_connection.rb +99 -0
  43. data/lib/aws/ec2/vpn_connection/telemetry.rb +49 -0
  44. data/lib/aws/ec2/vpn_connection_collection.rb +96 -0
  45. data/lib/aws/ec2/vpn_gateway.rb +123 -0
  46. data/lib/aws/ec2/vpn_gateway/attachment.rb +45 -0
  47. data/lib/aws/ec2/vpn_gateway_collection.rb +77 -0
  48. data/lib/aws/iam/login_profile.rb +4 -0
  49. data/lib/aws/iam/user.rb +6 -0
  50. data/lib/aws/record/hash_model.rb +3 -3
  51. data/lib/aws/simple_workflow.rb +6 -3
  52. data/lib/aws/simple_workflow/activity_task_collection.rb +7 -2
  53. data/lib/aws/simple_workflow/decision_task_collection.rb +11 -5
  54. data/lib/aws/simple_workflow/option_formatters.rb +7 -0
  55. data/lib/net/http/connection_pool.rb +19 -5
  56. metadata +33 -5
  57. data/lib/aws/api_config/EC2-2011-02-28.yml +0 -2314
@@ -25,12 +25,12 @@ require 'aws/core/autoloader'
25
25
  # * {AWS::ELB}
26
26
  # * {AWS::IAM}
27
27
  # * {AWS::S3}
28
- # * {AWS::SimpleDB}
29
- # * {AWS::SimpleEmailService}
30
- # * {AWS::SimpleWorkflow}
31
28
  # * {AWS::SNS}
32
29
  # * {AWS::SQS}
33
30
  # * {AWS::STS}
31
+ # * {AWS::SimpleDB}
32
+ # * {AWS::SimpleEmailService}
33
+ # * {AWS::SimpleWorkflow}
34
34
  #
35
35
  # = AWS::Record
36
36
  #
@@ -59,7 +59,7 @@ require 'aws/core/autoloader'
59
59
  module AWS
60
60
 
61
61
  # Current version of the AWS SDK for Ruby
62
- VERSION = "1.3.5"
62
+ VERSION = "1.3.6"
63
63
 
64
64
  register_autoloads(self) do
65
65
  autoload :Errors, 'errors'
@@ -234,6 +234,7 @@ module AWS
234
234
  private
235
235
  def rebuild_http_request response
236
236
  response.rebuild_request
237
+ response.retry_count += 1
237
238
  end
238
239
 
239
240
  private
@@ -53,8 +53,15 @@ module AWS
53
53
  status = response.http_response.status
54
54
  service = self.class.service_name
55
55
 
56
- pattern = "[AWS %s %s %.06f] %s(%s)"
57
- parts = [service, status, time.real, method_name, sanitize_options(options)]
56
+ pattern = "[AWS %s %s %.06f %d retries] %s(%s)"
57
+ parts = [
58
+ service,
59
+ status,
60
+ time.real,
61
+ response.retry_count,
62
+ method_name,
63
+ sanitize_options(options)]
64
+
58
65
  severity = :info
59
66
 
60
67
  if response.error
@@ -39,7 +39,7 @@ module AWS
39
39
  end
40
40
 
41
41
  def error_class(code)
42
- module_eval("#{self}::#{code.gsub(".","::")}")
42
+ module_eval("#{self}::#{code.gsub('.Range','Range').gsub(".","::")}")
43
43
  end
44
44
 
45
45
  def included(mod)
@@ -40,6 +40,10 @@ module AWS
40
40
 
41
41
  # @return [Boolean] true if the response is cached
42
42
  attr_accessor :cached
43
+
44
+ # @return [Integer] Returns the number of times the request
45
+ # was retried.
46
+ attr_accessor :retry_count
43
47
 
44
48
  # @param [Http::Request] http_request
45
49
  # @param [Http::Response] http_request
@@ -47,6 +51,7 @@ module AWS
47
51
  @http_request = http_request
48
52
  @http_response = http_response
49
53
  @request_builder = block
54
+ @retry_count = 0
50
55
  rebuild_request if @request_builder && !http_request
51
56
  end
52
57
 
@@ -14,7 +14,6 @@
14
14
  module AWS
15
15
  module Core
16
16
 
17
- # @private
18
17
  module ServiceInterface
19
18
 
20
19
  def self.included base
@@ -40,9 +39,11 @@ module AWS
40
39
  # @see AWS::Cofiguration
41
40
  #
42
41
  # @param [Hash] options
42
+ #
43
43
  # @option options [Configuration] :config An AWS::Configuration
44
44
  # object to initialize this service interface object with. Defaults
45
45
  # to AWS.config when not provided.
46
+ #
46
47
  def initialize options = {}
47
48
  @config = options[:config]
48
49
  @config ||= AWS.config
@@ -50,7 +51,7 @@ module AWS
50
51
  @client = config.send(Inflection.ruby_name(self.class.to_s) + '_client')
51
52
  end
52
53
 
53
- # @private
54
+ # @return [String]
54
55
  def inspect
55
56
  "<#{self.class}>"
56
57
  end
@@ -24,8 +24,7 @@ module AWS
24
24
  # @private
25
25
  protected
26
26
  def escape value
27
- value = value.encode("UTF-8") if
28
- value.respond_to?(:encode)
27
+ value = value.encode("UTF-8") if value.respond_to?(:encode)
29
28
  CGI::escape(value.to_s).gsub('+', '%20')
30
29
  end
31
30
 
@@ -240,6 +240,10 @@ module AWS
240
240
  autoload :Client, 'client'
241
241
  autoload :Collection, 'collection'
242
242
  autoload :ConfigTransform, 'config_transform'
243
+ autoload :CustomerGateway, 'customer_gateway'
244
+ autoload :CustomerGatewayCollection, 'customer_gateway_collection'
245
+ autoload :DHCPOptions, 'dhcp_options'
246
+ autoload :DHCPOptionsCollection, 'dhcp_options_collection'
243
247
  autoload :ElasticIp, 'elastic_ip'
244
248
  autoload :ElasticIpCollection, 'elastic_ip_collection'
245
249
  autoload :Errors, 'errors'
@@ -249,8 +253,14 @@ module AWS
249
253
  autoload :ImageCollection, 'image_collection'
250
254
  autoload :Instance, 'instance'
251
255
  autoload :InstanceCollection, 'instance_collection'
256
+ autoload :InternetGateway, 'internet_gateway'
257
+ autoload :InternetGatewayCollection, 'internet_gateway_collection'
252
258
  autoload :KeyPair, 'key_pair'
253
259
  autoload :KeyPairCollection, 'key_pair_collection'
260
+ autoload :NetworkACL, 'network_acl'
261
+ autoload :NetworkACLCollection, 'network_acl_collection'
262
+ autoload :NetworkInterface, 'network_interface'
263
+ autoload :NetworkInterfaceCollection, 'network_interface_collection'
254
264
  autoload :PermissionCollection, 'permission_collection'
255
265
  autoload :Region, 'region'
256
266
  autoload :RegionCollection, 'region_collection'
@@ -263,16 +273,26 @@ module AWS
263
273
  autoload :Resource, 'resource'
264
274
  autoload :ResourceObject, 'tag_collection'
265
275
  autoload :ResourceTagCollection, 'resource_tag_collection'
276
+ autoload :RouteTable, 'route_table'
277
+ autoload :RouteTableCollection, 'route_table_collection'
266
278
  autoload :SecurityGroup, 'security_group'
267
279
  autoload :SecurityGroupCollection, 'security_group_collection'
268
280
  autoload :Snapshot, 'snapshot'
269
281
  autoload :SnapshotCollection, 'snapshot_collection'
282
+ autoload :Subnet, 'subnet'
283
+ autoload :SubnetCollection, 'subnet_collection'
270
284
  autoload :Tag, 'tag'
271
285
  autoload :TagCollection, 'tag_collection'
272
286
  autoload :TaggedCollection, 'tagged_collection'
273
287
  autoload :TaggedItem, 'tagged_item'
274
288
  autoload :Volume, 'volume'
275
289
  autoload :VolumeCollection, 'volume_collection'
290
+ autoload :VPC, 'vpc'
291
+ autoload :VPCCollection, 'vpc_collection'
292
+ autoload :VPNConnection, 'vpn_connection'
293
+ autoload :VPNConnectionCollection, 'vpn_connection_collection'
294
+ autoload :VPNGateway, 'vpn_gateway'
295
+ autoload :VPNGatewayCollection, 'vpn_gateway_collection'
276
296
  end
277
297
 
278
298
  include Core::ServiceInterface
@@ -347,6 +367,65 @@ module AWS
347
367
  SnapshotCollection.new(:config => config)
348
368
  end
349
369
 
350
- end
370
+ # @return [VPCCollection] A collection representing
371
+ # all VPCs in your account.
372
+ def vpcs
373
+ VPCCollection.new(:config => config)
374
+ end
375
+
376
+ # @return [SubnetCollection] Returns a collection that represents all
377
+ # of the subnets associated with this account (across all VPCs).
378
+ def subnets
379
+ SubnetCollection.new(:config => config)
380
+ end
381
+
382
+ # @return [NetworkACLCollection] Returns a collection that represents
383
+ # all of the network ACLs for this account.
384
+ def network_acls
385
+ NetworkACLCollection.new(:config => config)
386
+ end
351
387
 
388
+ # @return [RouteTableCollection] Returns a collection that represents
389
+ # all of the route tables for this account.
390
+ def route_tables
391
+ RouteTableCollection.new(:config => config)
392
+ end
393
+
394
+ # @return [NetworkInterfaceCollection] Returns a collection that
395
+ # represents all of the network interfaces for this account.
396
+ def network_interfaces
397
+ NetworkInterfaceCollection.new(:config => config)
398
+ end
399
+
400
+ # @return [InternetGatewayCollection] Returns a collection that
401
+ # represents all of the internet gateways for this account.
402
+ def internet_gateways
403
+ InternetGatewayCollection.new(:config => config)
404
+ end
405
+
406
+ # @return [CustomerGatewayCollection] Returns a collection that
407
+ # represents all of the customer gateways for this account.
408
+ def customer_gateways
409
+ CustomerGatewayCollection.new(:config => config)
410
+ end
411
+
412
+ # @return [VPNGatewayCollection] Returns a collection that
413
+ # represents all of the vpn gateways for this account.
414
+ def vpn_gateways
415
+ VPNGatewayCollection.new(:config => config)
416
+ end
417
+
418
+ # @return [DHCPOptionsCollection] Returns a collection that
419
+ # represents all of the dhcp options for this account.
420
+ def dhcp_options
421
+ DHCPOptionsCollection.new(:config => config)
422
+ end
423
+
424
+ # @return [VPNConnections] Returns a collection that
425
+ # represents all of vpn connections for this account.
426
+ def vpn_connections
427
+ VPNConnectionCollection.new(:config => config)
428
+ end
429
+
430
+ end
352
431
  end
@@ -23,27 +23,46 @@ module AWS
23
23
 
24
24
  include Core::ConfiguredClientMethods
25
25
 
26
- API_VERSION = '2011-02-28'
26
+ API_VERSION = '2011-12-15'
27
27
 
28
28
  REQUEST_CLASS = EC2::Request
29
29
 
30
30
  # @private
31
31
  CACHEABLE_REQUESTS = Set[
32
- :describe_instances,
33
- :describe_instance_attribute,
34
- :describe_images,
35
- :describe_image_attribute,
36
- :describe_volumes,
37
- :describe_security_groups,
38
32
  :describe_addresses,
33
+ :describe_availability_zones,
34
+ :describe_bundle_tasks,
35
+ :describe_customer_gateways,
36
+ :describe_dhcp_options,
37
+ :describe_image_attribute,
38
+ :describe_images,
39
+ :describe_instances,
39
40
  :describe_key_pairs,
40
41
  :describe_regions,
41
- :describe_availability_zones,
42
42
  :describe_reserved_instances,
43
43
  :describe_reserved_instances_offerings,
44
- :describe_snapshots,
44
+ :describe_security_groups,
45
45
  :describe_snapshot_attribute,
46
- :describe_tags
46
+ :describe_snapshots,
47
+ :describe_subnets,
48
+ :describe_volumes,
49
+ :describe_vpcs,
50
+ :describe_vpn_connections,
51
+ :describe_vpn_gateways,
52
+ :describe_instance_attribute,
53
+ :describe_spot_instance_requests,
54
+ :describe_spot_price_history,
55
+ :describe_spot_datafeed_subscription,
56
+ :describe_licenses,
57
+ :describe_placement_groups,
58
+ :describe_tags,
59
+ :describe_internet_gateways,
60
+ :describe_route_tables,
61
+ :describe_network_acls,
62
+ :describe_instance_status,
63
+ :describe_conversion_tasks,
64
+ :describe_network_interfaces,
65
+ :describe_network_interface_attribute,
47
66
  ]
48
67
 
49
68
  configure_client
@@ -27,6 +27,57 @@ module AWS
27
27
 
28
28
  define_configured_grammars
29
29
 
30
+ CustomizedDescribeNetworkInterfaces = DescribeNetworkInterfaces.customize do
31
+ element "networkInterfaceSet" do
32
+ rename "set"
33
+ element "item" do
34
+ element "groupSet" do
35
+ element "item" do
36
+ rename :groups
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ CustomizedDescribeCustomerGateways = DescribeCustomerGateways.customize do
44
+ element "customerGatewaySet" do
45
+ element "item" do
46
+ element "type" do
47
+ rename :vpn_type
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ CustomizedDescribeVpnConnections = DescribeVpnConnections.customize do
54
+ element "vpnConnectionSet" do
55
+ element "item" do
56
+ element "type" do
57
+ rename :vpn_type
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+ CustomizedCreateVpnGateway = CreateVpnGateway.customize do
64
+ element "vpnGateway" do
65
+ element "type" do
66
+ rename :vpn_type
67
+ end
68
+ end
69
+ end
70
+
71
+ CustomizedDescribeVpnGateways = DescribeVpnGateways.customize do
72
+ element "vpnGatewaySet" do
73
+ element "item" do
74
+ element "type" do
75
+ rename :vpn_type
76
+ end
77
+ end
78
+ end
79
+ end
80
+
30
81
  CustomizedDescribeSecurityGroups = DescribeSecurityGroups.customize do
31
82
  element "securityGroupInfo" do
32
83
  element "item" do
@@ -119,7 +170,6 @@ module AWS
119
170
  end
120
171
 
121
172
  end
122
-
123
173
  end
124
174
  end
125
175
  end
@@ -0,0 +1,90 @@
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ module AWS
15
+ class EC2
16
+
17
+ # @attr_reader [Symbol] state Returns the gateway state (e.g.
18
+ # :pending, :available, :deleting, :deleted)
19
+ #
20
+ # @attr_reader [String] type The type of VPN connection the customer
21
+ # gateway supports (e.g. 'ipsec.1').
22
+ #
23
+ # @attr_reader [String] ip_address The Internet-routable IP address of
24
+ # the customer gateway's outside interface.
25
+ #
26
+ # @attr_reader [Integer] bgp_asn The customer gateway's Border Gateway
27
+ # Protocol (BGP) Autonomous System Number (ASN).
28
+ #
29
+ class CustomerGateway < Resource
30
+
31
+ include TaggedItem
32
+
33
+ # @private
34
+ def initialize customer_gateway_id, options = {}
35
+ @customer_gateway_id = customer_gateway_id
36
+ super
37
+ end
38
+
39
+ # @return [String]
40
+ attr_reader :customer_gateway_id
41
+
42
+ alias_method :id, :customer_gateway_id
43
+
44
+ attribute :state, :to_sym => true
45
+
46
+ attribute :vpn_type, :static => true
47
+
48
+ attribute :ip_address, :static => true
49
+
50
+ attribute :bgp_asn, :static => true
51
+
52
+ populates_from(:create_customer_gateway) do |resp|
53
+ resp.customer_gateway if resp.customer_gateway.customer_gateway_id == id
54
+ end
55
+
56
+ populates_from(:describe_customer_gateways) do |resp|
57
+ resp.customer_gateway_set.find do |gateway|
58
+ gateway.customer_gateway_id == customer_gateway_id
59
+ end
60
+ end
61
+
62
+ # @return [VPNConnectionCollection] Returns a collection
63
+ # of VPC connections for this gateway.
64
+ def vpn_connections
65
+ connections = VPNConnectionCollection.new(:config => config)
66
+ connections.filter('customer-gateway-id', id)
67
+ end
68
+
69
+ # Deletes this customer gateway.
70
+ # @return [nil]
71
+ def delete
72
+ client_opts = {}
73
+ client_opts[:customer_gateway_id] = customer_gateway_id
74
+ client.delete_customer_gateway(client_opts)
75
+ nil
76
+ end
77
+
78
+ # @return [Boolean] Returns true if the gateway exists.
79
+ def exists?
80
+ begin
81
+ client.describe_customer_gateways(:customer_gateway_ids => [id])
82
+ true
83
+ rescue Errors::InvalidCustomerGatewayID::NotFound
84
+ false
85
+ end
86
+ end
87
+
88
+ end
89
+ end
90
+ end