aws-sdk-resources 2.0.2.pre → 2.0.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aws-sdk-resources/definition.rb +10 -5
- data/lib/aws-sdk-resources/operations.rb +1 -1
- data/lib/aws-sdk-resources/s3.rb +46 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a81b17767e316a7a512bb61c9b9cb392a0c7150
|
4
|
+
data.tar.gz: 7630c31ed82206477494004bb74ea2b5fbf03702
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ef040fef33dd3ad75ad628d038de5ec9e1c28e32e875d949aa944fc50921ece4f1637d8b47156b2b396e9999993707dc26a4dfd97ee08d2e93ae381b350c61a
|
7
|
+
data.tar.gz: c69c84b2b228f504aaccf75c19e3074ad5a6e3c139f1e92c58e2fa38211b1731e3df3d6c38e4ff84bdb39d2b383b03e9e9cb2c3477c5ed665afbc9ff39f47103
|
@@ -26,7 +26,7 @@ module Aws
|
|
26
26
|
define_has_many(namespace, resource, definition['hasMany'] || {})
|
27
27
|
define_has_some(namespace, resource, definition['hasSome'] || {})
|
28
28
|
define_has_one(namespace, resource, definition['hasOne'] || {})
|
29
|
-
define_data_attributes(namespace, resource, definition
|
29
|
+
define_data_attributes(namespace, resource, definition)
|
30
30
|
define_subresources(namespace, resource, definition['subResources'] || {})
|
31
31
|
end
|
32
32
|
define_top_level_references(namespace)
|
@@ -109,13 +109,13 @@ module Aws
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
def define_data_attributes(namespace, resource,
|
113
|
-
return unless shape_name
|
112
|
+
def define_data_attributes(namespace, resource, definition)
|
113
|
+
return unless shape_name = definition['shape']
|
114
114
|
shape = resource.client_class.api.shape_map.shape('shape' => shape_name)
|
115
115
|
shape.member_names.each do |member_name|
|
116
116
|
if
|
117
|
-
resource.
|
118
|
-
|
117
|
+
resource.instance_methods.include?(member_name) ||
|
118
|
+
data_attribute_is_an_identifier?(member_name, resource, definition)
|
119
119
|
then
|
120
120
|
next # some data attributes are duplicates to identifiers
|
121
121
|
else
|
@@ -124,6 +124,11 @@ module Aws
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
def data_attribute_is_an_identifier?(attr_name, resource, definition)
|
128
|
+
resource.identifiers.include?(attr_name) ||
|
129
|
+
definition['identifiers'].any? { |i| underscore(i['dataMember']) == attr_name.to_s }
|
130
|
+
end
|
131
|
+
|
127
132
|
def define_load(namespace, resource, definition)
|
128
133
|
return unless definition
|
129
134
|
resource.load_operation = Operations::DataOperation.new(
|
data/lib/aws-sdk-resources/s3.rb
CHANGED
@@ -8,6 +8,52 @@ module Aws
|
|
8
8
|
|
9
9
|
class Object
|
10
10
|
|
11
|
+
# Generates a pre-signed URL for this object.
|
12
|
+
#
|
13
|
+
# @example Pre-signed GET URL, valid for one hour
|
14
|
+
#
|
15
|
+
# obj.presigned_url(:get, expires_in: 3600)
|
16
|
+
# #=> "https://bucket-name.s3.amazonaws.com/object-key?..."
|
17
|
+
#
|
18
|
+
# @example Pre-signed PUT with a canned ACL
|
19
|
+
#
|
20
|
+
# # the object uploaded using this URL will be publicly accessible
|
21
|
+
# obj.presigned_url(:put, acl: 'public-read')
|
22
|
+
# #=> "https://bucket-name.s3.amazonaws.com/object-key?..."
|
23
|
+
#
|
24
|
+
# @param [Symbol] http_method
|
25
|
+
# The HTTP method to generate a presigned URL for. Valid values
|
26
|
+
# are `:get`, `:put`, `:head`, and `:delete`.
|
27
|
+
#
|
28
|
+
# @param [Hash] params
|
29
|
+
# Additional request parameters to use when generating the pre-signed
|
30
|
+
# URL. See the related documentation in {Client} for accepted
|
31
|
+
# params.
|
32
|
+
#
|
33
|
+
# | HTTP Method | Client Method |
|
34
|
+
# |---------------|------------------------|
|
35
|
+
# | `:get` | {Client#put_object} |
|
36
|
+
# | `:put` | {Client#get_object} |
|
37
|
+
# | `:head` | {Client#head_object} |
|
38
|
+
# | `:delete` | {Client#delete_object} |
|
39
|
+
#
|
40
|
+
# @option params [Integer] :exipres_in (900) Number of seconds before
|
41
|
+
# the pre-signed URL expires. This may not exceed one week (604800
|
42
|
+
# seconds).
|
43
|
+
#
|
44
|
+
# @raise [ArgumentError] Raised if `:expires_in` exceeds one week
|
45
|
+
# (604800 seconds).
|
46
|
+
#
|
47
|
+
# @return [String]
|
48
|
+
#
|
49
|
+
def presigned_url(http_method, params = {})
|
50
|
+
presigner = Presigner.new(client: client)
|
51
|
+
presigner.presigned_url("#{http_method.downcase}_object", params.merge(
|
52
|
+
bucket: bucket_name,
|
53
|
+
key: key,
|
54
|
+
))
|
55
|
+
end
|
56
|
+
|
11
57
|
# Uploads a file from disk to the current object in S3.
|
12
58
|
#
|
13
59
|
# @example
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk-resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3.pre
|
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-10-
|
11
|
+
date: 2014-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.
|
19
|
+
version: 2.0.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.
|
26
|
+
version: 2.0.3
|
27
27
|
description: Provides resource-oriented abstractions for AWS.
|
28
28
|
email:
|
29
29
|
executables: []
|
@@ -89,3 +89,4 @@ signing_key:
|
|
89
89
|
specification_version: 4
|
90
90
|
summary: AWS SDK for Ruby - Resources
|
91
91
|
test_files: []
|
92
|
+
has_rdoc:
|