bfs-s3 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bfs/bucket/s3.rb +10 -5
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fde16d5ecd59f0ba7892b75083f66886361e5b7dc5efea15f5c28c2cdd7f0b44
4
- data.tar.gz: e5fc5fb205274be7c10071dbc2a8c9c6bbe7c12cc30c90cb0768b1758692183c
3
+ metadata.gz: 759ac37f6057cd72d3a8126cbd2e733745efd8d2a5e0845b0fe1ffa7e4555eba
4
+ data.tar.gz: f988f4496cc91538a70326eba61896b2309b18e70a52604d7389a4857df22a2c
5
5
  SHA512:
6
- metadata.gz: 720120b887769f077a4a5f2ac1874cb71f6c2bc9f11825be5aa41096787d226e50ba18008409a0fad45dbe608f61ac7a1ae0314fb811261e7bd2d09bdbfb2a5b
7
- data.tar.gz: 3c45d88593ebf385de8cc81c292cd86219ea13d8a6d962cf40b96ff06d34bd5188ab97af85b642beb5be39fffb9503cdf41f2fffe03ae23a9574145047c550bb
6
+ metadata.gz: 0db4458fc49076e9c9780c69864d53b21298f286360b4441635210162ad47be74e0c537faac51060a00aaca033aeae063909e84b8a519e0bea5dc47fab56d293
7
+ data.tar.gz: a44ed9a7876cca15c41209207dd8045666bd691f120573d8a04e98b41e40b3911c7766c794e2db21fe9cf4de64bc7037c5a36cf21ad5bfe6117f3b1dcb5cf944
data/lib/bfs/bucket/s3.rb CHANGED
@@ -141,15 +141,20 @@ module BFS
141
141
  config[:credentials] = opts[:credentials] if opts[:credentials]
142
142
  config[:credentials] ||= Aws::Credentials.new(opts[:access_key_id].to_s, opts[:secret_access_key].to_s) if opts[:access_key_id]
143
143
  config[:credentials] ||= Aws::SharedCredentials.new(profile_name: opts[:profile_name]) if opts[:profile_name]
144
- config[:credentials] = Aws::AssumeRoleCredentials.new(
145
- client: config[:credentials] ? Aws::STS::Client.new(credentials: config[:credentials]) : nil,
146
- role_arn: opts[:assume_role],
147
- role_session_name: SecureRandom.urlsafe_base64(12),
148
- ) if opts[:assume_role]
144
+ config[:credentials] = assume_role_credentials(opts[:assume_role], config[:credentials]) if opts[:assume_role]
149
145
 
150
146
  Aws::S3::Client.new(config)
151
147
  end
152
148
 
149
+ def assume_role_credentials(role_arn, credentials = nil)
150
+ opts = {
151
+ role_arn: role_arn,
152
+ role_session_name: SecureRandom.urlsafe_base64(12),
153
+ }
154
+ opts[:client] = Aws::STS::Client.new(credentials: credentials) if credentials
155
+ Aws::AssumeRoleCredentials.new(**opts)
156
+ end
157
+
153
158
  def walk(pattern, **opts)
154
159
  prefix = pattern[%r{^[^*?\{\}\[\]]+/}]
155
160
  prefix = File.join(*[@prefix, prefix].compact) if @prefix
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bfs-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitrij Denissenko
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.3
33
+ version: 0.8.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.8.3
40
+ version: 0.8.4
41
41
  description: https://github.com/bsm/bfs.rb
42
42
  email: dimitrij@blacksquaremedia.com
43
43
  executables: []