aws-sdk 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,7 +56,7 @@ require 'aws/core/autoloader'
56
56
  module AWS
57
57
 
58
58
  # Current version of the AWS SDK for Ruby
59
- VERSION = "1.2.2"
59
+ VERSION = "1.2.3"
60
60
 
61
61
  register_autoloads(self) do
62
62
  autoload :Errors, 'errors'
@@ -463,6 +463,13 @@ module AWS
463
463
  images.create(options.merge(:instance_id => id, :name => name))
464
464
  end
465
465
 
466
+ # Retrieves the console output for the instance.
467
+ #
468
+ # @return [String] the console output.
469
+ def console_output
470
+ Base64.decode64(client.get_console_output(:instance_id => self.id).output)
471
+ end
472
+
466
473
  # Associates the elastic IP address with this instance.
467
474
  #
468
475
  # @param [ElasticIp,String] elastic_ip Either a public IP address
@@ -30,7 +30,7 @@ module AWS
30
30
  def each
31
31
  security_group.ip_permissions_list.each do |p|
32
32
 
33
- ports = [p.from_port, p.to_port]
33
+ ports = p.respond_to?(:from_port) ? [p.from_port, p.to_port] : nil
34
34
 
35
35
  ip_ranges = p.ip_ranges.collect{|ip| ip.cidr_ip }
36
36
 
@@ -20,13 +20,16 @@ module AWS
20
20
  module FinderMethods
21
21
 
22
22
  # @param [String] id The id of the record to load.
23
+ # @param [Hash] options
24
+ # @option options [String] :domain Specifies what domain
25
+ # should be searched.
23
26
  # @raise [RecordNotFound] Raises a record not found exception if there
24
27
  # was no data found for the given id.
25
28
  # @return [Record::Base] Returns the record, as a sub-class of
26
29
  # Record::Base
27
- def [] id
30
+ def find_by_id id, options = {}
28
31
 
29
- data = sdb_domain.items[id].data.attributes
32
+ data = sdb_domain(options[:domain]).items[id].data.attributes
30
33
 
31
34
  raise RecordNotFound, "no data found for id: #{id}" if data.empty?
32
35
 
@@ -35,6 +38,7 @@ module AWS
35
38
  obj
36
39
 
37
40
  end
41
+ alias_method :[], :find_by_id
38
42
 
39
43
  # Finds records in SimpleDB and returns them as objects of the
40
44
  # current class.
@@ -103,13 +103,8 @@ module AWS
103
103
  case
104
104
  when id_or_mode == :all then scope
105
105
  when id_or_mode == :first then scope.limit(1).first
106
- when scope.send(:_empty?) then base_class[id_or_mode]
107
106
  else
108
- object = scope.where('itemName() = ?', id_or_mode).limit(1).first
109
- if object.nil?
110
- raise RecordNotFound, "no data found for record `#{id_or_mode}`"
111
- end
112
- object
107
+ base_class.find_by_id(id_or_mode, :domain => scope._domain)
113
108
  end
114
109
 
115
110
  end
@@ -205,11 +200,10 @@ module AWS
205
200
  Enumerator.new(self, :"_each_object")
206
201
  end
207
202
  end
208
-
209
- # @private
210
- private
211
- def _empty?
212
- @options == {}
203
+
204
+ protected
205
+ def _domain
206
+ @options[:domain]
213
207
  end
214
208
 
215
209
  # @private
@@ -290,7 +284,7 @@ module AWS
290
284
  # @private
291
285
  private
292
286
  def _item_collection
293
- items = base_class.sdb_domain(@options[:domain]).items
287
+ items = base_class.sdb_domain(_domain).items
294
288
  items = items.order(*@options[:order]) if @options[:order]
295
289
  items = items.limit(*@options[:limit]) if @options[:limit]
296
290
  Record.as_array(@options[:where]).each do |where_condition|
@@ -178,6 +178,8 @@ module AWS
178
178
  # this option must match the total number of bytes written
179
179
  # to S3 during the operation. This option is required if
180
180
  # +:data+ is an IO-like object without a +size+ method.
181
+ #
182
+ # @option options [Integer] :part_number The part number.
181
183
  def add_part(data_or_options, options = {})
182
184
  if data_or_options.kind_of?(Hash)
183
185
  part_options = base_opts.merge(data_or_options)
@@ -781,6 +781,8 @@ module AWS
781
781
  req.add_param("AWSAccessKeyId", config.signer.access_key_id)
782
782
  req.add_param("Signature", signature(method, expires, req))
783
783
  req.add_param("Expires", expires)
784
+ req.add_param("x-amz-security-token", config.signer.session_token) if
785
+ config.signer.session_token
784
786
 
785
787
  build_uri(options[:secure] != false, req)
786
788
  end
@@ -791,7 +793,9 @@ module AWS
791
793
  #
792
794
  # @option options [Boolean] :secure Whether to generate a
793
795
  # secure (HTTPS) URL or a plain HTTP url.
796
+ #
794
797
  # @return [URI::HTTP, URI::HTTPS]
798
+ #
795
799
  def public_url(options = {})
796
800
  req = request_for_signing(options)
797
801
  build_uri(options[:secure] != false, req)
@@ -837,11 +841,20 @@ module AWS
837
841
  # @private
838
842
  private
839
843
  def signature(method, expires, request)
840
- string_to_sign = [method,
841
- "", "",
842
- expires,
843
- request.canonicalized_resource].join("\n")
844
+
845
+ parts = []
846
+ parts << method
847
+ parts << ""
848
+ parts << ""
849
+ parts << expires
850
+ parts << "x-amz-security-token:#{config.signer.session_token}" if
851
+ config.signer.session_token
852
+ parts << request.canonicalized_resource
853
+
854
+ string_to_sign = parts.join("\n")
855
+
844
856
  config.signer.sign(string_to_sign, "sha1")
857
+
845
858
  end
846
859
 
847
860
  # @private
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 2
10
- version: 1.2.2
9
+ - 3
10
+ version: 1.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Amazon Web Services
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-28 00:00:00 -07:00
18
+ date: 2011-11-11 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency