aws-sdk 1.1.3 → 1.1.4

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.
Files changed (233) hide show
  1. data/ca-bundle.crt +2 -348
  2. data/lib/aws.rb +24 -49
  3. data/lib/aws/{common.rb → core.rb} +120 -9
  4. data/lib/aws/{api_config.rb → core/api_config.rb} +19 -20
  5. data/lib/aws/core/api_config_transform.rb +36 -0
  6. data/lib/aws/core/async_handle.rb +91 -0
  7. data/lib/aws/core/authorize_v2.rb +39 -0
  8. data/lib/aws/{authorize_v3.rb → core/authorize_v3.rb} +16 -15
  9. data/lib/aws/{api_config_transform.rb → core/authorize_with_session_token.rb} +9 -12
  10. data/lib/aws/core/autoloader.rb +64 -0
  11. data/lib/aws/core/cacheable.rb +78 -0
  12. data/lib/aws/core/client.rb +471 -0
  13. data/lib/aws/core/client_logging.rb +125 -0
  14. data/lib/aws/core/collections.rb +229 -0
  15. data/lib/aws/core/configuration.rb +358 -0
  16. data/lib/aws/core/configured_client_methods.rb +76 -0
  17. data/lib/aws/core/configured_grammars.rb +63 -0
  18. data/lib/aws/{configured_option_grammars.rb → core/configured_option_grammars.rb} +18 -20
  19. data/lib/aws/{configured_xml_grammars.rb → core/configured_xml_grammars.rb} +19 -21
  20. data/lib/aws/core/default_signer.rb +67 -0
  21. data/lib/aws/core/http/curb_handler.rb +129 -0
  22. data/lib/aws/core/http/handler.rb +77 -0
  23. data/lib/aws/core/http/httparty_handler.rb +113 -0
  24. data/lib/aws/core/http/net_http_handler.rb +124 -0
  25. data/lib/aws/core/http/request.rb +207 -0
  26. data/lib/aws/core/http/response.rb +73 -0
  27. data/lib/aws/{ignore_result_element.rb → core/ignore_result_element.rb} +14 -18
  28. data/lib/aws/core/indifferent_hash.rb +88 -0
  29. data/lib/aws/core/inflection.rb +47 -0
  30. data/lib/aws/core/lazy_error_classes.rb +62 -0
  31. data/lib/aws/{uri_escape.rb → core/meta_utils.rb} +24 -23
  32. data/lib/aws/core/model.rb +57 -0
  33. data/lib/aws/{authorize_with_session_token.rb → core/naming.rb} +9 -8
  34. data/lib/aws/core/option_grammar.rb +562 -0
  35. data/lib/aws/core/policy.rb +914 -0
  36. data/lib/aws/core/resource.rb +380 -0
  37. data/lib/aws/core/resource_cache.rb +40 -0
  38. data/lib/aws/core/response.rb +125 -0
  39. data/lib/aws/core/response_cache.rb +50 -0
  40. data/lib/aws/core/service_interface.rb +60 -0
  41. data/lib/aws/core/uri_escape.rb +46 -0
  42. data/lib/aws/core/xml_grammar.rb +926 -0
  43. data/lib/aws/ec2.rb +47 -16
  44. data/lib/aws/ec2/attachment.rb +0 -2
  45. data/lib/aws/ec2/attachment_collection.rb +1 -6
  46. data/lib/aws/ec2/availability_zone.rb +0 -2
  47. data/lib/aws/ec2/availability_zone_collection.rb +0 -3
  48. data/lib/aws/ec2/client.rb +6 -9
  49. data/lib/aws/ec2/client/xml.rb +3 -6
  50. data/lib/aws/ec2/collection.rb +1 -4
  51. data/lib/aws/ec2/config.rb +18 -0
  52. data/lib/aws/ec2/elastic_ip.rb +0 -2
  53. data/lib/aws/ec2/elastic_ip_collection.rb +0 -4
  54. data/lib/aws/ec2/errors.rb +1 -4
  55. data/lib/aws/ec2/has_permissions.rb +0 -2
  56. data/lib/aws/ec2/image.rb +0 -5
  57. data/lib/aws/ec2/image_collection.rb +0 -6
  58. data/lib/aws/ec2/instance.rb +23 -9
  59. data/lib/aws/ec2/instance_collection.rb +85 -22
  60. data/lib/aws/ec2/key_pair.rb +0 -2
  61. data/lib/aws/ec2/key_pair_collection.rb +1 -4
  62. data/lib/aws/ec2/permission_collection.rb +2 -5
  63. data/lib/aws/ec2/region.rb +0 -2
  64. data/lib/aws/ec2/region_collection.rb +0 -4
  65. data/lib/aws/ec2/request.rb +4 -9
  66. data/lib/aws/ec2/reserved_instances.rb +0 -3
  67. data/lib/aws/ec2/reserved_instances_collection.rb +0 -4
  68. data/lib/aws/ec2/reserved_instances_offering.rb +0 -3
  69. data/lib/aws/ec2/reserved_instances_offering_collection.rb +0 -4
  70. data/lib/aws/ec2/resource.rb +3 -5
  71. data/lib/aws/ec2/resource_tag_collection.rb +1 -6
  72. data/lib/aws/ec2/security_group.rb +204 -72
  73. data/lib/aws/ec2/security_group/egress_ip_permission_collection.rb +53 -0
  74. data/lib/aws/ec2/security_group/ip_permission.rb +92 -10
  75. data/lib/aws/ec2/security_group/ip_permission_collection.rb +14 -15
  76. data/lib/aws/ec2/security_group_collection.rb +11 -8
  77. data/lib/aws/ec2/snapshot.rb +0 -4
  78. data/lib/aws/ec2/snapshot_collection.rb +0 -4
  79. data/lib/aws/ec2/tag.rb +0 -3
  80. data/lib/aws/ec2/tag_collection.rb +1 -8
  81. data/lib/aws/ec2/tagged_item.rb +1 -3
  82. data/lib/aws/ec2/volume.rb +0 -6
  83. data/lib/aws/ec2/volume_collection.rb +0 -4
  84. data/lib/aws/errors.rb +0 -3
  85. data/lib/aws/iam.rb +33 -12
  86. data/lib/aws/iam/access_key.rb +0 -3
  87. data/lib/aws/iam/access_key_collection.rb +0 -3
  88. data/lib/aws/iam/account_alias_collection.rb +0 -2
  89. data/lib/aws/iam/client.rb +6 -8
  90. data/lib/aws/iam/client/xml.rb +4 -8
  91. data/lib/aws/iam/collection.rb +2 -5
  92. data/lib/aws/iam/config.rb +18 -0
  93. data/lib/aws/iam/errors.rb +2 -4
  94. data/lib/aws/iam/group.rb +0 -5
  95. data/lib/aws/iam/group_collection.rb +0 -3
  96. data/lib/aws/iam/group_policy_collection.rb +0 -2
  97. data/lib/aws/iam/group_user_collection.rb +1 -4
  98. data/lib/aws/iam/login_profile.rb +0 -2
  99. data/lib/aws/iam/mfa_device.rb +1 -3
  100. data/lib/aws/iam/mfa_device_collection.rb +0 -3
  101. data/lib/aws/iam/policy.rb +2 -4
  102. data/lib/aws/iam/policy_collection.rb +0 -3
  103. data/lib/aws/iam/request.rb +3 -7
  104. data/lib/aws/iam/resource.rb +1 -4
  105. data/lib/aws/iam/server_certificate.rb +0 -2
  106. data/lib/aws/iam/server_certificate_collection.rb +0 -3
  107. data/lib/aws/iam/signing_certificate.rb +0 -2
  108. data/lib/aws/iam/signing_certificate_collection.rb +0 -3
  109. data/lib/aws/iam/user.rb +0 -7
  110. data/lib/aws/iam/user_collection.rb +0 -3
  111. data/lib/aws/iam/user_group_collection.rb +0 -3
  112. data/lib/aws/iam/user_policy.rb +0 -2
  113. data/lib/aws/iam/user_policy_collection.rb +0 -3
  114. data/lib/aws/rails.rb +5 -4
  115. data/lib/aws/record.rb +4 -1
  116. data/lib/aws/record/base.rb +3 -2
  117. data/lib/aws/record/errors.rb +1 -3
  118. data/lib/aws/s3.rb +31 -6
  119. data/lib/aws/s3/access_control_list.rb +0 -2
  120. data/lib/aws/s3/acl_object.rb +10 -12
  121. data/lib/aws/s3/bucket.rb +1 -9
  122. data/lib/aws/s3/bucket_collection.rb +2 -5
  123. data/lib/aws/s3/bucket_version_collection.rb +1 -5
  124. data/lib/aws/s3/client.rb +34 -37
  125. data/lib/aws/s3/client/xml.rb +11 -14
  126. data/lib/aws/{resource_cache.rb → s3/config.rb} +6 -20
  127. data/lib/aws/s3/errors.rb +6 -7
  128. data/lib/aws/s3/multipart_upload.rb +1 -4
  129. data/lib/aws/s3/multipart_upload_collection.rb +1 -6
  130. data/lib/aws/s3/object_collection.rb +1 -5
  131. data/lib/aws/s3/object_metadata.rb +1 -3
  132. data/lib/aws/s3/object_upload_collection.rb +1 -7
  133. data/lib/aws/s3/object_version.rb +1 -4
  134. data/lib/aws/s3/object_version_collection.rb +1 -4
  135. data/lib/aws/s3/policy.rb +3 -5
  136. data/lib/aws/s3/prefix_and_delimiter_collection.rb +0 -2
  137. data/lib/aws/s3/prefixed_collection.rb +0 -2
  138. data/lib/aws/s3/presigned_post.rb +1 -3
  139. data/lib/aws/s3/request.rb +2 -5
  140. data/lib/aws/s3/s3_object.rb +1 -8
  141. data/lib/aws/s3/tree.rb +8 -6
  142. data/lib/aws/s3/tree/branch_node.rb +0 -3
  143. data/lib/aws/s3/tree/child_collection.rb +1 -5
  144. data/lib/aws/s3/tree/leaf_node.rb +0 -5
  145. data/lib/aws/s3/tree/parent.rb +1 -4
  146. data/lib/aws/s3/uploaded_part.rb +1 -3
  147. data/lib/aws/s3/uploaded_part_collection.rb +1 -5
  148. data/lib/aws/simple_db.rb +21 -6
  149. data/lib/aws/simple_db/attribute.rb +1 -6
  150. data/lib/aws/simple_db/attribute_collection.rb +1 -7
  151. data/lib/aws/simple_db/client.rb +7 -9
  152. data/lib/aws/simple_db/client/options.rb +2 -4
  153. data/lib/aws/simple_db/client/xml.rb +5 -10
  154. data/lib/aws/{naming.rb → simple_db/config.rb} +3 -14
  155. data/lib/aws/simple_db/delete_attributes.rb +0 -2
  156. data/lib/aws/simple_db/domain.rb +1 -6
  157. data/lib/aws/simple_db/domain_collection.rb +1 -4
  158. data/lib/aws/simple_db/domain_metadata.rb +1 -3
  159. data/lib/aws/simple_db/errors.rb +1 -4
  160. data/lib/aws/simple_db/item.rb +1 -7
  161. data/lib/aws/simple_db/item_collection.rb +22 -23
  162. data/lib/aws/simple_db/put_attributes.rb +0 -2
  163. data/lib/aws/simple_db/request.rb +3 -7
  164. data/lib/aws/simple_email_service.rb +11 -6
  165. data/lib/aws/simple_email_service/client.rb +7 -9
  166. data/lib/aws/simple_email_service/client/options.rb +3 -6
  167. data/lib/aws/simple_email_service/client/xml.rb +4 -8
  168. data/lib/aws/simple_email_service/config.rb +19 -0
  169. data/lib/aws/simple_email_service/email_address_collection.rb +1 -3
  170. data/lib/aws/simple_email_service/errors.rb +1 -4
  171. data/lib/aws/simple_email_service/quotas.rb +1 -3
  172. data/lib/aws/simple_email_service/request.rb +3 -7
  173. data/lib/aws/sns.rb +15 -8
  174. data/lib/aws/sns/client.rb +7 -8
  175. data/lib/aws/sns/client/options.rb +3 -6
  176. data/lib/aws/sns/client/xml.rb +4 -8
  177. data/lib/aws/sns/config.rb +18 -0
  178. data/lib/aws/sns/errors.rb +1 -4
  179. data/lib/aws/sns/policy.rb +3 -5
  180. data/lib/aws/sns/request.rb +4 -9
  181. data/lib/aws/sns/subscription.rb +1 -5
  182. data/lib/aws/sns/subscription_collection.rb +1 -5
  183. data/lib/aws/sns/topic.rb +1 -6
  184. data/lib/aws/sns/topic_collection.rb +1 -4
  185. data/lib/aws/sns/topic_subscription_collection.rb +1 -4
  186. data/lib/aws/sqs.rb +14 -5
  187. data/lib/aws/sqs/client.rb +6 -9
  188. data/lib/aws/sqs/client/xml.rb +4 -7
  189. data/lib/aws/sqs/config.rb +18 -0
  190. data/lib/aws/sqs/errors.rb +1 -4
  191. data/lib/aws/sqs/policy.rb +3 -5
  192. data/lib/aws/sqs/queue.rb +2 -7
  193. data/lib/aws/sqs/queue_collection.rb +4 -5
  194. data/lib/aws/sqs/received_message.rb +1 -3
  195. data/lib/aws/sqs/received_sns_message.rb +2 -2
  196. data/lib/aws/sqs/request.rb +4 -7
  197. data/lib/aws/sts.rb +12 -6
  198. data/lib/aws/sts/client.rb +6 -8
  199. data/lib/aws/sts/client/xml.rb +4 -8
  200. data/lib/aws/sts/config.rb +18 -0
  201. data/lib/aws/sts/errors.rb +1 -4
  202. data/lib/aws/sts/federated_session.rb +0 -2
  203. data/lib/aws/sts/policy.rb +3 -5
  204. data/lib/aws/sts/request.rb +3 -7
  205. metadata +60 -50
  206. data/lib/aws/async_handle.rb +0 -90
  207. data/lib/aws/authorize_v2.rb +0 -37
  208. data/lib/aws/base_client.rb +0 -488
  209. data/lib/aws/cacheable.rb +0 -79
  210. data/lib/aws/client_logging.rb +0 -122
  211. data/lib/aws/collections.rb +0 -230
  212. data/lib/aws/configuration.rb +0 -357
  213. data/lib/aws/configured_client_methods.rb +0 -81
  214. data/lib/aws/configured_grammars.rb +0 -65
  215. data/lib/aws/default_signer.rb +0 -65
  216. data/lib/aws/http/curb_handler.rb +0 -127
  217. data/lib/aws/http/handler.rb +0 -77
  218. data/lib/aws/http/httparty_handler.rb +0 -103
  219. data/lib/aws/http/request.rb +0 -165
  220. data/lib/aws/http/request_param.rb +0 -64
  221. data/lib/aws/http/response.rb +0 -72
  222. data/lib/aws/indifferent_hash.rb +0 -86
  223. data/lib/aws/inflection.rb +0 -46
  224. data/lib/aws/lazy_error_classes.rb +0 -64
  225. data/lib/aws/meta_utils.rb +0 -43
  226. data/lib/aws/model.rb +0 -57
  227. data/lib/aws/option_grammar.rb +0 -565
  228. data/lib/aws/policy.rb +0 -914
  229. data/lib/aws/resource.rb +0 -381
  230. data/lib/aws/response.rb +0 -125
  231. data/lib/aws/response_cache.rb +0 -50
  232. data/lib/aws/service_interface.rb +0 -60
  233. data/lib/aws/xml_grammar.rb +0 -925
@@ -13,9 +13,10 @@
13
13
 
14
14
  # todo move these to included modules (like validations and naming)
15
15
 
16
+ require 'aws/simple_db'
17
+
16
18
  require 'set'
17
19
  require 'uuidtools'
18
- require 'aws/indifferent_hash'
19
20
 
20
21
  require 'aws/record/naming'
21
22
  require 'aws/record/attribute_macros'
@@ -318,7 +319,7 @@ module AWS
318
319
  # @return [Hash] A hash with attribute names as hash keys (strings) and
319
320
  # attribute values (of mixed types) as hash values.
320
321
  def attributes
321
- attributes = IndifferentHash.new
322
+ attributes = Core::IndifferentHash.new
322
323
  attributes['id'] = id if persisted?
323
324
  self.class.attributes.keys.inject(attributes) do |hash,attr_name|
324
325
  hash[attr_name] = __send__(attr_name)
@@ -11,8 +11,6 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/indifferent_hash'
15
-
16
14
  module AWS
17
15
  module Record
18
16
 
@@ -24,7 +22,7 @@ module AWS
24
22
 
25
23
  end
26
24
 
27
- class Errors < IndifferentHash
25
+ class Errors < Core::IndifferentHash
28
26
 
29
27
  include Enumerable
30
28
 
@@ -11,11 +11,8 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/common'
15
- require 'aws/service_interface'
16
- require 'aws/s3/client'
17
- require 'aws/s3/errors'
18
- require 'aws/s3/bucket_collection'
14
+ require 'aws/core'
15
+ require 'aws/s3/config'
19
16
 
20
17
  module AWS
21
18
 
@@ -97,7 +94,35 @@ module AWS
97
94
  #
98
95
  class S3
99
96
 
100
- include ServiceInterface
97
+ AWS.register_autoloads(self) do
98
+ autoload :AccessControlList, 'access_control_list'
99
+ autoload :ACLObject, 'acl_object'
100
+ autoload :Bucket, 'bucket'
101
+ autoload :BucketCollection, 'bucket_collection'
102
+ autoload :BucketVersionCollection, 'bucket_version_collection'
103
+ autoload :Client, 'client'
104
+ autoload :DataOptions, 'data_options'
105
+ autoload :Errors, 'errors'
106
+ autoload :MultipartUpload, 'multipart_upload'
107
+ autoload :MultipartUploadCollection, 'multipart_upload_collection'
108
+ autoload :ObjectCollection, 'object_collection'
109
+ autoload :ObjectMetadata, 'object_metadata'
110
+ autoload :ObjectUploadCollection, 'object_upload_collection'
111
+ autoload :ObjectVersion, 'object_version'
112
+ autoload :ObjectVersionCollection, 'object_version_collection'
113
+ autoload :PaginatedCollection, 'paginated_collection'
114
+ autoload :Policy, 'policy'
115
+ autoload :PrefixAndDelimiterCollection, 'prefix_and_delimiter_collection'
116
+ autoload :PrefixedCollection, 'prefixed_collection'
117
+ autoload :PresignedPost, 'presigned_post'
118
+ autoload :Request, 'request'
119
+ autoload :S3Object, 's3_object'
120
+ autoload :Tree, 'tree'
121
+ autoload :UploadedPart, 'uploaded_part'
122
+ autoload :UploadedPartCollection, 'uploaded_part_collection'
123
+ end
124
+
125
+ include Core::ServiceInterface
101
126
 
102
127
  # @return [BucketCollection] Returns a collection that represents all
103
128
  # buckets in the account.
@@ -11,8 +11,6 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/s3/acl_object'
15
-
16
14
  module AWS
17
15
  class S3
18
16
 
@@ -11,8 +11,6 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/meta_utils'
15
- require 'aws/inflection'
16
14
  require 'rexml/text'
17
15
 
18
16
  module AWS
@@ -81,7 +79,7 @@ module AWS
81
79
 
82
80
  def string_attr(element_name, options = {})
83
81
  method_name = options[:method_name] ||
84
- Inflection.ruby_name(element_name)
82
+ Core::Inflection.ruby_name(element_name)
85
83
 
86
84
  attr_accessor(method_name)
87
85
  setter_option(method_name)
@@ -92,7 +90,7 @@ module AWS
92
90
 
93
91
  def object_attr(klass, options = {})
94
92
  base_name = klass.name[/::([^:]*)$/, 1]
95
- method_name = Inflection.ruby_name(base_name)
93
+ method_name = Core::Inflection.ruby_name(base_name)
96
94
  cast = options[:cast] || Hash
97
95
 
98
96
  attr_reader(method_name)
@@ -105,7 +103,7 @@ module AWS
105
103
 
106
104
  def object_list_attr(list_element, klass, options = {})
107
105
  base_name = klass.name[/::([^:]*)$/, 1]
108
- method_name = Inflection.ruby_name(options[:method_name].to_s || list_element)
106
+ method_name = Core::Inflection.ruby_name(options[:method_name].to_s || list_element)
109
107
  default_value = nil
110
108
  default_value = [] if options[:required]
111
109
 
@@ -118,7 +116,7 @@ module AWS
118
116
  end
119
117
 
120
118
  def setter_option(method_name)
121
- MetaUtils.class_extend_method(self, :initialize) do |*args|
119
+ Core::MetaUtils.class_extend_method(self, :initialize) do |*args|
122
120
  opts = args.last || {}
123
121
  instance_variable_set("@#{method_name}", yield) if block_given?
124
122
  key = method_name.to_sym
@@ -168,8 +166,8 @@ module AWS
168
166
 
169
167
  def input_validator(method_name, &blk)
170
168
  validator = "__validator__#{blk.object_id}"
171
- MetaUtils.class_extend_method(self, validator, &blk)
172
- MetaUtils.class_extend_method(self, "validate_#{method_name}_input!") do |*args|
169
+ Core::MetaUtils.class_extend_method(self, validator, &blk)
170
+ Core::MetaUtils.class_extend_method(self, "validate_#{method_name}_input!") do |*args|
173
171
  (value, context) = args
174
172
  context = " "+context if context
175
173
  context ||= ""
@@ -202,14 +200,14 @@ module AWS
202
200
  end
203
201
 
204
202
  def validate_string(method_name)
205
- MetaUtils.class_extend_method(self, :validate!) do
203
+ Core::MetaUtils.class_extend_method(self, :validate!) do
206
204
  super()
207
205
  raise "missing #{method_name}" unless send(method_name)
208
206
  end
209
207
  end
210
208
 
211
209
  def validate_object(method_name)
212
- MetaUtils.class_extend_method(self, :validate!) do
210
+ Core::MetaUtils.class_extend_method(self, :validate!) do
213
211
  super()
214
212
  raise "missing #{method_name}" unless send(method_name)
215
213
  send(method_name).validate!
@@ -217,7 +215,7 @@ module AWS
217
215
  end
218
216
 
219
217
  def validate_list(method_name)
220
- MetaUtils.class_extend_method(self, :validate!) do
218
+ Core::MetaUtils.class_extend_method(self, :validate!) do
221
219
  super()
222
220
  raise "missing #{method_name}" unless send(method_name)
223
221
  send(method_name).each { |member| member.validate! }
@@ -247,7 +245,7 @@ module AWS
247
245
  end
248
246
 
249
247
  def add_xml_child(method_name)
250
- MetaUtils.class_extend_method(self, :body_xml) do
248
+ Core::MetaUtils.class_extend_method(self, :body_xml) do
251
249
  xml = super()
252
250
  value = send(method_name)
253
251
  xml += yield(value) if value
@@ -11,14 +11,6 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/model'
15
- require 'aws/s3/object_collection'
16
- require 'aws/s3/bucket_version_collection'
17
- require 'aws/s3/object_version_collection'
18
- require 'aws/s3/multipart_upload_collection'
19
- require 'aws/s3/tree'
20
- require 'aws/meta_utils'
21
-
22
14
  module AWS
23
15
  class S3
24
16
 
@@ -34,7 +26,7 @@ module AWS
34
26
  #
35
27
  class Bucket
36
28
 
37
- include Model
29
+ include Core::Model
38
30
 
39
31
  # @param [String] name
40
32
  # @param [Hash] options
@@ -11,9 +11,6 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/model'
15
- require 'aws/s3/bucket'
16
-
17
14
  module AWS
18
15
  class S3
19
16
 
@@ -36,7 +33,7 @@ module AWS
36
33
  #
37
34
  class BucketCollection
38
35
 
39
- include Model
36
+ include Core::Model
40
37
  include Enumerable
41
38
 
42
39
  # Creates and returns a new Bucket. For example:
@@ -79,7 +76,7 @@ module AWS
79
76
  # :public_read_write, :authenticated_read, :bucket_owner_read and
80
77
  # :bucket_owner_full_control
81
78
  # @return [Bucket]
82
- def create(bucket_name, options = {})
79
+ def create bucket_name, options = {}
83
80
 
84
81
  # auto set the location constraint for the user if it is not
85
82
  # passed in and the endpoint is not the us-standard region. don't
@@ -11,10 +11,6 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/model'
15
- require 'aws/s3/object_version'
16
- require 'aws/s3/prefix_and_delimiter_collection'
17
-
18
14
  module AWS
19
15
  class S3
20
16
 
@@ -23,7 +19,7 @@ module AWS
23
19
  # @see PrefixedCollection
24
20
  class BucketVersionCollection
25
21
 
26
- include Model
22
+ include Core::Model
27
23
  include Enumerable
28
24
  include PrefixAndDelimiterCollection
29
25
 
@@ -11,19 +11,10 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- require 'aws/s3/request'
15
- require 'aws/http/response'
16
- require 'aws/base_client'
17
- require 'aws/s3/errors'
18
- require 'aws/s3/data_options'
19
- require 'aws/uri_escape'
20
- require 'aws/s3/access_control_list'
21
- require 'aws/s3/policy'
22
- require 'aws/s3/client/xml'
14
+ require 'rexml/document'
23
15
  require 'pathname'
24
16
  require 'stringio'
25
17
  require 'json'
26
- require 'rexml/document'
27
18
 
28
19
  module AWS
29
20
  class S3
@@ -73,7 +64,11 @@ module AWS
73
64
  # response.on_success { p response.buckets.map(&:name) }
74
65
  #
75
66
  # @private
76
- class Client < BaseClient
67
+ class Client < Core::Client
68
+
69
+ AWS.register_autoloads(self) do
70
+ autoload :XML, 'xml'
71
+ end
77
72
 
78
73
  API_VERSION = '2006-03-01'
79
74
 
@@ -85,7 +80,7 @@ module AWS
85
80
  }
86
81
 
87
82
  include DataOptions
88
- include UriEscape
83
+ include Core::UriEscape
89
84
 
90
85
  configure_client
91
86
 
@@ -211,7 +206,7 @@ module AWS
211
206
  # FIXME: this makes unit testing easier, but is there something
212
207
  # we should be doing in case of invalid JSON from the service?
213
208
  policy = Policy.from_json(resp.http_response.body) rescue nil
214
- MetaUtils.extend_method(resp, :policy) { policy }
209
+ Core::MetaUtils.extend_method(resp, :policy) { policy }
215
210
  end
216
211
  end
217
212
 
@@ -248,7 +243,7 @@ module AWS
248
243
  regex = />(.*)<\/LocationConstraint>/
249
244
  matches = response.http_response.body.match(regex)
250
245
  location = matches ? matches[1] : nil
251
- MetaUtils.extend_method(response, :location_constraint) { location }
246
+ Core::MetaUtils.extend_method(response, :location_constraint) { location }
252
247
  end
253
248
  end
254
249
 
@@ -463,7 +458,8 @@ module AWS
463
458
  :content_disposition => 'Content-Disposition',
464
459
  :content_encoding => 'Content-Encoding',
465
460
  :content_type => 'Content-Type',
466
- :storage_class => 'x-amz-storage-class'
461
+ :storage_class => 'x-amz-storage-class',
462
+ :expires => 'Expires'
467
463
  }) do
468
464
  configure_request do |request, options, block|
469
465
  super(request, options)
@@ -474,20 +470,20 @@ module AWS
474
470
  end
475
471
 
476
472
  process_response do |response|
477
- MetaUtils.extend_method(response, :version_id) do
473
+ Core::MetaUtils.extend_method(response, :version_id) do
478
474
  response.http_response.header('x-amz-version-id')
479
475
  end
480
- MetaUtils.extend_method(response, :etag) do
476
+ Core::MetaUtils.extend_method(response, :etag) do
481
477
  response.http_response.header('ETag')
482
478
  end
483
- MetaUtils.extend_method(response, :last_modified) do
479
+ Core::MetaUtils.extend_method(response, :last_modified) do
484
480
  Time.parse(response.http_response.header('Last-Modified'))
485
481
  end
486
482
  end
487
483
 
488
484
  simulate_response do |response|
489
- MetaUtils.extend_method(response, :etag) { "abc123" }
490
- MetaUtils.extend_method(response, :version_id) { nil }
485
+ Core::MetaUtils.extend_method(response, :etag) { "abc123" }
486
+ Core::MetaUtils.extend_method(response, :version_id) { nil }
491
487
  end
492
488
  end
493
489
 
@@ -583,8 +579,8 @@ module AWS
583
579
  end
584
580
 
585
581
  process_response do |resp|
586
- MetaUtils.extend_method(resp, :data) { resp.http_response.body }
587
- MetaUtils.extend_method(resp, :version_id) do
582
+ Core::MetaUtils.extend_method(resp, :data) { resp.http_response.body }
583
+ Core::MetaUtils.extend_method(resp, :version_id) do
588
584
  http_response.header('x-amz-version-id')
589
585
  end
590
586
  end
@@ -601,7 +597,7 @@ module AWS
601
597
  process_response do |resp|
602
598
 
603
599
  # create a hash of user-supplied metadata
604
- MetaUtils.extend_method(resp, :meta) do
600
+ Core::MetaUtils.extend_method(resp, :meta) do
605
601
  meta = {}
606
602
  resp.http_response.headers.each_pair do |name,value|
607
603
  if name =~ /^x-amz-meta-(.+)$/i
@@ -617,16 +613,16 @@ module AWS
617
613
  'content-type' => :content_type,
618
614
  'etag' => :etag,
619
615
  }.each_pair do |header,method|
620
- MetaUtils.extend_method(resp, method) do
616
+ Core::MetaUtils.extend_method(resp, method) do
621
617
  http_response.header(header)
622
618
  end
623
619
  end
624
620
 
625
- MetaUtils.extend_method(resp, :last_modified) do
621
+ Core::MetaUtils.extend_method(resp, :last_modified) do
626
622
  Time.parse(resp.http_response.header('Last-Modified'))
627
623
  end
628
624
 
629
- MetaUtils.extend_method(resp, :content_length) do
625
+ Core::MetaUtils.extend_method(resp, :content_length) do
630
626
  http_response.header('content-length').to_i
631
627
  end
632
628
  end
@@ -641,7 +637,7 @@ module AWS
641
637
  end
642
638
 
643
639
  process_response do |resp|
644
- MetaUtils.extend_method(resp, :version_id) do
640
+ Core::MetaUtils.extend_method(resp, :version_id) do
645
641
  http_response.header('x-amz-version-id')
646
642
  end
647
643
  end
@@ -667,7 +663,8 @@ module AWS
667
663
  :content_disposition => 'Content-Disposition',
668
664
  :content_encoding => 'Content-Encoding',
669
665
  :content_type => 'Content-Type',
670
- :storage_class => 'x-amz-storage-class'
666
+ :storage_class => 'x-amz-storage-class',
667
+ :expires => 'Expires'
671
668
  }) do
672
669
  configure_request do |req, options|
673
670
  super(req, options)
@@ -708,16 +705,16 @@ module AWS
708
705
  end
709
706
 
710
707
  process_response do |response|
711
- MetaUtils.extend_method(response, :etag) do
708
+ Core::MetaUtils.extend_method(response, :etag) do
712
709
  response.http_response.header('ETag')
713
710
  end
714
- MetaUtils.extend_method(response, :last_modified) do
711
+ Core::MetaUtils.extend_method(response, :last_modified) do
715
712
  Time.parse(response.http_response.header('Last-Modified'))
716
713
  end
717
714
  end
718
715
 
719
716
  simulate_response do |response|
720
- MetaUtils.extend_method(response, :etag) { "abc123" }
717
+ Core::MetaUtils.extend_method(response, :etag) { "abc123" }
721
718
  end
722
719
  end
723
720
 
@@ -739,13 +736,13 @@ module AWS
739
736
  end
740
737
 
741
738
  process_response do |response|
742
- MetaUtils.extend_method(response, :version_id) do
739
+ Core::MetaUtils.extend_method(response, :version_id) do
743
740
  response.http_response.header('x-amz-version-id')
744
741
  end
745
742
  end
746
743
 
747
744
  simulate_response do |response|
748
- MetaUtils.extend_method(response, :version_id) { nil }
745
+ Core::MetaUtils.extend_method(response, :version_id) { nil }
749
746
  end
750
747
  end
751
748
 
@@ -807,13 +804,13 @@ module AWS
807
804
  end
808
805
 
809
806
  process_response do |response|
810
- MetaUtils.extend_method(response, :version_id) do
807
+ Core::MetaUtils.extend_method(response, :version_id) do
811
808
  response.http_response.header('x-amz-version-id')
812
809
  end
813
- MetaUtils.extend_method(response, :etag) do
810
+ Core::MetaUtils.extend_method(response, :etag) do
814
811
  response.http_response.header('ETag')
815
812
  end
816
- MetaUtils.extend_method(response, :last_modified) do
813
+ Core::MetaUtils.extend_method(response, :last_modified) do
817
814
  Time.parse(response.http_response.header('Last-Modified'))
818
815
  end
819
816
  end
@@ -825,7 +822,7 @@ module AWS
825
822
  (response.http_response.status >= 300 ||
826
823
  response.request_type == :complete_multipart_upload) and
827
824
  response.http_response.body and
828
- XmlGrammar.parse(response.http_response.body).respond_to?(:code)
825
+ Core::XmlGrammar.parse(response.http_response.body).respond_to?(:code)
829
826
  end
830
827
 
831
828
  protected