Module: Fog::OpenStack::Auth::Catalog

Included in:
V2, V3
Defined in:
lib/fog/openstack/auth/catalog.rb,
lib/fog/openstack/auth/catalog/v2.rb,
lib/fog/openstack/auth/catalog/v3.rb

Defined Under Namespace

Classes: CatalogError, EndpointError, ServiceTypeError, V2, V3

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



5
6
7
# File 'lib/fog/openstack/auth/catalog.rb', line 5

def payload
  @payload
end

Instance Method Details

#get_endpoint_url(names, interfaces, region = nil) ⇒ Object

Raises:



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
# File 'lib/fog/openstack/auth/catalog.rb', line 15

def get_endpoint_url(names, interfaces, region = nil)
  # TODO: Inject OpenStack Service Types Authority
  names_list = if names.kind_of?(String)
                 [names]
               else
                 names
               end
  entries = get_by_type(names_list)
  raise ServiceTypeError, 'No endpoint match' if entries.empty?

  interfaces_list = if interfaces.kind_of?(String)
                      [interfaces]
                    else
                      interfaces
                    end

  list = []
  interfaces_list.each do |interface|
    val = get_endpoint(entries, interface, region)
    list << val if val
  end

  raise EndpointError, 'No endpoint found' if list.empty?
  list[0]
end

#initialize(payload) ⇒ Object



11
12
13
# File 'lib/fog/openstack/auth/catalog.rb', line 11

def initialize(payload)
  @payload = payload
end