aws-sdk-core 2.0.0.rc15 → 2.0.0.rc16
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.
- checksums.yaml +4 -4
- data/apis/DynamoDB.paginators.json +0 -1
- data/apis/EC2.resources.json +16 -0
- data/apis/ElasticBeanstalk.api.json +4 -1
- data/apis/Glacier.resources.json +5 -9
- data/apis/IAM.resources.json +1 -1
- data/apis/Kinesis.api.json +158 -0
- data/apis/Kinesis.paginators.json +0 -6
- data/apis/OpsWorks.api.json +36 -5
- data/apis/OpsWorks.resources.json +181 -0
- data/apis/S3.resources.json +13 -2
- data/apis/SQS.resources.json +0 -10
- data/bin/aws.rb +9 -0
- data/lib/aws.rb +30 -1
- data/lib/aws/api/docstrings.rb +35 -0
- data/lib/aws/api/documenter.rb +31 -28
- data/lib/aws/client.rb +83 -0
- data/lib/aws/credential_provider_chain.rb +3 -1
- data/lib/aws/errors.rb +16 -7
- data/lib/aws/pageable_response.rb +1 -1
- data/lib/aws/plugins/csd_conditional_signing.rb +5 -0
- data/lib/aws/plugins/response_paging.rb +9 -3
- data/lib/aws/plugins/s3_url_encoded_keys.rb +7 -7
- data/lib/aws/query/handler.rb +4 -5
- data/lib/aws/version.rb +1 -1
- data/lib/aws/waiters/errors.rb +30 -0
- data/lib/aws/waiters/null_provider.rb +12 -0
- data/lib/aws/waiters/provider.rb +54 -0
- data/lib/aws/waiters/waiter.rb +194 -0
- data/lib/aws/xml/default_list.rb +10 -0
- data/lib/aws/xml/parser.rb +6 -1
- data/lib/seahorse.rb +0 -2
- data/lib/seahorse/client/base.rb +45 -20
- data/lib/seahorse/client/handler_list.rb +7 -0
- data/lib/seahorse/client/param_converter.rb +2 -2
- data/lib/seahorse/client/plugins/restful_bindings.rb +1 -1
- data/lib/seahorse/client/request.rb +1 -1
- data/lib/seahorse/client/response.rb +0 -2
- data/lib/seahorse/model/shapes.rb +6 -2
- metadata +15 -11
- data/LICENSE.txt +0 -12
- data/README.md +0 -301
- data/lib/seahorse/client/plugins/api.rb +0 -11
data/lib/aws/xml/parser.rb
CHANGED
@@ -30,7 +30,11 @@ module Aws
|
|
30
30
|
target = Structure.new(structure.member_names) if target.nil?
|
31
31
|
structure.members.each do |member_name, member_shape|
|
32
32
|
value_key = member_key(member_shape) || member_name.to_s
|
33
|
-
|
33
|
+
if values.key?(value_key)
|
34
|
+
target[member_name] = parse_shape(member_shape, values[value_key])
|
35
|
+
elsif member_shape.is_a?(Seahorse::Model::Shapes::List)
|
36
|
+
target[member_name] = DefaultList.new
|
37
|
+
end
|
34
38
|
end
|
35
39
|
target
|
36
40
|
end
|
@@ -78,6 +82,7 @@ module Aws
|
|
78
82
|
when Seahorse::Model::Shapes::Structure then nil
|
79
83
|
when Seahorse::Model::Shapes::Map then {}
|
80
84
|
when Seahorse::Model::Shapes::List then []
|
85
|
+
when Seahorse::Model::Shapes::String then ''
|
81
86
|
else nil
|
82
87
|
end
|
83
88
|
else
|
data/lib/seahorse.rb
CHANGED
@@ -40,13 +40,11 @@ module Seahorse
|
|
40
40
|
end
|
41
41
|
|
42
42
|
module Plugins
|
43
|
-
autoload :Api, 'seahorse/client/plugins/api'
|
44
43
|
autoload :ContentLength, 'seahorse/client/plugins/content_length'
|
45
44
|
autoload :Endpoint, 'seahorse/client/plugins/endpoint'
|
46
45
|
autoload :JsonSimple, 'seahorse/client/plugins/json_simple'
|
47
46
|
autoload :Logging, 'seahorse/client/plugins/logging'
|
48
47
|
autoload :NetHttp, 'seahorse/client/plugins/net_http'
|
49
|
-
autoload :OperationMethods, 'seahorse/client/plugins/operation_methods'
|
50
48
|
autoload :ParamConversion, 'seahorse/client/plugins/param_conversion'
|
51
49
|
autoload :ParamValidation, 'seahorse/client/plugins/param_validation'
|
52
50
|
autoload :RaiseResponseErrors, 'seahorse/client/plugins/raise_response_errors'
|
data/lib/seahorse/client/base.rb
CHANGED
@@ -6,17 +6,10 @@ module Seahorse
|
|
6
6
|
|
7
7
|
include HandlerBuilder
|
8
8
|
|
9
|
-
# These plugins are applied to every client and can not be removed.
|
10
|
-
# @api private
|
11
|
-
REQUIRED_PLUGINS = [
|
12
|
-
Plugins::Api,
|
13
|
-
Plugins::Endpoint,
|
14
|
-
]
|
15
|
-
|
16
9
|
# default plugins
|
17
10
|
@plugins = PluginList.new([
|
11
|
+
Plugins::Endpoint,
|
18
12
|
Plugins::NetHttp,
|
19
|
-
Plugins::OperationMethods,
|
20
13
|
Plugins::ParamConversion,
|
21
14
|
Plugins::ParamValidation,
|
22
15
|
Plugins::RaiseResponseErrors,
|
@@ -25,7 +18,7 @@ module Seahorse
|
|
25
18
|
# @api private
|
26
19
|
def initialize(plugins, options)
|
27
20
|
@config = build_config(plugins, options)
|
28
|
-
@handlers =
|
21
|
+
@handlers = build_handler_list(plugins)
|
29
22
|
after_initialize(plugins)
|
30
23
|
end
|
31
24
|
|
@@ -56,28 +49,64 @@ module Seahorse
|
|
56
49
|
"#<#{self.class.name}>"
|
57
50
|
end
|
58
51
|
|
52
|
+
# @return [Array<Symbol>] Returns a list of valid request operation
|
53
|
+
# names. These are valid arguments to {#build_request} and are also
|
54
|
+
# valid methods.
|
55
|
+
def operation_names
|
56
|
+
self.class.api.operation_names
|
57
|
+
end
|
58
|
+
|
59
|
+
# @api private
|
60
|
+
def respond_to?(method_name, *args)
|
61
|
+
if request_method?(method_name)
|
62
|
+
true
|
63
|
+
else
|
64
|
+
super
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# @api private
|
69
|
+
def method_missing(method_name, *args, &block)
|
70
|
+
if request_method?(method_name)
|
71
|
+
make_request(method_name, *args, &block)
|
72
|
+
else
|
73
|
+
super
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
59
77
|
private
|
60
78
|
|
79
|
+
# @return [Boolean] Returns `true` if the method name is an API operation.t
|
80
|
+
def request_method?(method_name)
|
81
|
+
operation_names.include?(method_name.to_sym)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Builds and sends a request.
|
85
|
+
def make_request(name, *args, &block)
|
86
|
+
params = args[0] || {}
|
87
|
+
options = args[1] || {}
|
88
|
+
build_request(name, params).send_request(options, &block)
|
89
|
+
end
|
90
|
+
|
61
91
|
# Constructs a {Configuration} object and gives each plugin the
|
62
92
|
# opportunity to register options with default values.
|
63
93
|
def build_config(plugins, options)
|
64
|
-
options = options.merge(api: self.class.api) unless options[:api]
|
65
94
|
config = Configuration.new
|
95
|
+
config.add_option(:api)
|
66
96
|
plugins.each do |plugin|
|
67
97
|
plugin.add_options(config) if plugin.respond_to?(:add_options)
|
68
98
|
end
|
69
|
-
config.build!(options)
|
99
|
+
config.build!(options.merge(api: self.class.api))
|
70
100
|
end
|
71
101
|
|
72
102
|
# Gives each plugin the opportunity to register handlers for this client.
|
73
|
-
def
|
74
|
-
|
75
|
-
plugins.each do |plugin|
|
103
|
+
def build_handler_list(plugins)
|
104
|
+
plugins.inject(HandlerList.new) do |handlers, plugin|
|
76
105
|
if plugin.respond_to?(:add_handlers)
|
77
106
|
plugin.add_handlers(handlers, @config)
|
78
107
|
end
|
108
|
+
handlers
|
79
109
|
end
|
80
|
-
handlers
|
81
110
|
end
|
82
111
|
|
83
112
|
# Gives each plugin the opportunity to modify this client.
|
@@ -108,9 +137,6 @@ module Seahorse
|
|
108
137
|
client
|
109
138
|
end
|
110
139
|
|
111
|
-
# Used by plugins that modify the client class.
|
112
|
-
attr_reader :mutex
|
113
|
-
|
114
140
|
# Registers a plugin with this client.
|
115
141
|
#
|
116
142
|
# @example Register a plugin
|
@@ -172,7 +198,7 @@ module Seahorse
|
|
172
198
|
# @see .remove_plugin
|
173
199
|
# @return [Array<Plugin>]
|
174
200
|
def plugins
|
175
|
-
|
201
|
+
Array(@plugins).freeze
|
176
202
|
end
|
177
203
|
|
178
204
|
# @return [Model::Api]
|
@@ -218,7 +244,6 @@ module Seahorse
|
|
218
244
|
|
219
245
|
def inherited(subclass)
|
220
246
|
subclass.instance_variable_set('@plugins', PluginList.new(@plugins))
|
221
|
-
subclass.instance_variable_set("@mutex", Mutex.new)
|
222
247
|
end
|
223
248
|
|
224
249
|
end
|
@@ -112,6 +112,13 @@ module Seahorse
|
|
112
112
|
handler_class
|
113
113
|
end
|
114
114
|
|
115
|
+
# @param [Class<Handler>] handler_class
|
116
|
+
def remove(handler_class)
|
117
|
+
@entries.each do |key, entry|
|
118
|
+
@entries.delete(key) if entry.handler_class == handler_class
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
115
122
|
# Copies handlers from the `source_list` onto the current handler list.
|
116
123
|
# If a block is given, only the entries that return a `true` value
|
117
124
|
# from the block will be copied.
|
@@ -39,7 +39,7 @@ module Seahorse
|
|
39
39
|
def list(list, values)
|
40
40
|
values = c(list, values)
|
41
41
|
if values.is_a?(Array)
|
42
|
-
values.map { |v|
|
42
|
+
values.map { |v| member(list.member, v) }
|
43
43
|
else
|
44
44
|
values
|
45
45
|
end
|
@@ -49,7 +49,7 @@ module Seahorse
|
|
49
49
|
values = c(map, values)
|
50
50
|
if values.is_a?(Hash)
|
51
51
|
values.each.with_object({}) do |(key, value), hash|
|
52
|
-
hash[
|
52
|
+
hash[member(map.key, key)] = member(map.value, value)
|
53
53
|
end
|
54
54
|
else
|
55
55
|
values
|
@@ -68,7 +68,6 @@ module Seahorse
|
|
68
68
|
@type = definition['type']
|
69
69
|
@location = definition['location'] || 'body'
|
70
70
|
@location_name = definition['locationName']
|
71
|
-
@documentation = definition['documentation']
|
72
71
|
@shape_map = options[:shape_map] || ShapeMap.new
|
73
72
|
end
|
74
73
|
|
@@ -89,12 +88,16 @@ module Seahorse
|
|
89
88
|
# shape references, not on the shape definition.
|
90
89
|
attr_reader :location_name
|
91
90
|
|
92
|
-
# @return [String, nil]
|
93
91
|
attr_reader :documentation
|
94
92
|
|
95
93
|
# @return [ShapeMap]
|
96
94
|
attr_reader :shape_map
|
97
95
|
|
96
|
+
# @return [String, nil]
|
97
|
+
def documentation
|
98
|
+
@definition['documentation']
|
99
|
+
end
|
100
|
+
|
98
101
|
# @param [String] key
|
99
102
|
# @return [Object, nil]
|
100
103
|
def metadata(key)
|
@@ -389,6 +392,7 @@ module Seahorse
|
|
389
392
|
case format
|
390
393
|
when 'iso8601' then time.utc.iso8601
|
391
394
|
when 'rfc822' then time.utc.rfc822
|
395
|
+
when 'httpdate' then time.httpdate
|
392
396
|
when 'unixTimestamp' then time.utc.to_i
|
393
397
|
else
|
394
398
|
msg = "invalid timestamp format #{format.inspect}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Amazon Web Services
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -56,27 +56,26 @@ dependencies:
|
|
56
56
|
name: jamespath
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.5.1
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
69
|
-
description: Provides
|
68
|
+
version: 0.5.1
|
69
|
+
description: Provides API clients for AWS.
|
70
70
|
email:
|
71
71
|
executables:
|
72
72
|
- aws.rb
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- README.md
|
77
|
-
- LICENSE.txt
|
78
76
|
- endpoints.json
|
79
77
|
- lib/aws/api/customizer.rb
|
78
|
+
- lib/aws/api/docstrings.rb
|
80
79
|
- lib/aws/api/documenter.rb
|
81
80
|
- lib/aws/api/operation_documenter.rb
|
82
81
|
- lib/aws/api/operation_example.rb
|
@@ -148,7 +147,12 @@ files:
|
|
148
147
|
- lib/aws/structure.rb
|
149
148
|
- lib/aws/tree_hash.rb
|
150
149
|
- lib/aws/version.rb
|
150
|
+
- lib/aws/waiters/errors.rb
|
151
|
+
- lib/aws/waiters/null_provider.rb
|
152
|
+
- lib/aws/waiters/provider.rb
|
153
|
+
- lib/aws/waiters/waiter.rb
|
151
154
|
- lib/aws/xml/builder.rb
|
155
|
+
- lib/aws/xml/default_list.rb
|
152
156
|
- lib/aws/xml/error_handler.rb
|
153
157
|
- lib/aws/xml/parser.rb
|
154
158
|
- lib/aws/xml/rest_handler.rb
|
@@ -175,7 +179,6 @@ files:
|
|
175
179
|
- lib/seahorse/client/param_validator.rb
|
176
180
|
- lib/seahorse/client/plugin.rb
|
177
181
|
- lib/seahorse/client/plugin_list.rb
|
178
|
-
- lib/seahorse/client/plugins/api.rb
|
179
182
|
- lib/seahorse/client/plugins/content_length.rb
|
180
183
|
- lib/seahorse/client/plugins/endpoint.rb
|
181
184
|
- lib/seahorse/client/plugins/json_simple.rb
|
@@ -249,6 +252,7 @@ files:
|
|
249
252
|
- apis/Kinesis.paginators.json
|
250
253
|
- apis/OpsWorks.api.json
|
251
254
|
- apis/OpsWorks.paginators.json
|
255
|
+
- apis/OpsWorks.resources.json
|
252
256
|
- apis/RDS.api.json
|
253
257
|
- apis/RDS.paginators.json
|
254
258
|
- apis/RDS.waiters.json
|
@@ -304,6 +308,6 @@ rubyforge_project:
|
|
304
308
|
rubygems_version: 2.1.11
|
305
309
|
signing_key:
|
306
310
|
specification_version: 4
|
307
|
-
summary: AWS SDK Core
|
311
|
+
summary: AWS SDK for Ruby - Core
|
308
312
|
test_files: []
|
309
313
|
has_rdoc:
|
data/LICENSE.txt
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
Copyright 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.
|
data/README.md
DELETED
@@ -1,301 +0,0 @@
|
|
1
|
-
# AWS SDK for Ruby V2 [](https://travis-ci.org/aws/aws-sdk-core-ruby) [](https://codeclimate.com/github/aws/aws-sdk-core-ruby) [](https://coveralls.io/r/aws/aws-sdk-core-ruby?branch=master)
|
2
|
-
|
3
|
-
This library is in a developer preview period.
|
4
|
-
|
5
|
-
We are working on version 2 of the official AWS SDK for Ruby. This library
|
6
|
-
is the first part of our v2 strategy. AWS SDK Core is an updated set of
|
7
|
-
service clients. Our goal is to make them more flexible and extensible
|
8
|
-
than the clients in version 1 of the Ruby SDK.
|
9
|
-
|
10
|
-
For version 1.0 of the Ruby SDK, see [aws/aws-sdk-ruby](http://github.com/aws/aws-sdk-ruby).
|
11
|
-
|
12
|
-
## Upgrade Notes
|
13
|
-
|
14
|
-
During the preview period, there have been some minor backwards incompatible
|
15
|
-
updates between release candidates. These changes are summarized below.
|
16
|
-
|
17
|
-
### 2.0.0.rc15 Upgrading Notes
|
18
|
-
|
19
|
-
RC15 updates the `Aws::DynamoDB::Client` API operations to accept and return
|
20
|
-
simple attribute values. Prior to rc14 values were specified as:
|
21
|
-
|
22
|
-
{ s: 'string-value' }
|
23
|
-
{ n: "5.0" }
|
24
|
-
|
25
|
-
This update applies a plugin that allows users to specify values using simple
|
26
|
-
Ruby types, such as Integer, Float, Set, String, etc.
|
27
|
-
|
28
|
-
"string-value"
|
29
|
-
5.0
|
30
|
-
|
31
|
-
This affects **every** DynamoDB request and response structure
|
32
|
-
that accepts or returns an attribute value. To revert to the older format,
|
33
|
-
disable simple attributes:
|
34
|
-
|
35
|
-
# disable this new default behavior
|
36
|
-
Aws::DynamoDB::Client.new(simple_attributes: false)
|
37
|
-
|
38
|
-
**Please Note** - RC15 may be the final release candidate version prior to
|
39
|
-
a 2.0.0 final release of `aws-sdk-core`.
|
40
|
-
|
41
|
-
### 2.0.0.rc14 Upgrading Notes
|
42
|
-
|
43
|
-
RC14 simplifies the API versioning strategy. This may require small changes for
|
44
|
-
users that use the API version locking options. Also, there are minor changes
|
45
|
-
when configuring raw endpoints.
|
46
|
-
|
47
|
-
* Versioned client classes removed, e.g. `Aws::S3::Client::V20060301.new` should
|
48
|
-
be replaced with `Aws::S3::Client.new` The `:api_version` constructor option
|
49
|
-
is no longer accepted.
|
50
|
-
|
51
|
-
* Aws helper methods for client construction deprecated; For example,
|
52
|
-
calling `Aws.s3` will generate a deprecation warning. Call `Aws::S3::Client.new`
|
53
|
-
instead. Top-level helpers will be removed as of v2.0.0 final.
|
54
|
-
|
55
|
-
* When configuring an `:endpoint` directly, you must now specify the
|
56
|
-
HTTP scheme, e.g. "http://localhost:3000", instead of "localhost:3000".
|
57
|
-
Please note, this should only be done for testing. Normally you only
|
58
|
-
need to configure a `:region`.
|
59
|
-
|
60
|
-
### 2.0.0.rc11 Upgrading Notes
|
61
|
-
|
62
|
-
RC 11 requires a few minor updates. These should be the final public-facing
|
63
|
-
changes before 2.0.0 final.
|
64
|
-
|
65
|
-
* The prefered constructor for services is now using the client
|
66
|
-
class, example:
|
67
|
-
|
68
|
-
# deprecated, will be removed for 2.0.0 final
|
69
|
-
Aws::S3.new
|
70
|
-
|
71
|
-
# preferred
|
72
|
-
Aws::S3::Client.new
|
73
|
-
|
74
|
-
* The `:raw_json` option for JSON protocol based services has been
|
75
|
-
renamed to `:simple_json`
|
76
|
-
|
77
|
-
* The short name for Aws::SimpleDB has been renamed from `sdb` to
|
78
|
-
`simpledb`.
|
79
|
-
|
80
|
-
## Links of Interest
|
81
|
-
|
82
|
-
* [Documentation](http://docs.amazonwebservices.com/sdkforruby/api/frames.html)
|
83
|
-
* [Release Notes](http://aws.amazon.com/releasenotes/SDK/Ruby/Core)
|
84
|
-
* [Issues](http://github.com/aws/aws-sdk-core-ruby/issues)
|
85
|
-
* [Forums](https://forums.aws.amazon.com/forum.jspa?forumID=125)
|
86
|
-
* [License](http://aws.amazon.com/apache2.0/)
|
87
|
-
|
88
|
-
## Installation
|
89
|
-
|
90
|
-
You can install the AWS SDK Core from rubygems:
|
91
|
-
|
92
|
-
gem install aws-sdk-core --pre
|
93
|
-
|
94
|
-
If you are using Bundler, we recommend that you express a major version
|
95
|
-
dependency (this library uses [semantic versioning](http://semver.org/)):
|
96
|
-
|
97
|
-
gem 'aws-sdk-core', '~> 2.0'
|
98
|
-
|
99
|
-
Until the final release becomes available on Rubygems, leave off the version
|
100
|
-
dependency in your Gemfile so Bundler can find it.
|
101
|
-
|
102
|
-
**Note:** AWS SDK Core requires Ruby 1.9.3+.
|
103
|
-
|
104
|
-
## Configuration
|
105
|
-
|
106
|
-
To use the Ruby SDK, you must configure a region and your AWS account
|
107
|
-
access credentials.
|
108
|
-
|
109
|
-
### Region
|
110
|
-
|
111
|
-
You can export a default region to ENV:
|
112
|
-
|
113
|
-
```
|
114
|
-
export AWS_REGION='us-west-2'
|
115
|
-
```
|
116
|
-
|
117
|
-
Or you can configure a region in code:
|
118
|
-
|
119
|
-
```ruby
|
120
|
-
# default region
|
121
|
-
Aws.config[:region] = 'us-west-2'
|
122
|
-
|
123
|
-
# per-service :region
|
124
|
-
s3 = Aws::S3::Client.new(region:'us-east-1')
|
125
|
-
```
|
126
|
-
|
127
|
-
### Credentials
|
128
|
-
|
129
|
-
Please take care to never commit credentials to source control. We
|
130
|
-
strongly recommended loading credentials from an external source. By default,
|
131
|
-
the Ruby SDK will attempt to load credentials from the following
|
132
|
-
sources:
|
133
|
-
|
134
|
-
* `ENV['AWS_ACCESS_KEY_ID']` and `ENV['AWS_SECRET_ACCESS_KEY']`
|
135
|
-
* The shared credentials ini file at `HOME/.aws/credentials`
|
136
|
-
* From an instance profile when running on EC2
|
137
|
-
|
138
|
-
Alternatively, you can specify your credentials directly using one of the
|
139
|
-
following credential classes:
|
140
|
-
|
141
|
-
* `Aws::Credentials`
|
142
|
-
* `Aws::SharedCredentials`
|
143
|
-
* `Aws::InstanceProfileCredentials`
|
144
|
-
|
145
|
-
```ruby
|
146
|
-
# default credentials
|
147
|
-
Aws.config[:credentials] = Aws::SharedCredentials.new(profile_name:'myprofile')
|
148
|
-
|
149
|
-
# per-service :credentials
|
150
|
-
s3 = Aws::S3::Client.new(credentials: Aws::SharedCredentials.new(profile_name:'myprofile')
|
151
|
-
```
|
152
|
-
|
153
|
-
## Basic Usage
|
154
|
-
|
155
|
-
To make a request, you need to construct a service client.
|
156
|
-
|
157
|
-
```ruby
|
158
|
-
s3 = Aws::S3::Client.new
|
159
|
-
```
|
160
|
-
|
161
|
-
Each client provides one method per API operation. Refer to the
|
162
|
-
[API documentation](http://docs.amazonwebservices.com/sdkforruby/api/frames.html)
|
163
|
-
for a complete list of available methods.
|
164
|
-
|
165
|
-
```ruby
|
166
|
-
# get a list of buckets in Amazon S3
|
167
|
-
resp = s3.list_buckets
|
168
|
-
puts resp.buckets.map(&:name)
|
169
|
-
```
|
170
|
-
|
171
|
-
API methods accept a request params as a hash, and return structured responses.
|
172
|
-
|
173
|
-
```ruby
|
174
|
-
resp = s3.list_objects(bucket: 'aws-sdk-core', max_keys: 2)
|
175
|
-
resp.contents.each do |object|
|
176
|
-
puts "#{object.key} => #{object.etag}"
|
177
|
-
end
|
178
|
-
```
|
179
|
-
|
180
|
-
## Paging Responses
|
181
|
-
|
182
|
-
Many AWS operations limit the number of results returned with each response.
|
183
|
-
A simple paging interface is provided that works with every AWS request.
|
184
|
-
|
185
|
-
```ruby
|
186
|
-
# yields once per response, even works with non-paged requests
|
187
|
-
s3.list_objects(bucket:'aws-sdk').each do |resp|
|
188
|
-
puts resp.contents.map(&:key)
|
189
|
-
end
|
190
|
-
```
|
191
|
-
|
192
|
-
If you prefer to control paging yourself, all returned responses have the
|
193
|
-
same helper methods:
|
194
|
-
|
195
|
-
```ruby
|
196
|
-
# make a request that returns a truncated response
|
197
|
-
resp = s3.list_objects(bucket:'aws-sdk')
|
198
|
-
|
199
|
-
resp.last_page? #=> false
|
200
|
-
resp.next_page? #=> true
|
201
|
-
resp = resp.next_page # send a request for the next response page
|
202
|
-
resp = resp.next_page until resp.last_page?
|
203
|
-
```
|
204
|
-
|
205
|
-
## Interactive Console
|
206
|
-
|
207
|
-
AWS SDK Core ships with a REPL that acts as an interactive console. You
|
208
|
-
can access the REPL by running `aws.rb` from the command line.
|
209
|
-
|
210
|
-
```ruby
|
211
|
-
$ aws.rb
|
212
|
-
Aws> ec2.describe_instances.reservations.first.instances.first
|
213
|
-
<struct
|
214
|
-
instance_id="i-1234567",
|
215
|
-
image_id="ami-7654321",
|
216
|
-
state=<struct code=16, name="running">,
|
217
|
-
...>
|
218
|
-
```
|
219
|
-
|
220
|
-
Call `#service_classes` to get a list of available service helpers and
|
221
|
-
the class they construct.
|
222
|
-
|
223
|
-
```ruby
|
224
|
-
Aws> service_clients
|
225
|
-
{:autoscaling=>Aws::AutoScaling::Client,
|
226
|
-
:cloudformation=>Aws::CloudFormation::Client,
|
227
|
-
:cloudfront=>Aws::CloudFront::Client,
|
228
|
-
:cloudsearch=>Aws::CloudSearch::Client,
|
229
|
-
...
|
230
|
-
:swf=>Aws::SWF::Client}
|
231
|
-
```
|
232
|
-
|
233
|
-
## Versioning
|
234
|
-
|
235
|
-
This project uses [semantic versioning](http://semver.org/). When the project
|
236
|
-
leaves the developer preview state, we will continue by versioning from
|
237
|
-
`2.0`. Until then, all versions will be suffixed by a release candidate
|
238
|
-
version.
|
239
|
-
|
240
|
-
## Supported Services
|
241
|
-
|
242
|
-
| Service Name | Service Class | API Versions |
|
243
|
-
| ----------------------------------- | ------------------------- | ------------------------------ |
|
244
|
-
| Amazon CloudFront | CloudFront | 2014-05-31 |
|
245
|
-
| Amazon CloudSearch | CloudSearch | 2013-01-01 |
|
246
|
-
| Amazon CloudSearch Domain | CloudSearchDomain | 2013-01-01 |
|
247
|
-
| Amazon CloudWatch | CloudWatch | 2010-08-01 |
|
248
|
-
| Amazon CloudWatch Logs | CloudWatchLogs | 2014-03-28 |
|
249
|
-
| Amazon Cognito Identity | CognitoIdentity | 2014-06-30 |
|
250
|
-
| Amazon Cognito Sync | CognitoSync | 2014-06-30 |
|
251
|
-
| Amazon DynamoDB | DynamoDB | 2012-08-10 |
|
252
|
-
| Amazon Elastic Compute Cloud | EC2 | 2014-06-15 |
|
253
|
-
| Amazon Elastic MapReduce | EMR | 2009-03-31 |
|
254
|
-
| Amazon Elastic Transcoder | ElasticTranscoder | 2012-09-25 |
|
255
|
-
| Amazon ElastiCache | ElastiCache | 2014-07-15 |
|
256
|
-
| Amazon Glacier | Glacier | 2012-06-01 |
|
257
|
-
| Amazon Kinesis | Kinesis | 2013-12-02 |
|
258
|
-
| Amazon Redshift | Redshift | 2012-12-01 |
|
259
|
-
| Amazon Relational Database Service | RDS | 2013-09-09 |
|
260
|
-
| Amazon Route 53 | Route53 | 2013-04-01 |
|
261
|
-
| Amazon Route 53 Domains | Route53Domains | 2014-05-15 |
|
262
|
-
| Amazon Simple Email Service | SES | 2010-12-01 |
|
263
|
-
| Amazon Simple Notification Service | SNS | 2010-03-31 |
|
264
|
-
| Amazon Simple Queue Service | SQS | 2012-11-05 |
|
265
|
-
| Amazon Simple Storage Service | S3 | 2006-03-01 |
|
266
|
-
| Amazon Simple Workflow Service | SWF | 2012-01-25 |
|
267
|
-
| Amazon SimpleDB | SimpleDB | 2009-04-15 |
|
268
|
-
| Auto Scaling | AutoScaling | 2011-01-01 |
|
269
|
-
| AWS CloudFormation | CloudFormation | 2010-05-15 |
|
270
|
-
| AWS CloudTrail | CloudTrail | 2013-11-01 |
|
271
|
-
| AWS Data Pipeline | DataPipeline | 2012-10-29 |
|
272
|
-
| AWS Direct Connect | DirectConnect | 2012-10-25 |
|
273
|
-
| AWS Elastic Beanstalk | ElasticBeanstalk | 2010-12-01 |
|
274
|
-
| AWS Identity and Access Management | IAM | 2010-05-08 |
|
275
|
-
| AWS Import/Export | ImportExport | 2010-06-01 |
|
276
|
-
| AWS OpsWorks | OpsWorks | 2013-02-18 |
|
277
|
-
| AWS Security Token Service | STS | 2011-06-15 |
|
278
|
-
| AWS Storage Gateway | StorageGateway | 2013-06-30 |
|
279
|
-
| AWS Support | Support | 2013-04-15 |
|
280
|
-
| Elastic Load Balancing | ElasticLoadBalancing | 2012-06-01 |
|
281
|
-
|
282
|
-
## License
|
283
|
-
|
284
|
-
This library is distributed under the
|
285
|
-
[apache license, version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
|
286
|
-
|
287
|
-
```no-highlight
|
288
|
-
copyright 2013. amazon web services, inc. all rights reserved.
|
289
|
-
|
290
|
-
licensed under the apache license, version 2.0 (the "license");
|
291
|
-
you may not use this file except in compliance with the license.
|
292
|
-
you may obtain a copy of the license at
|
293
|
-
|
294
|
-
http://www.apache.org/licenses/license-2.0
|
295
|
-
|
296
|
-
unless required by applicable law or agreed to in writing, software
|
297
|
-
distributed under the license is distributed on an "as is" basis,
|
298
|
-
without warranties or conditions of any kind, either express or implied.
|
299
|
-
see the license for the specific language governing permissions and
|
300
|
-
limitations under the license.
|
301
|
-
```
|