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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e81ed6ef23a58d667060e642a3ee6cf36392022
4
- data.tar.gz: b72e96af0cda8734b70184b8b8c44c8e43c96cb1
3
+ metadata.gz: 0fcb07304adf704782f6efa56e7268053a5ce47a
4
+ data.tar.gz: 9a78ffba97f3dc9cd8ca74cbc65f4252fec10688
5
5
  SHA512:
6
- metadata.gz: ad0f86d6ae014b66bd81a27066ffee36827fc9270f71d1ec0a8bff497a50609a47e7eca20aaa74b5adc6417c919962bcdde4867c0370738a6386f593d460d3e5
7
- data.tar.gz: a3799c9540cf7d5f82856cefcf161a30f2b950bec8014b64337d54072b2066595d85b952da020ffbdd535bd8026effb642d00a5f34863ce73ce7475c2c38ef06
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
- * `access_key_id` (optional, if not present, the blobstore client operates in read only mode)
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, the blobstore client operates in read only mode)
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[:access_key_id].nil? && @options[:secret_access_key].nil?
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
@@ -1,7 +1,7 @@
1
1
  module Bosh
2
2
  module Blobstore
3
3
  class Client
4
- VERSION = '1.3074.0'
4
+ VERSION = '1.3087.0'
5
5
  end
6
6
  end
7
7
  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.3074.0
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-19 00:00:00.000000000 Z
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.3074.0
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.3074.0
96
+ version: 1.3087.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement