Class: Keystone::V2_0::Manager::Endpoint

Inherits:
Base
  • Object
show all
Defined in:
lib/keystone/v2_0/manager/endpoint.rb

Constant Summary collapse

@@url_endpoint =
"endpoints"

Instance Attribute Summary

Attributes inherited from Base

#auth_url, #token, #url_endpoint

Instance Method Summary collapse

Constructor Details

#initialize(auth_url) ⇒ Endpoint

Returns a new instance of Endpoint.



10
11
12
# File 'lib/keystone/v2_0/manager/endpoint.rb', line 10

def initialize(auth_url)
  super auth_url, @@url_endpoint
end

Instance Method Details

#create(service_id: '', region: '', admin_url: '', internal_url: '', public_url: '', enabled: true) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/keystone/v2_0/manager/endpoint.rb', line 31

def create(service_id: '', region: '', admin_url: '', internal_url: '', public_url: '', enabled: true)
  create_key = "endpoint"
  payload = { create_key =>
              { "service_id"  => service_id,
                "region"      => region,
                "adminurl"    => admin_url,
                "internalurl" => internal_url,
                "publicurl"   => public_url,
                "enabled"     => enabled
              }
            }
  endpoint_data = super(payload.to_json)

  if endpoint_data and endpoint_data[create_key]
    return Keystone::V2_0::Resource::Endpoint.new(endpoint_data[create_key])
  else
    return nil
  end
end

#listObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/keystone/v2_0/manager/endpoint.rb', line 14

def list
  endpoints     = super
  endpoint_list = []

  # map role hash to array of Endpoint objects
  unless endpoints.nil?
    endpoints["endpoints"].each do |endpoint_data|
      endpoint_resource = Keystone::V2_0::Resource::Endpoint.new(endpoint_data)
      endpoint_list << endpoint_resource
    end

    return endpoint_list
  else
    return nil
  end
end