Class: Bosh::Blobstore::AtmosBlobstoreClient

Inherits:
BaseClient show all
Defined in:
lib/blobstore_client/atmos_blobstore_client.rb

Constant Summary collapse

SHARE_URL_EXP =

expires on 2030 Jan-1

'1893484800'

Constants inherited from Client

Client::PROVIDER_NAMES, Client::VERSION

Instance Method Summary collapse

Methods inherited from BaseClient

#create, #delete, #exists?, #get

Methods inherited from Client

create, safe_create

Constructor Details

#initialize(options) ⇒ AtmosBlobstoreClient



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/blobstore_client/atmos_blobstore_client.rb', line 13

def initialize(options)
  super(options)
  @atmos_options = {
    url: @options[:url],
    uid: @options[:uid],
    secret: @options[:secret]
  }
  @tag = @options[:tag]

  if @options[:unsupported]
    @atmos_options[:unsupported] = @options[:unsupported]
  end

  # Add proxy if ENV has the variable
  proxy = case URI.parse(@atmos_options[:url] || '').scheme
            when 'https'
              ENV['HTTPS_PROXY'] || ENV['https_proxy']
            when 'http'
              ENV['HTTP_PROXY'] || ENV['http_proxy']
            else
              nil
          end
  if proxy
    @atmos_options[:proxy] = proxy
    @http_client = HTTPClient.new(proxy: proxy)
  end
  @http_client ||= HTTPClient.new
  @http_client.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
end

Instance Method Details

#atmos_serverObject



43
44
45
46
47
# File 'lib/blobstore_client/atmos_blobstore_client.rb', line 43

def atmos_server
  raise 'Atmos password is missing (read-only mode)' unless @atmos_options[:secret]

  @atmos ||= Atmos::Store.new(@atmos_options)
end