Method: Deltacloud::Drivers::Eucalyptus::EucalyptusDriver#endpoint_for_service

Defined in:
lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb

#endpoint_for_service(service) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb', line 201

def endpoint_for_service(service)
  service = service.to_s
  endpoint = api_provider
  if endpoint && endpoint.include?(service)
    # example endpoint: 'ec2=192.168.1.1; s3=192.168.1.2'
    addr = Hash[endpoint.split(";").map { |svc| svc.strip.split("=") }][service]
    host = addr.split(':')[0]
    port = addr.split(':')[1] || DEFAULT_PORT
    stub = SERVICE_STUBS[service]
    { :endpoint_url => "http://#{host}:#{port}#{stub}",
      :connection_mode => :per_thread }
  else
    #EC2_URL/S3_URL env variable will be used by AWS
    { :connection_mode => :per_thread }
  end
end