aws-sdk 1.9.1 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +249 -0
- data/lib/aws-sdk.rb +0 -68
- data/lib/aws/core.rb +187 -80
- data/lib/aws/core/client.rb +7 -2
- data/lib/aws/core/configuration.rb +0 -4
- data/lib/aws/core/deprecations.rb +84 -0
- data/lib/aws/core/region.rb +7 -0
- data/lib/aws/ec2/subnet.rb +1 -1
- data/lib/aws/elastic_beanstalk.rb +1 -1
- data/lib/aws/elastic_transcoder.rb +1 -1
- data/lib/aws/version.rb +1 -1
- metadata +4 -7
- data/README.rdoc +0 -197
- data/lib/aws/api_config/CloudFront-2012-05-05.yml +0 -2102
- data/lib/aws/api_config/ElastiCache-2012-03-09.yml +0 -777
- data/lib/aws/api_config/RDS-2012-09-17.yml +0 -1861
- data/lib/aws/api_config/Route53-2012-02-29.yml +0 -380
data/lib/aws/core/client.rb
CHANGED
@@ -22,6 +22,8 @@ module AWS
|
|
22
22
|
# Base client class for all of the Amazon AWS service clients.
|
23
23
|
class Client
|
24
24
|
|
25
|
+
extend Deprecations
|
26
|
+
|
25
27
|
# Raised when a request failed due to a networking issue (e.g.
|
26
28
|
# EOFError, IOError, Errno::ECONNRESET, Errno::EPIPE,
|
27
29
|
# Timeout::Error, etc)
|
@@ -59,8 +61,9 @@ module AWS
|
|
59
61
|
@http_handler = @config.http_handler
|
60
62
|
@endpoint = config.send(:"#{service_ruby_name}_endpoint")
|
61
63
|
@port = config.send(:"#{service_ruby_name}_port")
|
62
|
-
@http_read_timeout = @config.http_read_timeout
|
63
64
|
|
65
|
+
# deprecated attributes
|
66
|
+
@http_read_timeout = @config.http_read_timeout
|
64
67
|
end
|
65
68
|
|
66
69
|
# @return [Configuration] This clients configuration.
|
@@ -82,7 +85,9 @@ module AWS
|
|
82
85
|
|
83
86
|
# @return [Integer] The number of seconds before requests made by
|
84
87
|
# this client should timeout if they have not received a response.
|
88
|
+
# @api private
|
85
89
|
attr_reader :http_read_timeout
|
90
|
+
deprecated :http_read_timeout, :use => 'config.http_read_timeout'
|
86
91
|
|
87
92
|
# @return [String] Returns the service endpoint (hostname) this client
|
88
93
|
# makes requests against.
|
@@ -528,7 +533,7 @@ module AWS
|
|
528
533
|
|
529
534
|
# configure the http request
|
530
535
|
http_request.service_ruby_name = service_ruby_name
|
531
|
-
http_request.default_read_timeout = http_read_timeout
|
536
|
+
http_request.default_read_timeout = @config.http_read_timeout
|
532
537
|
http_request.host = endpoint
|
533
538
|
http_request.port = port
|
534
539
|
http_request.region = config.send(:"#{service_ruby_name}_region")
|
@@ -376,10 +376,6 @@ module AWS
|
|
376
376
|
|
377
377
|
def add_service name, ruby_name, endpoint_pattern = nil, &endpoint_builder
|
378
378
|
|
379
|
-
Region.send(:define_method, ruby_name) do
|
380
|
-
AWS.const_get(name).new(:config => config)
|
381
|
-
end
|
382
|
-
|
383
379
|
add_option :"#{ruby_name}_endpoint" do |config,value|
|
384
380
|
if value
|
385
381
|
value
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Copyright 2011-2013 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
|
+
module Core
|
16
|
+
|
17
|
+
# A utility module that provides a class method that wraps
|
18
|
+
# a method such that it generates a deprecation warning when called.
|
19
|
+
# Given the following class:
|
20
|
+
#
|
21
|
+
# class Example
|
22
|
+
#
|
23
|
+
# def do_something
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# If you want to deprecate the `#do_something` method, you can extend
|
29
|
+
# this module and then call `deprecated` on the method (after it
|
30
|
+
# has been defined).
|
31
|
+
#
|
32
|
+
# class Example
|
33
|
+
#
|
34
|
+
# extend AWS::Core::Deprecations
|
35
|
+
#
|
36
|
+
# def do_something
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# def do_something_else
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# deprecated :do_something
|
43
|
+
#
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# The `#do_something` method will continue to function, but will
|
47
|
+
# generate a deprecation warning when called.
|
48
|
+
#
|
49
|
+
# @api private
|
50
|
+
module Deprecations
|
51
|
+
|
52
|
+
# @param [Symbol] method The name of the deprecated method.
|
53
|
+
#
|
54
|
+
# @option options [String] :message The warning message to issue
|
55
|
+
# when the deprecated method is called.
|
56
|
+
#
|
57
|
+
# @option options [Symbol] :use The name of an use
|
58
|
+
# method that should be used.
|
59
|
+
#
|
60
|
+
def deprecated method, options = {}
|
61
|
+
|
62
|
+
deprecation_msg = options[:message] || begin
|
63
|
+
msg = "DEPRECATION WARNING: called deprecated method `#{method}' "
|
64
|
+
msg << "of #{self.name}"
|
65
|
+
msg << ", try calling #{options[:use]} instead" if options[:use]
|
66
|
+
msg
|
67
|
+
end
|
68
|
+
|
69
|
+
alias_method(:"deprecated_#{method}", method)
|
70
|
+
|
71
|
+
warned = false # we only want to issue this warning once
|
72
|
+
|
73
|
+
define_method(method) do |*args,&block|
|
74
|
+
unless warned
|
75
|
+
warn(deprecation_msg)
|
76
|
+
warned = true
|
77
|
+
end
|
78
|
+
send("deprecated_#{method}", *args, &block)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
data/lib/aws/core/region.rb
CHANGED
@@ -29,6 +29,7 @@ module AWS
|
|
29
29
|
# @attr_reader [CloudWatch] cloud_watch
|
30
30
|
# @attr_reader [DynamoDB] dynamo_db
|
31
31
|
# @attr_reader [DataPipeline] data_pipeline
|
32
|
+
# @attr_reader [DirectConnect] direct_connect
|
32
33
|
# @attr_reader [EC2] ec2
|
33
34
|
# @attr_reader [ElastiCache] elasticache
|
34
35
|
# @attr_reader [ElasticBeanstalk] elastic_beanstalk
|
@@ -67,6 +68,12 @@ module AWS
|
|
67
68
|
# @return [Configuration]
|
68
69
|
attr_reader :config
|
69
70
|
|
71
|
+
AWS::SERVICES.each_pair do |name,service|
|
72
|
+
define_method(service[:ruby_name]) do
|
73
|
+
AWS.const_get(name).new(:config => config)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
70
77
|
end
|
71
78
|
end
|
72
79
|
end
|
data/lib/aws/ec2/subnet.rb
CHANGED
@@ -79,7 +79,7 @@ module AWS
|
|
79
79
|
# this subnet and its network ACL.
|
80
80
|
def network_acl_association
|
81
81
|
associations = AWS.memoize { vpc.network_acls.map(&:associations) }.flatten
|
82
|
-
associations.
|
82
|
+
associations.find{|a| a.subnet == self }
|
83
83
|
end
|
84
84
|
|
85
85
|
# @return [RouteTable] Returns the route table currently associated
|
data/lib/aws/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uuidtools
|
@@ -68,7 +68,7 @@ files:
|
|
68
68
|
- ca-bundle.crt
|
69
69
|
- rails/init.rb
|
70
70
|
- .yardopts
|
71
|
-
- README.
|
71
|
+
- README.md
|
72
72
|
- LICENSE.txt
|
73
73
|
- lib/aws/auto_scaling/activity.rb
|
74
74
|
- lib/aws/auto_scaling/activity_collection.rb
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/aws/core/configuration.rb
|
142
142
|
- lib/aws/core/credential_providers.rb
|
143
143
|
- lib/aws/core/data.rb
|
144
|
+
- lib/aws/core/deprecations.rb
|
144
145
|
- lib/aws/core/http/connection_pool.rb
|
145
146
|
- lib/aws/core/http/curb_handler.rb
|
146
147
|
- lib/aws/core/http/handler.rb
|
@@ -581,7 +582,6 @@ files:
|
|
581
582
|
- lib/aws.rb
|
582
583
|
- lib/aws/api_config/AutoScaling-2011-01-01.yml
|
583
584
|
- lib/aws/api_config/CloudFormation-2010-05-15.yml
|
584
|
-
- lib/aws/api_config/CloudFront-2012-05-05.yml
|
585
585
|
- lib/aws/api_config/CloudFront-2012-07-01.yml
|
586
586
|
- lib/aws/api_config/CloudSearch-2011-02-01.yml
|
587
587
|
- lib/aws/api_config/CloudWatch-2010-08-01.yml
|
@@ -590,7 +590,6 @@ files:
|
|
590
590
|
- lib/aws/api_config/DynamoDB-2011-12-05.yml
|
591
591
|
- lib/aws/api_config/DynamoDB-2012-08-10.yml
|
592
592
|
- lib/aws/api_config/EC2-2013-02-01.yml
|
593
|
-
- lib/aws/api_config/ElastiCache-2012-03-09.yml
|
594
593
|
- lib/aws/api_config/ElastiCache-2012-11-15.yml
|
595
594
|
- lib/aws/api_config/ElasticBeanstalk-2010-12-01.yml
|
596
595
|
- lib/aws/api_config/ElasticTranscoder-2012-09-25.yml
|
@@ -600,10 +599,8 @@ files:
|
|
600
599
|
- lib/aws/api_config/IAM-2010-05-08.yml
|
601
600
|
- lib/aws/api_config/ImportExport-2010-06-01.yml
|
602
601
|
- lib/aws/api_config/OpsWorks-2013-02-18.yml
|
603
|
-
- lib/aws/api_config/RDS-2012-09-17.yml
|
604
602
|
- lib/aws/api_config/RDS-2013-02-12.yml
|
605
603
|
- lib/aws/api_config/Redshift-2012-12-01.yml
|
606
|
-
- lib/aws/api_config/Route53-2012-02-29.yml
|
607
604
|
- lib/aws/api_config/Route53-2012-12-12.yml
|
608
605
|
- lib/aws/api_config/SimpleDB-2009-04-15.yml
|
609
606
|
- lib/aws/api_config/SimpleEmailService-2010-12-01.yml
|
data/README.rdoc
DELETED
@@ -1,197 +0,0 @@
|
|
1
|
-
= Links of Interest
|
2
|
-
|
3
|
-
* {API Documentation}[http://docs.aws.amazon.com/AWSRubySDK/latest/frames.html]
|
4
|
-
* {Issues}[http://github.com/aws/aws-sdk-ruby/issues]
|
5
|
-
* {Release Notes}[http://aws.amazon.com/releasenotes/Ruby]
|
6
|
-
* {Forums}[https://forums.aws.amazon.com/forum.jspa?forumID=125]
|
7
|
-
* {License}[http://aws.amazon.com/apache2.0/]
|
8
|
-
|
9
|
-
= Getting Started with the AWS SDK for Ruby {<img src="https://secure.travis-ci.org/aws/aws-sdk-ruby.png?branch=master" alt="Build Status" />}[http://travis-ci.org/aws/aws-sdk-ruby]
|
10
|
-
|
11
|
-
The AWS SDK for Ruby helps you to get started building applications
|
12
|
-
using AWS infrastructure services, including Amazon Simple Storage
|
13
|
-
Service (Amazon S3), Amazon Elastic Compute Cloud (Amazon EC2), Amazon
|
14
|
-
SimpleDB, and more. This guide shows how you can start building Ruby
|
15
|
-
and Rails applications on the Amazon Web Services platform with the
|
16
|
-
AWS Ruby gem.
|
17
|
-
|
18
|
-
= Get Set Up
|
19
|
-
|
20
|
-
To get set up, you must sign up for Amazon Web Services, get your AWS
|
21
|
-
credentials, and set up your environment.
|
22
|
-
|
23
|
-
== Sign Up for AWS Products
|
24
|
-
|
25
|
-
Before you can begin, you must sign up for each AWS product you want
|
26
|
-
to use. The sample included in the SDK uses Amazon S3, so we'll use
|
27
|
-
that product as an example here.
|
28
|
-
|
29
|
-
=== To sign up for a product
|
30
|
-
|
31
|
-
1. Go to the home page for the product, for example
|
32
|
-
http://aws.amazon.com/s3.
|
33
|
-
|
34
|
-
*Tip:* Go to http://aws.amazon.com/products for a list of links to all our products.
|
35
|
-
|
36
|
-
2. Click the sign-up button on the top right corner of the page.
|
37
|
-
|
38
|
-
3. Follow the on-screen instructions. If you don't already have an AWS
|
39
|
-
account, you are prompted to create one as part of the sign-up
|
40
|
-
process.
|
41
|
-
|
42
|
-
AWS sends you a confirmation e-mail after the sign-up process is
|
43
|
-
complete. You can view your current account activity or manage your
|
44
|
-
account at any time, by going to http://aws.amazon.com and clicking
|
45
|
-
the *Account* tab.
|
46
|
-
|
47
|
-
== Get Your Credentials
|
48
|
-
|
49
|
-
To use the AWS SDK for Ruby, you need your AWS Access Key ID and Secret Access Key.
|
50
|
-
|
51
|
-
=== To get your AWS Access Key ID and Secret Access Key
|
52
|
-
|
53
|
-
1. Go to http://aws.amazon.com.
|
54
|
-
|
55
|
-
2. Click *Account* and then click <b>Security Credentials</b>.
|
56
|
-
The Security Credentials page displays (you might be prompted to log in).
|
57
|
-
|
58
|
-
3. Scroll down to Access Credentials and make sure the <b>Access Keys</b> tab
|
59
|
-
is selected. The AWS Access Key ID appears in the Access Key column.
|
60
|
-
|
61
|
-
4. To view the Secret Access Key, click *Show*.
|
62
|
-
|
63
|
-
*Important!* Your Secret Access Key is a secret, which only you and
|
64
|
-
AWS should know. It is important to keep it confidential to protect
|
65
|
-
your account. Store it securely in a safe place. Never include it in
|
66
|
-
your requests to AWS, and never e-mail it to anyone. Do not share it
|
67
|
-
outside your organization, even if an inquiry appears to come from AWS
|
68
|
-
or Amazon.com. No one who legitimately represents Amazon will ever ask
|
69
|
-
you for your Secret Access Key.
|
70
|
-
|
71
|
-
== Set Up Your Environment
|
72
|
-
|
73
|
-
The AWS Ruby gem runs on Ruby 1.8.7 and later. If you have an older
|
74
|
-
version of Ruby, RVM is a great way to get started using the latest
|
75
|
-
version.
|
76
|
-
|
77
|
-
= Install the SDK
|
78
|
-
|
79
|
-
To install the AWS Ruby gem, just enter:
|
80
|
-
|
81
|
-
gem install aws-sdk
|
82
|
-
|
83
|
-
= Run the Samples
|
84
|
-
|
85
|
-
Now that you've installed the gem, you can run the samples, which you
|
86
|
-
can find in our GitHub repository:
|
87
|
-
|
88
|
-
$ git clone git://github.com/aws/aws-sdk-ruby
|
89
|
-
$ cd aws-sdk-ruby/samples/
|
90
|
-
|
91
|
-
The subdirectories of the +samples+ directory contain several code
|
92
|
-
samples that you can run. These samples demonstrate basic usage of
|
93
|
-
the SDK features.
|
94
|
-
|
95
|
-
== To run the Amazon S3 Sample
|
96
|
-
|
97
|
-
1. Create a file named config.yml in the samples directory as follows:
|
98
|
-
|
99
|
-
# Fill in your AWS Access Key ID and Secret Access Key
|
100
|
-
# http://aws.amazon.com/security-credentials
|
101
|
-
access_key_id: REPLACE_WITH_ACCESS_KEY_ID
|
102
|
-
secret_access_key: REPLACE_WITH_SECRET_ACCESS_KEY
|
103
|
-
|
104
|
-
2. Run a sample script with the Ruby interpreter. For example, to run
|
105
|
-
the s3/upload_file.rb sample:
|
106
|
-
|
107
|
-
$ echo "Hello, World!" > helloworld.txt
|
108
|
-
$ ruby s3/upload_file.rb unique-bucket-name helloworld.txt
|
109
|
-
|
110
|
-
== To use the AWS ORM in a Rails 3 application
|
111
|
-
|
112
|
-
1. Install the gem:
|
113
|
-
|
114
|
-
$ gem install aws-sdk
|
115
|
-
|
116
|
-
2. Start a new Rails project:
|
117
|
-
|
118
|
-
$ gem install rails
|
119
|
-
$ rails new myapp
|
120
|
-
$ cd myapp/
|
121
|
-
|
122
|
-
3. Add the following line to your Gemfile:
|
123
|
-
|
124
|
-
gem 'aws-sdk'
|
125
|
-
|
126
|
-
4. Install dependencies:
|
127
|
-
|
128
|
-
$ bundle install
|
129
|
-
|
130
|
-
5. Create config/aws.yml as follows:
|
131
|
-
|
132
|
-
# Fill in your AWS Access Key ID and Secret Access Key
|
133
|
-
# http://aws.amazon.com/security-credentials
|
134
|
-
access_key_id: REPLACE_WITH_ACCESS_KEY_ID
|
135
|
-
secret_access_key: REPLACE_WITH_SECRET_ACCESS_KEY
|
136
|
-
|
137
|
-
6. Create config/initializers/aws.rb as follows:
|
138
|
-
|
139
|
-
# load the libraries
|
140
|
-
require 'aws-sdk'
|
141
|
-
# log requests using the default rails logger
|
142
|
-
AWS.config(:logger => Rails.logger)
|
143
|
-
# load credentials from a file
|
144
|
-
config_path = File.expand_path(File.dirname(__FILE__)+"/../aws.yml")
|
145
|
-
AWS.config(YAML.load(File.read(config_path)))
|
146
|
-
|
147
|
-
7. Create app/models/my_record.rb as follows:
|
148
|
-
|
149
|
-
class MyRecord < AWS::Record::Base
|
150
|
-
string_attr :name
|
151
|
-
end
|
152
|
-
|
153
|
-
8. Create the SimpleDB domain:
|
154
|
-
|
155
|
-
$ rails console
|
156
|
-
> MyRecord.create_domain
|
157
|
-
|
158
|
-
Now, you can play around with the model by creating some records and querying them:
|
159
|
-
|
160
|
-
> MyRecord.find(:all).to_a
|
161
|
-
=> []
|
162
|
-
> MyRecord.new(:name => "The first one").save
|
163
|
-
=> true
|
164
|
-
> MyRecord.new(:name => "The second one").save
|
165
|
-
=> true
|
166
|
-
> MyRecord.where('name like ?', "%first%").count
|
167
|
-
=> 1
|
168
|
-
|
169
|
-
Exit the rails console before continuing to the next step:
|
170
|
-
|
171
|
-
> exit
|
172
|
-
|
173
|
-
9. Generate a scaffold controller for your model:
|
174
|
-
|
175
|
-
$ rails generate scaffold_controller MyRecord name:string
|
176
|
-
$ rails server
|
177
|
-
|
178
|
-
10. Add a route to your scaffold controller in config/routes.rb:
|
179
|
-
|
180
|
-
Myapp::Application.routes.draw do
|
181
|
-
# add this line:
|
182
|
-
resources :my_records
|
183
|
-
end
|
184
|
-
|
185
|
-
11. Now, you can create records in the browser at http://localhost:3000/my_records.
|
186
|
-
|
187
|
-
= Where Do I Go from Here?
|
188
|
-
|
189
|
-
For more information about the AWS SDK for Ruby, including a complete
|
190
|
-
list of supported AWS products, go to
|
191
|
-
http://aws.amazon.com/sdkforruby.
|
192
|
-
|
193
|
-
The SDK reference documentation provides information about both the
|
194
|
-
AWS Ruby gem and AWS Rails integration gem. You can find it at
|
195
|
-
http://docs.amazonwebservices.com/AWSRubySDK/latest.
|
196
|
-
|
197
|
-
Licensed under Apache 2.0. See {file:LICENSE.txt} and {file:NOTICE.txt} files.
|