blobstore_client 1.3074.0 → 1.3087.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/lib/blobstore_client/s3_blobstore_client.rb +27 -3
- data/lib/blobstore_client/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fcb07304adf704782f6efa56e7268053a5ce47a
|
4
|
+
data.tar.gz: 9a78ffba97f3dc9cd8ca74cbc65f4252fec10688
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aae542432589f24035b318c91550ddbcf407e988ec5682926937a2b5227bf13b057970555b3d414bc884ab411dcb1c258f69279cc408663c4158fde90b6758d2
|
7
|
+
data.tar.gz: 5f3c190e571ad2dc0c00a5ff6c148fb99cd6aebbb6ed861c0c0b73916480df6db4d0b17300d1038a90f656a561c39ce53ea03bf6ec3cbcda4d953d9afa77c31d
|
data/README.md
CHANGED
@@ -19,7 +19,7 @@ $ blobstore_client_console -p local -c config/local.yml.example
|
|
19
19
|
=> Welcome to BOSH blobstore client console
|
20
20
|
You can use 'bsc' to access blobstore client methods
|
21
21
|
> bsc.create("this is a test blob")
|
22
|
-
=> "ef00746b-21ec-4473-a888-bf257cb7ea21"
|
22
|
+
=> "ef00746b-21ec-4473-a888-bf257cb7ea21"
|
23
23
|
> bsc.get("ef00746b-21ec-4473-a888-bf257cb7ea21")
|
24
24
|
=> "this is a test blob"
|
25
25
|
> bsc.exists?("ef00746b-21ec-4473-a888-bf257cb7ea21")
|
@@ -62,9 +62,11 @@ These are the options for the Blobstore client when provider is `s3`:
|
|
62
62
|
Name of the S3 bucket
|
63
63
|
* `encryption_key` (optional)
|
64
64
|
Encryption_key that is applied before the object is sent to S3
|
65
|
-
* `
|
65
|
+
* `credentials_source` (optional)
|
66
|
+
Where to get AWS credentials. This can be set to `static` for to use an `access_key_id` and `secret_access_key` or `env_or_profile` to get the credentials from environment variables or an EC2 instance profile. Defaults to `static` if not set.
|
67
|
+
* `access_key_id` (optional, if not present and `credentials_source` is `static`, the blobstore client operates in read only mode)
|
66
68
|
S3 Access Key
|
67
|
-
* `secret_access_key` (optional, if not present
|
69
|
+
* `secret_access_key` (optional, if not present and `credentials_source` is `static`, the blobstore client operates in read only mode)
|
68
70
|
S3 Secret Access Key
|
69
71
|
|
70
72
|
### OpenStack Swift provider
|
@@ -29,8 +29,6 @@ module Bosh
|
|
29
29
|
@encryption_key = @options[:encryption_key]
|
30
30
|
|
31
31
|
aws_options = {
|
32
|
-
access_key_id: @options[:access_key_id],
|
33
|
-
secret_access_key: @options[:secret_access_key],
|
34
32
|
use_ssl: @options.fetch(:use_ssl, true),
|
35
33
|
s3_port: @options.fetch(:port, 443),
|
36
34
|
s3_endpoint: @options.fetch(:host, URI.parse(S3BlobstoreClient::ENDPOINT).host),
|
@@ -39,6 +37,8 @@ module Bosh
|
|
39
37
|
s3_multipart_threshold: @options.fetch(:s3_multipart_threshold, 16_777_216),
|
40
38
|
}
|
41
39
|
|
40
|
+
aws_options.merge!(aws_credentials)
|
41
|
+
|
42
42
|
# using S3 without credentials is a special case:
|
43
43
|
# it is really the simple blobstore client with a bucket name
|
44
44
|
if read_only?
|
@@ -165,12 +165,36 @@ module Bosh
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def read_only?
|
168
|
-
@options[:
|
168
|
+
(@options[:credentials_source] == 'static' ||
|
169
|
+
@options[:credentials_source].nil?) &&
|
170
|
+
@options[:access_key_id].nil? &&
|
171
|
+
@options[:secret_access_key].nil?
|
169
172
|
end
|
170
173
|
|
171
174
|
def full_oid_path(object_id)
|
172
175
|
@options[:folder] ? @options[:folder] + '/' + object_id : object_id
|
173
176
|
end
|
177
|
+
|
178
|
+
def aws_credentials
|
179
|
+
creds = {}
|
180
|
+
# credentials_source could be static (default) or env_or_profile
|
181
|
+
# static credentials must be included in aws_properties
|
182
|
+
# env_or_profile credentials will use the AWS DefaultCredentialsProvider
|
183
|
+
# to find AWS credentials in environment variables or EC2 instance profiles
|
184
|
+
case @options.fetch(:credentials_source, 'static')
|
185
|
+
when 'static'
|
186
|
+
creds[:access_key_id] = @options[:access_key_id]
|
187
|
+
creds[:secret_access_key] = @options[:secret_access_key]
|
188
|
+
|
189
|
+
when 'env_or_profile'
|
190
|
+
if !@options[:access_key_id].nil? || !@options[:secret_access_key].nil?
|
191
|
+
raise BlobstoreError, "can't use access_key_id or secret_access_key with env_or_profile credentials_source"
|
192
|
+
end
|
193
|
+
else
|
194
|
+
raise BlobstoreError, 'invalid credentials_source'
|
195
|
+
end
|
196
|
+
return creds
|
197
|
+
end
|
174
198
|
end
|
175
199
|
end
|
176
200
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blobstore_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3087.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: 1.3087.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.3087.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|