aws-sdk 1.3.8 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/lib/aws.rb +2 -0
  2. data/lib/aws/api_config/AutoScaling-2011-01-01.yml +563 -0
  3. data/lib/aws/auto_scaling.rb +162 -0
  4. data/lib/aws/auto_scaling/activity.rb +102 -0
  5. data/lib/aws/auto_scaling/activity_collection.rb +82 -0
  6. data/lib/aws/auto_scaling/client.rb +50 -0
  7. data/lib/aws/auto_scaling/client/xml.rb +32 -0
  8. data/lib/aws/auto_scaling/config.rb +18 -0
  9. data/lib/aws/auto_scaling/errors.rb +26 -0
  10. data/lib/aws/auto_scaling/group.rb +420 -0
  11. data/lib/aws/auto_scaling/group_collection.rb +96 -0
  12. data/lib/aws/auto_scaling/group_options.rb +146 -0
  13. data/lib/aws/auto_scaling/instance.rb +192 -0
  14. data/lib/aws/auto_scaling/instance_collection.rb +63 -0
  15. data/lib/aws/auto_scaling/launch_configuration.rb +150 -0
  16. data/lib/aws/auto_scaling/launch_configuration_collection.rb +144 -0
  17. data/lib/aws/auto_scaling/notification_configuration.rb +89 -0
  18. data/lib/aws/auto_scaling/notification_configuration_collection.rb +184 -0
  19. data/lib/aws/auto_scaling/request.rb +24 -0
  20. data/lib/aws/auto_scaling/scaling_policy.rb +125 -0
  21. data/lib/aws/auto_scaling/scaling_policy_collection.rb +72 -0
  22. data/lib/aws/auto_scaling/scaling_policy_options.rb +61 -0
  23. data/lib/aws/auto_scaling/scheduled_action.rb +145 -0
  24. data/lib/aws/auto_scaling/scheduled_action_collection.rb +195 -0
  25. data/lib/aws/auto_scaling/tag.rb +59 -0
  26. data/lib/aws/auto_scaling/tag_collection.rb +112 -0
  27. data/lib/aws/core.rb +40 -8
  28. data/lib/aws/core/client.rb +28 -3
  29. data/lib/aws/core/configuration.rb +38 -31
  30. data/lib/aws/core/http/request.rb +3 -3
  31. data/lib/aws/core/http/response.rb +2 -1
  32. data/lib/aws/core/log_formatter.rb +454 -0
  33. data/lib/aws/core/resource.rb +2 -1
  34. data/lib/aws/core/response.rb +5 -0
  35. data/lib/aws/core/uri_escape.rb +1 -1
  36. data/lib/aws/core/xml_grammar.rb +21 -0
  37. data/lib/aws/dynamo_db/request.rb +1 -1
  38. data/lib/aws/ec2/network_acl_collection.rb +1 -2
  39. data/lib/aws/ec2/route_table_collection.rb +1 -2
  40. data/lib/aws/ec2/vpn_gateway_collection.rb +1 -1
  41. data/lib/aws/elb/load_balancer.rb +0 -2
  42. data/lib/aws/errors.rb +2 -2
  43. data/lib/aws/s3/object_version_collection.rb +1 -1
  44. data/lib/aws/s3/s3_object.rb +4 -4
  45. data/lib/aws/sqs/queue.rb +2 -2
  46. metadata +52 -27
  47. data/lib/aws/core/client_logging.rb +0 -133
@@ -24,6 +24,7 @@ module AWS
24
24
  # @private
25
25
  class NotFound < StandardError; end
26
26
 
27
+ # @private
27
28
  def initialize *args
28
29
 
29
30
  super
@@ -62,7 +63,7 @@ module AWS
62
63
  # AWS resource.
63
64
  def eql? other
64
65
  other.kind_of?(self.class) and
65
- resource_identifiers == other.resource_identifiers
66
+ other.resource_identifiers == resource_identifiers
66
67
  end
67
68
  alias_method :==, :eql?
68
69
 
@@ -44,6 +44,10 @@ module AWS
44
44
  # @return [Integer] Returns the number of times the request
45
45
  # was retried.
46
46
  attr_accessor :retry_count
47
+
48
+ # @return [Float] The total number of seconds taken to make the
49
+ # request and return the response.
50
+ attr_accessor :duration
47
51
 
48
52
  # @param [Http::Request] http_request
49
53
  # @param [Http::Response] http_request
@@ -52,6 +56,7 @@ module AWS
52
56
  @http_response = http_response
53
57
  @request_builder = block
54
58
  @retry_count = 0
59
+ @duration = 0
55
60
  rebuild_request if @request_builder && !http_request
56
61
  end
57
62
 
@@ -25,7 +25,7 @@ module AWS
25
25
  protected
26
26
  def escape value
27
27
  value = value.encode("UTF-8") if value.respond_to?(:encode)
28
- CGI::escape(value.to_s).gsub('+', '%20')
28
+ CGI::escape(value.to_s).gsub('+', '%20').gsub('%7E', '~')
29
29
  end
30
30
 
31
31
  # URI-escapes a path without escaping the separators
@@ -48,6 +48,26 @@ module AWS
48
48
  def respond_to?(m)
49
49
  @data.key?(m.to_sym) or super
50
50
  end
51
+
52
+ def to_hash
53
+ @data.inject({}) do |hash,(key,value)|
54
+
55
+ # strip question marks from hash keys
56
+ if matches = key.to_s.match(/(.+)\?$/)
57
+ key = matches[1].to_sym
58
+ end
59
+
60
+ # recursively convert hashes
61
+ if value.is_a?(Array)
62
+ value = value.map{|v| v.is_a?(Context) ? v.to_hash : v }
63
+ elsif value.is_a?(Context)
64
+ value = value.to_hash
65
+ end
66
+
67
+ hash.merge(key => value)
68
+
69
+ end
70
+ end
51
71
 
52
72
  def inspect
53
73
  methods = @data.keys
@@ -517,6 +537,7 @@ module AWS
517
537
 
518
538
  end
519
539
 
540
+ # @private
520
541
  module NokogiriAdapter
521
542
 
522
543
  def xmldecl(*args); end
@@ -50,7 +50,7 @@ module AWS
50
50
  end
51
51
 
52
52
  def headers_to_sign
53
- headers.keys.select do |header|
53
+ headers.keys.sort.select do |header|
54
54
  header == "content-encoding" ||
55
55
  header == "host" ||
56
56
  header =~ /^x-amz/
@@ -24,8 +24,7 @@ module AWS
24
24
  # @param [Hash] options
25
25
  #
26
26
  # @option options [VPC,String] :vpc The vpc or vpc id of where you want
27
- # to create the subnet. This option is required if this collection
28
- # does not have a populated vpc ({#vpc} returns nil).
27
+ # to create the subnet.
29
28
  #
30
29
  # @return [NetworkACL]
31
30
  #
@@ -24,8 +24,7 @@ module AWS
24
24
  # @param [Hash] options
25
25
  #
26
26
  # @option options [VPC,String] :vpc The vpc or vpc id of where you want
27
- # to create the route table. This option is required if this
28
- # collection does not have a populated vpc ({#vpc} returns nil).
27
+ # to create the route table.
29
28
  #
30
29
  # @return [RouteTable]
31
30
  #
@@ -31,7 +31,7 @@ module AWS
31
31
  # @option options [AvailabilityZone,String] :availability_zone
32
32
  # The Availability Zone where you want the virtual private gateway.
33
33
  # AWS can select a default zone for you. This can be an
34
- # {AvailablityZone} object or availability zone name string.
34
+ # {AvailabilityZone} object or availability zone name string.
35
35
  #
36
36
  # @return [VPNGateway]
37
37
  #
@@ -14,8 +14,6 @@
14
14
  module AWS
15
15
  class ELB
16
16
 
17
-
18
- #
19
17
  # @attr_reader [String] name The name of the load balancer.
20
18
  #
21
19
  # @attr_reader [Array<String>] availability_zone_names Return the names of
@@ -101,9 +101,9 @@ module AWS
101
101
  super(nil, nil, req)
102
102
  @message = req
103
103
  elsif req and resp
104
- super(req, resp, message)
105
- include_error_type
106
104
  parse_body(resp.body)
105
+ super(req, resp, self.message)
106
+ include_error_type
107
107
  else
108
108
  super()
109
109
  end
@@ -41,7 +41,7 @@ module AWS
41
41
  #
42
42
  # If you know the id of a particular version you can get that object.
43
43
  #
44
- # bucket.objets['myobj'].version[version_id].delete
44
+ # bucket.objects['myobj'].version[version_id].delete
45
45
  #
46
46
  class ObjectVersionCollection
47
47
 
@@ -448,7 +448,7 @@ module AWS
448
448
  # new object once this is done.
449
449
  #
450
450
  # bucket = s3.buckets['old-bucket']
451
- # old_obj = bucket.objets['old-key']
451
+ # old_obj = bucket.objects['old-key']
452
452
  #
453
453
  # # renaming an object returns a new object
454
454
  # new_obj = old_obj.move_to('new-key')
@@ -465,7 +465,7 @@ module AWS
465
465
  # obj = s3.buckets['old-bucket'].objects['old-key]
466
466
  # obj.move_to('new-key', :bucket_name => 'new_bucket')
467
467
  #
468
- # If the copy succedes, but the then the delete fails, an error
468
+ # If the copy succeeds, but the then the delete fails, an error
469
469
  # will be raised.
470
470
  #
471
471
  # @param [String] target The key to move this object to.
@@ -474,7 +474,7 @@ module AWS
474
474
  #
475
475
  # @option (see #copy_to)
476
476
  #
477
- # @return [S3Object] Returns a new objet with the new key.
477
+ # @return [S3Object] Returns a new object with the new key.
478
478
  #
479
479
  def move_to target, options = {}
480
480
  copy = copy_to(target, options)
@@ -806,7 +806,7 @@ module AWS
806
806
  # as a date using Time#parse), a Time, or a DateTime object.
807
807
  # This option defaults to one hour after the current time.
808
808
  #
809
- # @option options [String] :secure Whether to generate a
809
+ # @option options [Boolean] :secure (true) Whether to generate a
810
810
  # secure (HTTPS) URL or a plain HTTP url.
811
811
  #
812
812
  # @option options [String] :response_content_type Sets the
@@ -452,7 +452,7 @@ module AWS
452
452
  # You can also set an optional delay for all of the messages:
453
453
  #
454
454
  # # delay all messages 1 hour
455
- # queue.batch_send_message(msg1, msg2, :delay_seconds => 3600)
455
+ # queue.batch_send(msg1, msg2, :delay_seconds => 3600)
456
456
  #
457
457
  # If you need to set a custom delay for each message you can pass
458
458
  # hashes:
@@ -461,7 +461,7 @@ module AWS
461
461
  # messages << { :message_body => 'msg1', :delay_seconds => 60 }
462
462
  # messages << { :message_body => 'msg2', :delay_seconds => 30 }
463
463
  #
464
- # queue.batch_send_message(messages)
464
+ # queue.batch_send(messages)
465
465
  #
466
466
  # @param [String,Hash] messages A list of messages. Each message
467
467
  # should be a string, or a hash with a +:message_body+,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 8
10
- version: 1.3.8
9
+ - 9
10
+ version: 1.3.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Amazon Web Services
@@ -15,12 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-16 00:00:00 Z
18
+ date: 2012-03-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- prerelease: false
22
- type: :runtime
23
- requirement: &id001 !ruby/object:Gem::Requirement
21
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
22
  none: false
25
23
  requirements:
26
24
  - - ~>
@@ -31,11 +29,11 @@ dependencies:
31
29
  - 1
32
30
  version: "2.1"
33
31
  name: uuidtools
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- prerelease: false
37
32
  type: :runtime
38
- requirement: &id002 !ruby/object:Gem::Requirement
33
+ prerelease: false
34
+ requirement: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
37
  none: false
40
38
  requirements:
41
39
  - - ~>
@@ -46,27 +44,27 @@ dependencies:
46
44
  - 7
47
45
  version: "0.7"
48
46
  name: httparty
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- prerelease: false
52
47
  type: :runtime
53
- requirement: &id003 !ruby/object:Gem::Requirement
48
+ prerelease: false
49
+ requirement: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
52
  none: false
55
53
  requirements:
56
- - - <=
54
+ - - ">="
57
55
  - !ruby/object:Gem::Version
58
- hash: 3
56
+ hash: 15
59
57
  segments:
60
58
  - 1
61
- - 5
62
- - 0
63
- version: 1.5.0
59
+ - 4
60
+ - 4
61
+ version: 1.4.4
64
62
  name: nokogiri
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- prerelease: false
68
63
  type: :runtime
69
- requirement: &id004 !ruby/object:Gem::Requirement
64
+ prerelease: false
65
+ requirement: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
68
  none: false
71
69
  requirements:
72
70
  - - ~>
@@ -77,7 +75,9 @@ dependencies:
77
75
  - 4
78
76
  version: "1.4"
79
77
  name: json
80
- version_requirements: *id004
78
+ type: :runtime
79
+ prerelease: false
80
+ requirement: *id004
81
81
  description: AWS SDK for Ruby
82
82
  email:
83
83
  executables: []
@@ -89,6 +89,30 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ca-bundle.crt
91
91
  - rails/init.rb
92
+ - lib/aws/auto_scaling/activity.rb
93
+ - lib/aws/auto_scaling/activity_collection.rb
94
+ - lib/aws/auto_scaling/client/xml.rb
95
+ - lib/aws/auto_scaling/client.rb
96
+ - lib/aws/auto_scaling/config.rb
97
+ - lib/aws/auto_scaling/errors.rb
98
+ - lib/aws/auto_scaling/group.rb
99
+ - lib/aws/auto_scaling/group_collection.rb
100
+ - lib/aws/auto_scaling/group_options.rb
101
+ - lib/aws/auto_scaling/instance.rb
102
+ - lib/aws/auto_scaling/instance_collection.rb
103
+ - lib/aws/auto_scaling/launch_configuration.rb
104
+ - lib/aws/auto_scaling/launch_configuration_collection.rb
105
+ - lib/aws/auto_scaling/notification_configuration.rb
106
+ - lib/aws/auto_scaling/notification_configuration_collection.rb
107
+ - lib/aws/auto_scaling/request.rb
108
+ - lib/aws/auto_scaling/scaling_policy.rb
109
+ - lib/aws/auto_scaling/scaling_policy_collection.rb
110
+ - lib/aws/auto_scaling/scaling_policy_options.rb
111
+ - lib/aws/auto_scaling/scheduled_action.rb
112
+ - lib/aws/auto_scaling/scheduled_action_collection.rb
113
+ - lib/aws/auto_scaling/tag.rb
114
+ - lib/aws/auto_scaling/tag_collection.rb
115
+ - lib/aws/auto_scaling.rb
92
116
  - lib/aws/core/api_config.rb
93
117
  - lib/aws/core/async_handle.rb
94
118
  - lib/aws/core/authorize_v2.rb
@@ -98,7 +122,6 @@ files:
98
122
  - lib/aws/core/autoloader.rb
99
123
  - lib/aws/core/cacheable.rb
100
124
  - lib/aws/core/client.rb
101
- - lib/aws/core/client_logging.rb
102
125
  - lib/aws/core/collection/limitable.rb
103
126
  - lib/aws/core/collection/simple.rb
104
127
  - lib/aws/core/collection.rb
@@ -120,6 +143,7 @@ files:
120
143
  - lib/aws/core/inflection.rb
121
144
  - lib/aws/core/json_client.rb
122
145
  - lib/aws/core/lazy_error_classes.rb
146
+ - lib/aws/core/log_formatter.rb
123
147
  - lib/aws/core/meta_utils.rb
124
148
  - lib/aws/core/model.rb
125
149
  - lib/aws/core/naming.rb
@@ -428,6 +452,7 @@ files:
428
452
  - lib/net/http/connection_pool/connection.rb
429
453
  - lib/net/http/connection_pool/session.rb
430
454
  - lib/net/http/connection_pool.rb
455
+ - lib/aws/api_config/AutoScaling-2011-01-01.yml
431
456
  - lib/aws/api_config/DynamoDB-2011-12-05.yml
432
457
  - lib/aws/api_config/EC2-2011-12-15.yml
433
458
  - lib/aws/api_config/ELB-2011-08-15.yml
@@ -472,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
472
497
  requirements: []
473
498
 
474
499
  rubyforge_project:
475
- rubygems_version: 1.8.15
500
+ rubygems_version: 1.8.21
476
501
  signing_key:
477
502
  specification_version: 3
478
503
  summary: AWS SDK for Ruby
@@ -1,133 +0,0 @@
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
- require 'benchmark'
15
-
16
- module AWS
17
- module Core
18
-
19
- # @private
20
- module ClientLogging
21
-
22
- def log_client_request(name, options)
23
- response = nil
24
- time = Benchmark.measure do
25
- response = yield
26
- end
27
-
28
- if config.logger
29
- if options[:async]
30
- response.on_complete do
31
- log_client_request_on_success(name, options, response, time)
32
- end
33
- else
34
- log_client_request_on_success(name, options, response, time)
35
- end
36
- end
37
- response
38
- end
39
-
40
- # Summarizes long strings and adds file size information
41
- # @private
42
- def sanitize_options(options)
43
- sanitize_hash(options)
44
- end
45
-
46
- protected
47
- def log severity, message
48
- config.logger.send(severity, message + "\n") if config.logger
49
- end
50
-
51
- protected
52
- def log_client_request_on_success(method_name, options, response, time)
53
- status = response.http_response.status
54
- service = self.class.service_name
55
-
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
-
65
- severity = :info
66
-
67
- if response.error
68
- pattern += " %s: %s"
69
- parts << response.error.class
70
- parts << response.error.message
71
- severity = :error
72
- end
73
-
74
- if response.cached
75
- pattern << " [CACHED]"
76
- end
77
-
78
- log(severity, pattern % parts)
79
- end
80
-
81
- protected
82
- def sanitize_value(value)
83
- case value
84
- when Hash
85
- '{' + sanitize_hash(value) + '}'
86
- when Array
87
- sanitize_array(value)
88
- when File
89
- sanitize_file(value)
90
- when String
91
- sanitize_string(value)
92
- else
93
- value.inspect
94
- end
95
- end
96
-
97
- protected
98
- def sanitize_string str
99
- inspected = str.inspect
100
- if inspected.size > config.logger_truncate_strings_at
101
- summarize_string(str)
102
- else
103
- inspected
104
- end
105
- end
106
-
107
- protected
108
- def summarize_string str
109
- # skip the openning "
110
- string_start = str.inspect[1,config.logger_truncate_strings_at]
111
- "#<String \"#{string_start}\" ... (#{str.size} characters)>"
112
- end
113
-
114
- protected
115
- def sanitize_file file
116
- "#<File:#{file.path} (#{File.size(file.path)} bytes)>"
117
- end
118
-
119
- protected
120
- def sanitize_array array
121
- "[" + array.map { |v| sanitize_value(v) }.join(",") + "]"
122
- end
123
-
124
- protected
125
- def sanitize_hash hash
126
- hash.map do |k,v|
127
- "#{sanitize_value(k)}=>#{sanitize_value(v)}"
128
- end.sort.join(",")
129
- end
130
-
131
- end
132
- end
133
- end