class Keystone::V2_0::Manager::Service

Public Class Methods

new(auth_url) click to toggle source
Calls superclass method Keystone::V2_0::Manager::Base::new
# File lib/keystone/v2_0/manager/service.rb, line 10
def initialize(auth_url)
  super auth_url, @@url_endpoint
end

Public Instance Methods

create(name: '', type: '', description: '') click to toggle source
Calls superclass method Keystone::V2_0::Manager::Base#create
# File lib/keystone/v2_0/manager/service.rb, line 31
def create(name: '', type: '', description: '')
  create_key = "OS-KSADM:service"
  payload = { create_key =>
              { "name"        => name,
                "type"        => type,
                "description" => description
              }
            }
  service_data = super(payload.to_json)

  if service_data and service_data[create_key]
    return Keystone::V2_0::Resource::Service.new(service_data[create_key])
  else
    return nil
  end
end
list() click to toggle source
Calls superclass method Keystone::V2_0::Manager::Base#list
# File lib/keystone/v2_0/manager/service.rb, line 14
def list
  services     = super
  service_list = []

  # map role hash to array of Service objects
  unless services.nil?
    services["OS-KSADM:services"].each do |service_data|
      service_resource = Keystone::V2_0::Resource::Service.new(service_data)
      service_list << service_resource
    end

    return service_list
  else
    return nil
  end
end