blobstore_client 1.3048.0 → 1.3050.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 +3 -12
- data/lib/blobstore_client.rb +0 -1
- data/lib/blobstore_client/client.rb +1 -1
- data/lib/blobstore_client/version.rb +1 -1
- metadata +7 -22
- data/lib/blobstore_client/atmos_blobstore_client.rb +0 -115
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3b859784c32099e961274f50076eb4c01c0ca85
|
4
|
+
data.tar.gz: 4cc43968e3f02a04c377f1cb6270c6b8a91f2fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fac64d967832388dd5a15a4bd7fa633fb9f7d2f7afc5170a43c710e03b5cabe6a77221fb0d5cdf1cb0fcd80d7cb593b2928eccbab75c25c8f032fc795feb03a
|
7
|
+
data.tar.gz: ac7e9e942ccc3e1ff6743f1e96496867ca4712688f4a11129bd502568dd144eb3225b1b51e72abae5a139f1189bb11738d108504e6a289f2a70a575f71490c85
|
data/README.md
CHANGED
@@ -67,17 +67,6 @@ These are the options for the Blobstore client when provider is `s3`:
|
|
67
67
|
* `secret_access_key` (optional, if not present, the blobstore client operates in read only mode)
|
68
68
|
S3 Secret Access Key
|
69
69
|
|
70
|
-
### Atmos
|
71
|
-
|
72
|
-
These are the options for the Blobstore client when provider is `atmos`:
|
73
|
-
|
74
|
-
* `url` (required)
|
75
|
-
Atmos URL
|
76
|
-
* `uid` (required)
|
77
|
-
Atmos UID
|
78
|
-
* `secret` (required)
|
79
|
-
Atmos password
|
80
|
-
|
81
70
|
### OpenStack Swift provider
|
82
71
|
|
83
72
|
These are the options for the Blobstore client when provider is `swift`:
|
@@ -112,6 +101,8 @@ These are the options for the Blobstore client when `swift_provider` is `opensta
|
|
112
101
|
OpenStack API key
|
113
102
|
* `openstack_tenant` (required)
|
114
103
|
OpenStack tenant name
|
104
|
+
* `openstack_domain` (optional)
|
105
|
+
OpenStack domain
|
115
106
|
* `openstack_region` (optional)
|
116
107
|
OpenStack region
|
117
108
|
|
@@ -124,4 +115,4 @@ These are the options for the Blobstore client when `swift_provider` is `rackspa
|
|
124
115
|
* `rackspace_api_key` (required)
|
125
116
|
Rackspace Cloud Files API Key
|
126
117
|
* `rackspace_region` (optional)
|
127
|
-
Rackspace Cloud Files Region (`dfw` or `ord`)
|
118
|
+
Rackspace Cloud Files Region (`dfw` or `ord`)
|
data/lib/blobstore_client.rb
CHANGED
@@ -10,6 +10,5 @@ require 'blobstore_client/sha1_verifiable_blobstore_client'
|
|
10
10
|
Bosh::Blobstore.autoload(:S3BlobstoreClient, 'blobstore_client/s3_blobstore_client')
|
11
11
|
Bosh::Blobstore.autoload(:SimpleBlobstoreClient, 'blobstore_client/simple_blobstore_client')
|
12
12
|
Bosh::Blobstore.autoload(:SwiftBlobstoreClient, 'blobstore_client/swift_blobstore_client')
|
13
|
-
Bosh::Blobstore.autoload(:AtmosBlobstoreClient, 'blobstore_client/atmos_blobstore_client')
|
14
13
|
Bosh::Blobstore.autoload(:LocalClient, 'blobstore_client/local_client')
|
15
14
|
Bosh::Blobstore.autoload(:DavBlobstoreClient, 'blobstore_client/dav_blobstore_client')
|
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.3050.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-08-
|
11
|
+
date: 2015-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.31.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.31.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: httpclient
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,34 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.1'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: ruby-atmos-pure
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.0.5
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.0.5
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: bosh_common
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - "~>"
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
89
|
+
version: 1.3050.0
|
104
90
|
type: :runtime
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
96
|
+
version: 1.3050.0
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: rspec
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,7 +166,7 @@ dependencies:
|
|
180
166
|
version: '0'
|
181
167
|
description: |-
|
182
168
|
BOSH blobstore client
|
183
|
-
|
169
|
+
b92cdc
|
184
170
|
email: support@cloudfoundry.com
|
185
171
|
executables:
|
186
172
|
- blobstore_client_console
|
@@ -191,7 +177,6 @@ files:
|
|
191
177
|
- bin/blobstore_client_console
|
192
178
|
- config/local.yml.example
|
193
179
|
- lib/blobstore_client.rb
|
194
|
-
- lib/blobstore_client/atmos_blobstore_client.rb
|
195
180
|
- lib/blobstore_client/base.rb
|
196
181
|
- lib/blobstore_client/client.rb
|
197
182
|
- lib/blobstore_client/dav_blobstore_client.rb
|
@@ -1,115 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009-2012 VMware, Inc.
|
2
|
-
|
3
|
-
require 'atmos'
|
4
|
-
require 'uri'
|
5
|
-
require 'multi_json'
|
6
|
-
require 'httpclient'
|
7
|
-
|
8
|
-
module Bosh
|
9
|
-
module Blobstore
|
10
|
-
class AtmosBlobstoreClient < BaseClient
|
11
|
-
SHARE_URL_EXP = '1893484800' # expires on 2030 Jan-1
|
12
|
-
|
13
|
-
def initialize(options)
|
14
|
-
super(options)
|
15
|
-
@atmos_options = {
|
16
|
-
url: @options[:url],
|
17
|
-
uid: @options[:uid],
|
18
|
-
secret: @options[:secret]
|
19
|
-
}
|
20
|
-
@tag = @options[:tag]
|
21
|
-
|
22
|
-
if @options[:unsupported]
|
23
|
-
@atmos_options[:unsupported] = @options[:unsupported]
|
24
|
-
end
|
25
|
-
|
26
|
-
# Add proxy if ENV has the variable
|
27
|
-
proxy = case URI.parse(@atmos_options[:url] || '').scheme
|
28
|
-
when 'https'
|
29
|
-
ENV['HTTPS_PROXY'] || ENV['https_proxy']
|
30
|
-
when 'http'
|
31
|
-
ENV['HTTP_PROXY'] || ENV['http_proxy']
|
32
|
-
else
|
33
|
-
nil
|
34
|
-
end
|
35
|
-
if proxy
|
36
|
-
@atmos_options[:proxy] = proxy
|
37
|
-
@http_client = HTTPClient.new(proxy: proxy)
|
38
|
-
end
|
39
|
-
@http_client ||= HTTPClient.new
|
40
|
-
@http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
41
|
-
end
|
42
|
-
|
43
|
-
def atmos_server
|
44
|
-
raise 'Atmos password is missing (read-only mode)' unless @atmos_options[:secret]
|
45
|
-
|
46
|
-
@atmos ||= Atmos::Store.new(@atmos_options)
|
47
|
-
end
|
48
|
-
|
49
|
-
protected
|
50
|
-
|
51
|
-
def create_file(id, file)
|
52
|
-
raise BlobstoreError, 'Atmos does not support supplying the object id' if id
|
53
|
-
obj_conf = { data: file, length: File.size(file.path) }
|
54
|
-
obj_conf[:listable_metadata] = { @tag => true } if @tag
|
55
|
-
object_id = atmos_server.create(obj_conf).aoid
|
56
|
-
encode_object_id(object_id)
|
57
|
-
end
|
58
|
-
|
59
|
-
def get_file(object_id, file)
|
60
|
-
object_info = decode_object_id(object_id)
|
61
|
-
oid = object_info['oid']
|
62
|
-
sig = object_info['sig']
|
63
|
-
|
64
|
-
url = @atmos_options[:url] + "/rest/objects/#{oid}?uid=" +
|
65
|
-
URI.escape(@atmos_options[:uid]) +
|
66
|
-
"&expires=#{SHARE_URL_EXP}&signature=#{URI.escape(sig)}"
|
67
|
-
|
68
|
-
response = @http_client.get(url) do |block|
|
69
|
-
file.write(block)
|
70
|
-
end
|
71
|
-
|
72
|
-
if response.status != 200
|
73
|
-
raise BlobstoreError, sprintf('Could not fetch object, %s/%s', [response.status, response.content])
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def delete_object(object_id)
|
78
|
-
object_info = decode_object_id(object_id)
|
79
|
-
oid = object_info['oid']
|
80
|
-
atmos_server.get(id: oid).delete
|
81
|
-
rescue Atmos::Exceptions::NoSuchObjectException
|
82
|
-
raise NotFound, "Atmos object '#{object_id}' not found"
|
83
|
-
end
|
84
|
-
|
85
|
-
def object_exists?(object_id)
|
86
|
-
atmos_server.get(id: object_id).exists?
|
87
|
-
end
|
88
|
-
|
89
|
-
private
|
90
|
-
|
91
|
-
def decode_object_id(object_id)
|
92
|
-
begin
|
93
|
-
object_info = MultiJson.decode(Base64.decode64(URI.unescape(object_id)))
|
94
|
-
rescue MultiJson::DecodeError
|
95
|
-
raise BlobstoreError, 'Failed to parse object_id. Please try updating the release'
|
96
|
-
end
|
97
|
-
|
98
|
-
if !object_info.kind_of?(Hash) || object_info['oid'].nil? ||
|
99
|
-
object_info['sig'].nil?
|
100
|
-
raise BlobstoreError, "Invalid object_id (#{object_id})"
|
101
|
-
end
|
102
|
-
object_info
|
103
|
-
end
|
104
|
-
|
105
|
-
def encode_object_id(object_id)
|
106
|
-
hash_string = "GET\n/rest/objects/#{object_id}\n#{@atmos_options[:uid]}\n#{SHARE_URL_EXP}"
|
107
|
-
secret = Base64.decode64(@atmos_options[:secret])
|
108
|
-
sig = HMAC::SHA1.digest(secret, hash_string)
|
109
|
-
signature = Base64.encode64(sig.to_s).chomp
|
110
|
-
json = MultiJson.encode({ oid: object_id, sig: signature })
|
111
|
-
URI.escape(Base64.encode64(json))
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|