aws-sdk 1.0.0
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.
- data/.yardopts +6 -0
- data/LICENSE.txt +171 -0
- data/NOTICE.txt +2 -0
- data/README.rdoc +189 -0
- data/lib/aws-sdk.rb +14 -0
- data/lib/aws.rb +63 -0
- data/lib/aws/api_config.rb +45 -0
- data/lib/aws/api_config/.document +0 -0
- data/lib/aws/api_config/EC2-2011-02-28.yml +2314 -0
- data/lib/aws/api_config/SNS-2010-03-31.yml +171 -0
- data/lib/aws/api_config/SQS-2009-02-01.yml +161 -0
- data/lib/aws/api_config/SimpleDB-2009-04-15.yml +278 -0
- data/lib/aws/api_config/SimpleEmailService-2010-12-01.yml +147 -0
- data/lib/aws/api_config_transform.rb +32 -0
- data/lib/aws/async_handle.rb +90 -0
- data/lib/aws/authorize_v2.rb +37 -0
- data/lib/aws/authorize_v3.rb +37 -0
- data/lib/aws/base_client.rb +524 -0
- data/lib/aws/cacheable.rb +92 -0
- data/lib/aws/common.rb +228 -0
- data/lib/aws/configurable.rb +36 -0
- data/lib/aws/configuration.rb +272 -0
- data/lib/aws/configured_client_methods.rb +81 -0
- data/lib/aws/configured_grammars.rb +65 -0
- data/lib/aws/configured_option_grammars.rb +46 -0
- data/lib/aws/configured_xml_grammars.rb +47 -0
- data/lib/aws/default_signer.rb +38 -0
- data/lib/aws/ec2.rb +321 -0
- data/lib/aws/ec2/attachment.rb +149 -0
- data/lib/aws/ec2/attachment_collection.rb +57 -0
- data/lib/aws/ec2/availability_zone.rb +80 -0
- data/lib/aws/ec2/availability_zone_collection.rb +47 -0
- data/lib/aws/ec2/block_device_mappings.rb +53 -0
- data/lib/aws/ec2/client.rb +54 -0
- data/lib/aws/ec2/client/xml.rb +127 -0
- data/lib/aws/ec2/collection.rb +39 -0
- data/lib/aws/ec2/config_transform.rb +63 -0
- data/lib/aws/ec2/elastic_ip.rb +107 -0
- data/lib/aws/ec2/elastic_ip_collection.rb +85 -0
- data/lib/aws/ec2/errors.rb +29 -0
- data/lib/aws/ec2/filtered_collection.rb +65 -0
- data/lib/aws/ec2/has_permissions.rb +46 -0
- data/lib/aws/ec2/image.rb +245 -0
- data/lib/aws/ec2/image_collection.rb +235 -0
- data/lib/aws/ec2/instance.rb +515 -0
- data/lib/aws/ec2/instance_collection.rb +276 -0
- data/lib/aws/ec2/key_pair.rb +86 -0
- data/lib/aws/ec2/key_pair_collection.rb +102 -0
- data/lib/aws/ec2/permission_collection.rb +177 -0
- data/lib/aws/ec2/region.rb +81 -0
- data/lib/aws/ec2/region_collection.rb +55 -0
- data/lib/aws/ec2/request.rb +27 -0
- data/lib/aws/ec2/reserved_instances.rb +50 -0
- data/lib/aws/ec2/reserved_instances_collection.rb +44 -0
- data/lib/aws/ec2/reserved_instances_offering.rb +55 -0
- data/lib/aws/ec2/reserved_instances_offering_collection.rb +43 -0
- data/lib/aws/ec2/resource.rb +340 -0
- data/lib/aws/ec2/resource_tag_collection.rb +218 -0
- data/lib/aws/ec2/security_group.rb +246 -0
- data/lib/aws/ec2/security_group/ip_permission.rb +70 -0
- data/lib/aws/ec2/security_group/ip_permission_collection.rb +59 -0
- data/lib/aws/ec2/security_group_collection.rb +132 -0
- data/lib/aws/ec2/snapshot.rb +138 -0
- data/lib/aws/ec2/snapshot_collection.rb +90 -0
- data/lib/aws/ec2/tag.rb +88 -0
- data/lib/aws/ec2/tag_collection.rb +114 -0
- data/lib/aws/ec2/tagged_collection.rb +48 -0
- data/lib/aws/ec2/tagged_item.rb +87 -0
- data/lib/aws/ec2/volume.rb +190 -0
- data/lib/aws/ec2/volume_collection.rb +95 -0
- data/lib/aws/errors.rb +129 -0
- data/lib/aws/http/builtin_handler.rb +69 -0
- data/lib/aws/http/curb_handler.rb +123 -0
- data/lib/aws/http/handler.rb +77 -0
- data/lib/aws/http/httparty_handler.rb +61 -0
- data/lib/aws/http/request.rb +136 -0
- data/lib/aws/http/request_param.rb +63 -0
- data/lib/aws/http/response.rb +75 -0
- data/lib/aws/ignore_result_element.rb +38 -0
- data/lib/aws/indifferent_hash.rb +86 -0
- data/lib/aws/inflection.rb +46 -0
- data/lib/aws/lazy_error_classes.rb +64 -0
- data/lib/aws/meta_utils.rb +43 -0
- data/lib/aws/model.rb +57 -0
- data/lib/aws/naming.rb +32 -0
- data/lib/aws/option_grammar.rb +544 -0
- data/lib/aws/policy.rb +912 -0
- data/lib/aws/rails.rb +209 -0
- data/lib/aws/record.rb +79 -0
- data/lib/aws/record/attribute.rb +94 -0
- data/lib/aws/record/attribute_macros.rb +288 -0
- data/lib/aws/record/attributes/boolean.rb +49 -0
- data/lib/aws/record/attributes/datetime.rb +86 -0
- data/lib/aws/record/attributes/float.rb +48 -0
- data/lib/aws/record/attributes/integer.rb +68 -0
- data/lib/aws/record/attributes/sortable_float.rb +60 -0
- data/lib/aws/record/attributes/sortable_integer.rb +95 -0
- data/lib/aws/record/attributes/string.rb +69 -0
- data/lib/aws/record/base.rb +728 -0
- data/lib/aws/record/conversion.rb +38 -0
- data/lib/aws/record/dirty_tracking.rb +286 -0
- data/lib/aws/record/errors.rb +153 -0
- data/lib/aws/record/exceptions.rb +48 -0
- data/lib/aws/record/finder_methods.rb +262 -0
- data/lib/aws/record/naming.rb +31 -0
- data/lib/aws/record/scope.rb +157 -0
- data/lib/aws/record/validations.rb +653 -0
- data/lib/aws/record/validator.rb +237 -0
- data/lib/aws/record/validators/acceptance.rb +51 -0
- data/lib/aws/record/validators/block.rb +38 -0
- data/lib/aws/record/validators/confirmation.rb +43 -0
- data/lib/aws/record/validators/count.rb +108 -0
- data/lib/aws/record/validators/exclusion.rb +43 -0
- data/lib/aws/record/validators/format.rb +57 -0
- data/lib/aws/record/validators/inclusion.rb +56 -0
- data/lib/aws/record/validators/length.rb +107 -0
- data/lib/aws/record/validators/numericality.rb +138 -0
- data/lib/aws/record/validators/presence.rb +45 -0
- data/lib/aws/resource_cache.rb +39 -0
- data/lib/aws/response.rb +113 -0
- data/lib/aws/response_cache.rb +50 -0
- data/lib/aws/s3.rb +109 -0
- data/lib/aws/s3/access_control_list.rb +252 -0
- data/lib/aws/s3/acl_object.rb +266 -0
- data/lib/aws/s3/bucket.rb +320 -0
- data/lib/aws/s3/bucket_collection.rb +122 -0
- data/lib/aws/s3/bucket_version_collection.rb +85 -0
- data/lib/aws/s3/client.rb +999 -0
- data/lib/aws/s3/client/xml.rb +190 -0
- data/lib/aws/s3/data_options.rb +99 -0
- data/lib/aws/s3/errors.rb +43 -0
- data/lib/aws/s3/multipart_upload.rb +318 -0
- data/lib/aws/s3/multipart_upload_collection.rb +78 -0
- data/lib/aws/s3/object_collection.rb +159 -0
- data/lib/aws/s3/object_metadata.rb +67 -0
- data/lib/aws/s3/object_upload_collection.rb +83 -0
- data/lib/aws/s3/object_version.rb +141 -0
- data/lib/aws/s3/object_version_collection.rb +78 -0
- data/lib/aws/s3/paginated_collection.rb +94 -0
- data/lib/aws/s3/policy.rb +76 -0
- data/lib/aws/s3/prefix_and_delimiter_collection.rb +56 -0
- data/lib/aws/s3/prefixed_collection.rb +84 -0
- data/lib/aws/s3/presigned_post.rb +504 -0
- data/lib/aws/s3/request.rb +198 -0
- data/lib/aws/s3/s3_object.rb +794 -0
- data/lib/aws/s3/tree.rb +116 -0
- data/lib/aws/s3/tree/branch_node.rb +71 -0
- data/lib/aws/s3/tree/child_collection.rb +108 -0
- data/lib/aws/s3/tree/leaf_node.rb +99 -0
- data/lib/aws/s3/tree/node.rb +22 -0
- data/lib/aws/s3/tree/parent.rb +90 -0
- data/lib/aws/s3/uploaded_part.rb +82 -0
- data/lib/aws/s3/uploaded_part_collection.rb +86 -0
- data/lib/aws/service_interface.rb +60 -0
- data/lib/aws/simple_db.rb +202 -0
- data/lib/aws/simple_db/attribute.rb +159 -0
- data/lib/aws/simple_db/attribute_collection.rb +227 -0
- data/lib/aws/simple_db/client.rb +52 -0
- data/lib/aws/simple_db/client/options.rb +34 -0
- data/lib/aws/simple_db/client/xml.rb +68 -0
- data/lib/aws/simple_db/consistent_read_option.rb +42 -0
- data/lib/aws/simple_db/delete_attributes.rb +64 -0
- data/lib/aws/simple_db/domain.rb +118 -0
- data/lib/aws/simple_db/domain_collection.rb +116 -0
- data/lib/aws/simple_db/domain_metadata.rb +112 -0
- data/lib/aws/simple_db/errors.rb +46 -0
- data/lib/aws/simple_db/expect_condition_option.rb +45 -0
- data/lib/aws/simple_db/item.rb +84 -0
- data/lib/aws/simple_db/item_collection.rb +594 -0
- data/lib/aws/simple_db/item_data.rb +70 -0
- data/lib/aws/simple_db/put_attributes.rb +62 -0
- data/lib/aws/simple_db/request.rb +27 -0
- data/lib/aws/simple_email_service.rb +373 -0
- data/lib/aws/simple_email_service/client.rb +39 -0
- data/lib/aws/simple_email_service/client/options.rb +24 -0
- data/lib/aws/simple_email_service/client/xml.rb +38 -0
- data/lib/aws/simple_email_service/email_address_collection.rb +66 -0
- data/lib/aws/simple_email_service/errors.rb +29 -0
- data/lib/aws/simple_email_service/quotas.rb +64 -0
- data/lib/aws/simple_email_service/request.rb +27 -0
- data/lib/aws/sns.rb +69 -0
- data/lib/aws/sns/client.rb +37 -0
- data/lib/aws/sns/client/options.rb +24 -0
- data/lib/aws/sns/client/xml.rb +38 -0
- data/lib/aws/sns/errors.rb +29 -0
- data/lib/aws/sns/policy.rb +49 -0
- data/lib/aws/sns/request.rb +27 -0
- data/lib/aws/sns/subscription.rb +100 -0
- data/lib/aws/sns/subscription_collection.rb +84 -0
- data/lib/aws/sns/topic.rb +384 -0
- data/lib/aws/sns/topic_collection.rb +70 -0
- data/lib/aws/sns/topic_subscription_collection.rb +58 -0
- data/lib/aws/sqs.rb +70 -0
- data/lib/aws/sqs/client.rb +38 -0
- data/lib/aws/sqs/client/xml.rb +36 -0
- data/lib/aws/sqs/errors.rb +33 -0
- data/lib/aws/sqs/policy.rb +50 -0
- data/lib/aws/sqs/queue.rb +507 -0
- data/lib/aws/sqs/queue_collection.rb +105 -0
- data/lib/aws/sqs/received_message.rb +184 -0
- data/lib/aws/sqs/received_sns_message.rb +112 -0
- data/lib/aws/sqs/request.rb +44 -0
- data/lib/aws/xml_grammar.rb +923 -0
- data/rails/init.rb +15 -0
- metadata +298 -0
data/.yardopts
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
|
|
4
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
5
|
+
|
|
6
|
+
1. Definitions.
|
|
7
|
+
|
|
8
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
9
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the
|
|
12
|
+
copyright owner that is granting the License.
|
|
13
|
+
|
|
14
|
+
"Legal Entity" shall mean the union of the acting entity and all other
|
|
15
|
+
entities that control, are controlled by, or are under common control
|
|
16
|
+
with that entity. For the purposes of this definition, "control" means
|
|
17
|
+
(i) the power, direct or indirect, to cause the direction or
|
|
18
|
+
management of such entity, whether by contract or otherwise, or (ii)
|
|
19
|
+
ownership of fifty percent (50%) or more of the outstanding shares, or
|
|
20
|
+
(iii) beneficial ownership of such entity.
|
|
21
|
+
|
|
22
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
23
|
+
permissions granted by this License.
|
|
24
|
+
|
|
25
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
26
|
+
including but not limited to software source code, documentation
|
|
27
|
+
source, and configuration files.
|
|
28
|
+
|
|
29
|
+
"Object" form shall mean any form resulting from mechanical
|
|
30
|
+
transformation or translation of a Source form, including but not
|
|
31
|
+
limited to compiled object code, generated documentation, and
|
|
32
|
+
conversions to other media types.
|
|
33
|
+
|
|
34
|
+
"Work" shall mean the work of authorship, whether in Source or Object
|
|
35
|
+
form, made available under the License, as indicated by a copyright
|
|
36
|
+
notice that is included in or attached to the work (an example is
|
|
37
|
+
provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the
|
|
43
|
+
purposes of this License, Derivative Works shall not include works
|
|
44
|
+
that remain separable from, or merely link (or bind by name) to the
|
|
45
|
+
interfaces of, the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including the
|
|
48
|
+
original version of the Work and any modifications or additions to
|
|
49
|
+
that Work or Derivative Works thereof, that is intentionally submitted
|
|
50
|
+
to Licensor for inclusion in the Work by the copyright owner or by an
|
|
51
|
+
individual or Legal Entity authorized to submit on behalf of the
|
|
52
|
+
copyright owner. For the purposes of this definition, "submitted"
|
|
53
|
+
means any form of electronic, verbal, or written communication sent to
|
|
54
|
+
the Licensor or its representatives, including but not limited to
|
|
55
|
+
communication on electronic mailing lists, source code control
|
|
56
|
+
systems, and issue tracking systems that are managed by, or on behalf
|
|
57
|
+
of, the Licensor for the purpose of discussing and improving the Work,
|
|
58
|
+
but excluding communication that is conspicuously marked or otherwise
|
|
59
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
62
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
63
|
+
subsequently incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
copyright license to reproduce, prepare Derivative Works of, publicly
|
|
69
|
+
display, publicly perform, sublicense, and distribute the Work and
|
|
70
|
+
such Derivative Works in Source or Object form.
|
|
71
|
+
|
|
72
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
73
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except
|
|
75
|
+
as stated in this section) patent license to make, have made, use,
|
|
76
|
+
offer to sell, sell, import, and otherwise transfer the Work, where
|
|
77
|
+
such license applies only to those patent claims licensable by such
|
|
78
|
+
Contributor that are necessarily infringed by their Contribution(s)
|
|
79
|
+
alone or by combination of their Contribution(s) with the Work to
|
|
80
|
+
which such Contribution(s) was submitted. If You institute patent
|
|
81
|
+
litigation against any entity (including a cross-claim or counterclaim
|
|
82
|
+
in a lawsuit) alleging that the Work or a Contribution incorporated
|
|
83
|
+
within the Work constitutes direct or contributory patent
|
|
84
|
+
infringement, then any patent licenses granted to You under this
|
|
85
|
+
License for that Work shall terminate as of the date such litigation
|
|
86
|
+
is filed.
|
|
87
|
+
|
|
88
|
+
4. Redistribution. You may reproduce and distribute copies of the Work
|
|
89
|
+
or Derivative Works thereof in any medium, with or without
|
|
90
|
+
modifications, and in Source or Object form, provided that You meet
|
|
91
|
+
the following conditions:
|
|
92
|
+
|
|
93
|
+
1. You must give any other recipients of the Work or Derivative
|
|
94
|
+
Works a copy of this License; and
|
|
95
|
+
2. You must cause any modified files to carry prominent notices
|
|
96
|
+
stating that You changed the files; and
|
|
97
|
+
3. You must retain, in the Source form of any Derivative Works
|
|
98
|
+
that You distribute, all copyright, patent, trademark, and
|
|
99
|
+
attribution notices from the Source form of the Work, excluding
|
|
100
|
+
those notices that do not pertain to any part of the Derivative
|
|
101
|
+
Works; and
|
|
102
|
+
4. If the Work includes a "NOTICE" text file as part of its
|
|
103
|
+
distribution, then any Derivative Works that You distribute must
|
|
104
|
+
include a readable copy of the attribution notices contained within
|
|
105
|
+
such NOTICE file, excluding those notices that do not pertain to
|
|
106
|
+
any part of the Derivative Works, in at least one of the following
|
|
107
|
+
places: within a NOTICE text file distributed as part of the
|
|
108
|
+
Derivative Works; within the Source form or documentation, if
|
|
109
|
+
provided along with the Derivative Works; or, within a display
|
|
110
|
+
generated by the Derivative Works, if and wherever such third-party
|
|
111
|
+
notices normally appear. The contents of the NOTICE file are for
|
|
112
|
+
informational purposes only and do not modify the License. You may
|
|
113
|
+
add Your own attribution notices within Derivative Works that You
|
|
114
|
+
distribute, alongside or as an addendum to the NOTICE text from the
|
|
115
|
+
Work, provided that such additional attribution notices cannot be
|
|
116
|
+
construed as modifying the License.
|
|
117
|
+
|
|
118
|
+
You may add Your own copyright statement to Your modifications and may
|
|
119
|
+
provide additional or different license terms and conditions for use,
|
|
120
|
+
reproduction, or distribution of Your modifications, or for any such
|
|
121
|
+
Derivative Works as a whole, provided Your use, reproduction, and
|
|
122
|
+
distribution of the Work otherwise complies with the conditions stated
|
|
123
|
+
in this License.
|
|
124
|
+
|
|
125
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
126
|
+
any Contribution intentionally submitted for inclusion in the Work by
|
|
127
|
+
You to the Licensor shall be under the terms and conditions of this
|
|
128
|
+
License, without any additional terms or conditions. Notwithstanding
|
|
129
|
+
the above, nothing herein shall supersede or modify the terms of any
|
|
130
|
+
separate license agreement you may have executed with Licensor
|
|
131
|
+
regarding such Contributions.
|
|
132
|
+
|
|
133
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
134
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
135
|
+
except as required for reasonable and customary use in describing the
|
|
136
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
137
|
+
|
|
138
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
139
|
+
to in writing, Licensor provides the Work (and each Contributor
|
|
140
|
+
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
141
|
+
CONDITIONS OF ANY KIND, either express or implied, including, without
|
|
142
|
+
limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
|
|
143
|
+
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
|
|
144
|
+
responsible for determining the appropriateness of using or
|
|
145
|
+
redistributing the Work and assume any risks associated with Your
|
|
146
|
+
exercise of permissions under this License.
|
|
147
|
+
|
|
148
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
149
|
+
whether in tort (including negligence), contract, or otherwise, unless
|
|
150
|
+
required by applicable law (such as deliberate and grossly negligent
|
|
151
|
+
acts) or agreed to in writing, shall any Contributor be liable to You
|
|
152
|
+
for damages, including any direct, indirect, special, incidental, or
|
|
153
|
+
consequential damages of any character arising as a result of this
|
|
154
|
+
License or out of the use or inability to use the Work (including but
|
|
155
|
+
not limited to damages for loss of goodwill, work stoppage, computer
|
|
156
|
+
failure or malfunction, or any and all other commercial damages or
|
|
157
|
+
losses), even if such Contributor has been advised of the possibility
|
|
158
|
+
of such damages.
|
|
159
|
+
|
|
160
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
161
|
+
the Work or Derivative Works thereof, You may choose to offer, and
|
|
162
|
+
charge a fee for, acceptance of support, warranty, indemnity, or other
|
|
163
|
+
liability obligations and/or rights consistent with this
|
|
164
|
+
License. However, in accepting such obligations, You may act only on
|
|
165
|
+
Your own behalf and on Your sole responsibility, not on behalf of any
|
|
166
|
+
other Contributor, and only if You agree to indemnify, defend, and
|
|
167
|
+
hold each Contributor harmless for any liability incurred by, or
|
|
168
|
+
claims asserted against, such Contributor by reason of your accepting
|
|
169
|
+
any such warranty or additional liability.
|
|
170
|
+
|
|
171
|
+
END OF TERMS AND CONDITIONS
|
data/NOTICE.txt
ADDED
data/README.rdoc
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
= Getting Started with the AWS SDK for Ruby
|
|
2
|
+
|
|
3
|
+
The AWS SDK for Ruby helps you to get started building applications
|
|
4
|
+
using AWS infrastructure services, including Amazon Simple Storage
|
|
5
|
+
Service (Amazon S3), Amazon Elastic Compute Cloud (Amazon EC2), Amazon
|
|
6
|
+
SimpleDB, and more. This guide shows how you can start building Ruby
|
|
7
|
+
and Rails applications on the Amazon Web Services platform with the
|
|
8
|
+
AWS Ruby gem.
|
|
9
|
+
|
|
10
|
+
= Get Set Up
|
|
11
|
+
|
|
12
|
+
To get set up, you must sign up for Amazon Web Services, get your AWS
|
|
13
|
+
credentials, and set up your environment.
|
|
14
|
+
|
|
15
|
+
== Sign Up for AWS Products
|
|
16
|
+
|
|
17
|
+
Before you can begin, you must sign up for each AWS product you want
|
|
18
|
+
to use. The sample included in the SDK uses Amazon S3, so we'll use
|
|
19
|
+
that product as an example here.
|
|
20
|
+
|
|
21
|
+
=== To sign up for a product
|
|
22
|
+
|
|
23
|
+
1. Go to the home page for the product, for example
|
|
24
|
+
http://aws.amazon.com/s3.
|
|
25
|
+
|
|
26
|
+
*Tip:* Go to http://aws.amazon.com/products for a list of links to all our products.
|
|
27
|
+
|
|
28
|
+
2. Click the sign-up button on the top right corner of the page.
|
|
29
|
+
|
|
30
|
+
3. Follow the on-screen instructions. If you don't already have an AWS
|
|
31
|
+
account, you are prompted to create one as part of the sign-up
|
|
32
|
+
process.
|
|
33
|
+
|
|
34
|
+
AWS sends you a confirmation e-mail after the sign-up process is
|
|
35
|
+
complete. You can view your current account activity or manage your
|
|
36
|
+
account at any time, by going to http://aws.amazon.com and clicking
|
|
37
|
+
the *Account* tab.
|
|
38
|
+
|
|
39
|
+
== Get Your Credentials
|
|
40
|
+
|
|
41
|
+
To use the AWS SDK for Ruby, you need your AWS Access Key ID and Secret Access Key.
|
|
42
|
+
|
|
43
|
+
=== To get your AWS Access Key ID and Secret Access Key
|
|
44
|
+
|
|
45
|
+
1. Go to http://aws.amazon.com.
|
|
46
|
+
|
|
47
|
+
2. Click *Account* and then click <b>Security Credentials</b>.
|
|
48
|
+
The Security Credentials page displays (you might be prompted to log in).
|
|
49
|
+
|
|
50
|
+
3. Scroll down to Access Credentials and make sure the <b>Access Keys</b> tab
|
|
51
|
+
is selected. The AWS Access Key ID appears in the Access Key column.
|
|
52
|
+
|
|
53
|
+
4. To view the Secret Access Key, click *Show*.
|
|
54
|
+
|
|
55
|
+
*Important!* Your Secret Access Key is a secret, which only you and
|
|
56
|
+
AWS should know. It is important to keep it confidential to protect
|
|
57
|
+
your account. Store it securely in a safe place. Never include it in
|
|
58
|
+
your requests to AWS, and never e-mail it to anyone. Do not share it
|
|
59
|
+
outside your organization, even if an inquiry appears to come from AWS
|
|
60
|
+
or Amazon.com. No one who legitimately represents Amazon will ever ask
|
|
61
|
+
you for your Secret Access Key.
|
|
62
|
+
|
|
63
|
+
== Set Up Your Environment
|
|
64
|
+
|
|
65
|
+
The AWS Ruby gem runs on Ruby 1.8.7 and later. If you have an older
|
|
66
|
+
version of Ruby, RVM is a great way to get started using the latest
|
|
67
|
+
version.
|
|
68
|
+
|
|
69
|
+
= Install the SDK
|
|
70
|
+
|
|
71
|
+
To install the AWS Ruby gem, just enter:
|
|
72
|
+
|
|
73
|
+
gem install aws-sdk
|
|
74
|
+
|
|
75
|
+
= Run the Samples
|
|
76
|
+
|
|
77
|
+
Now that you've installed the gem, you can run the samples, which you
|
|
78
|
+
can find in our GitHub repository:
|
|
79
|
+
|
|
80
|
+
$ git clone git://github.com/amazonwebservices/aws-sdk-for-ruby.git
|
|
81
|
+
$ cd aws-sdk-for-ruby/samples/
|
|
82
|
+
|
|
83
|
+
The subdirectories of the +samples+ directory contain several code
|
|
84
|
+
samples that you can run. These samples demonstrate basic usage of
|
|
85
|
+
the SDK features.
|
|
86
|
+
|
|
87
|
+
== To run the Amazon S3 Sample
|
|
88
|
+
|
|
89
|
+
1. Create a file named config.yml in the samples directory as follows:
|
|
90
|
+
|
|
91
|
+
# Fill in your AWS Access Key ID and Secret Access Key
|
|
92
|
+
# http://aws.amazon.com/security-credentials
|
|
93
|
+
access_key_id: REPLACE_WITH_ACCESS_KEY_ID
|
|
94
|
+
secret_access_key: REPLACE_WITH_SECRET_ACCESS_KEY
|
|
95
|
+
|
|
96
|
+
2. Run a sample script with the Ruby interpreter. For example, to run
|
|
97
|
+
the s3/upload_file.rb sample:
|
|
98
|
+
|
|
99
|
+
$ echo "Hello, World!" > helloworld.txt
|
|
100
|
+
$ ruby s3/upload_file.rb unique-bucket-name helloworld.txt
|
|
101
|
+
|
|
102
|
+
== To use the AWS ORM in a Rails 3 application
|
|
103
|
+
|
|
104
|
+
1. Install the gem:
|
|
105
|
+
|
|
106
|
+
$ gem install aws-sdk
|
|
107
|
+
|
|
108
|
+
2. Start a new Rails project:
|
|
109
|
+
|
|
110
|
+
$ gem install rails
|
|
111
|
+
$ rails new myapp
|
|
112
|
+
$ cd myapp/
|
|
113
|
+
|
|
114
|
+
3. Add the following line to your Gemfile:
|
|
115
|
+
|
|
116
|
+
gem 'aws-sdk'
|
|
117
|
+
|
|
118
|
+
4. Install dependencies:
|
|
119
|
+
|
|
120
|
+
$ bundle install
|
|
121
|
+
|
|
122
|
+
5. Create config/aws.yml as follows:
|
|
123
|
+
|
|
124
|
+
# Fill in your AWS Access Key ID and Secret Access Key
|
|
125
|
+
# http://aws.amazon.com/security-credentials
|
|
126
|
+
access_key_id: REPLACE_WITH_ACCESS_KEY_ID
|
|
127
|
+
secret_access_key: REPLACE_WITH_SECRET_ACCESS_KEY
|
|
128
|
+
|
|
129
|
+
6. Create config/initializers/aws.rb as follows:
|
|
130
|
+
|
|
131
|
+
# load the libraries
|
|
132
|
+
require 'aws'
|
|
133
|
+
# log requests using the default rails logger
|
|
134
|
+
AWS.config(:logger => Rails.logger)
|
|
135
|
+
# load credentials from a file
|
|
136
|
+
config_path = File.expand_path(File.dirname(__FILE__)+"/../aws.yml")
|
|
137
|
+
AWS.config(YAML.load(File.read(config_path)))
|
|
138
|
+
|
|
139
|
+
7. Create app/models/my_record.rb as follows:
|
|
140
|
+
|
|
141
|
+
class MyRecord < AWS::Record::Base
|
|
142
|
+
string_attr :name
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
8. Create the SimpleDB domain:
|
|
146
|
+
|
|
147
|
+
$ rails console
|
|
148
|
+
> MyRecord.create_domain
|
|
149
|
+
|
|
150
|
+
Now, you can play around with the model by creating some records and querying them:
|
|
151
|
+
|
|
152
|
+
> MyRecord.find(:all).to_a
|
|
153
|
+
=> []
|
|
154
|
+
> MyRecord.new(:name => "The first one").save
|
|
155
|
+
=> true
|
|
156
|
+
> MyRecord.new(:name => "The second one").save
|
|
157
|
+
=> true
|
|
158
|
+
> MyRecord.where('name like ?', "%first%").count
|
|
159
|
+
=> 1
|
|
160
|
+
|
|
161
|
+
Exit the rails console before continuing to the next step:
|
|
162
|
+
|
|
163
|
+
> exit
|
|
164
|
+
|
|
165
|
+
9. Generate a scaffold controller for your model:
|
|
166
|
+
|
|
167
|
+
$ rails generate scaffold_controller MyRecord name:string
|
|
168
|
+
$ rails server
|
|
169
|
+
|
|
170
|
+
10. Add a route to your scaffold controller in config/routes.rb:
|
|
171
|
+
|
|
172
|
+
Myapp::Application.routes.draw do
|
|
173
|
+
# add this line:
|
|
174
|
+
resources :my_records
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
11. Now, you can create records in the browser at http://localhost:3000/my_records.
|
|
178
|
+
|
|
179
|
+
= Where Do I Go from Here?
|
|
180
|
+
|
|
181
|
+
For more information about the AWS SDK for Ruby, including a complete
|
|
182
|
+
list of supported AWS products, go to
|
|
183
|
+
http://aws.amazon.com/sdkforruby.
|
|
184
|
+
|
|
185
|
+
The SDK reference documentation provides information about both the
|
|
186
|
+
AWS Ruby gem and AWS Rails integration gem. You can find it at
|
|
187
|
+
http://docs.amazonwebservices.com/AWSRubySDK/latest.
|
|
188
|
+
|
|
189
|
+
Licensed under Apache 2.0. See {file:LICENSE.txt} and {file:NOTICE.txt} files.
|
data/lib/aws-sdk.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright 2011 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 'aws'
|
data/lib/aws.rb
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Copyright 2011 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
|
+
# AWS is the root module for all of the Amazon Web Services. It is also
|
|
15
|
+
# where you can configure you access to AWS.
|
|
16
|
+
#
|
|
17
|
+
# = Supported Services
|
|
18
|
+
#
|
|
19
|
+
# The currently supported services are:
|
|
20
|
+
#
|
|
21
|
+
# * {EC2}
|
|
22
|
+
# * {S3}
|
|
23
|
+
# * {SimpleDB}
|
|
24
|
+
# * {SimpleEmailService}
|
|
25
|
+
# * {SNS}
|
|
26
|
+
# * {SQS}
|
|
27
|
+
#
|
|
28
|
+
# = AWS::Record
|
|
29
|
+
#
|
|
30
|
+
# In addition to the above services, bundled is an ORM based on AWS services
|
|
31
|
+
# See {AWS::Record} for more information.
|
|
32
|
+
#
|
|
33
|
+
# = Configuration
|
|
34
|
+
#
|
|
35
|
+
# You call {AWS.config} with a hash of options to configure your
|
|
36
|
+
# access to the Amazon Web Services.
|
|
37
|
+
#
|
|
38
|
+
# At a minimum you need to set your access credentials. See {AWS.config}
|
|
39
|
+
# for additional configuration options.
|
|
40
|
+
#
|
|
41
|
+
# AWS.config(
|
|
42
|
+
# :access_key_id => 'ACCESS_KEY_ID',
|
|
43
|
+
# :secret_access_key => 'SECRET_ACCESS_KEY')
|
|
44
|
+
#
|
|
45
|
+
# == Rails
|
|
46
|
+
#
|
|
47
|
+
# If you are loading AWS inside a Rails web application, place your
|
|
48
|
+
# configuration inside:
|
|
49
|
+
#
|
|
50
|
+
# config/initializers/aws.rb
|
|
51
|
+
#
|
|
52
|
+
module AWS; end
|
|
53
|
+
|
|
54
|
+
require 'aws/common'
|
|
55
|
+
|
|
56
|
+
%w(ec2 s3 simple_db simple_email_service sns sqs record rails).each do |service|
|
|
57
|
+
$:.each do |load_path|
|
|
58
|
+
if (Pathname.new(load_path) + "aws" + "#{service}.rb").exist?
|
|
59
|
+
require "aws/#{service}"
|
|
60
|
+
break
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|