Class: OpenStack::Keystone::Public::Tenant

Inherits:
Base show all
Defined in:
lib/open_stack/keystone/public/tenant.rb

Overview

An OpenStack Tenant (“public view”)

Attributes

  • name - The name of the tenant

  • description - A description of the tenant

  • enabled - True if the tenant is enabled

Class Method Summary collapse

Methods inherited from Base

site, site=

Methods inherited from Common

collection_path, custom_method_collection_url, element_path

Methods inherited from Base

headers

Methods inherited from ActiveResource::Base

#load

Class Method Details

.find_all_by_name(name) ⇒ Object

The first tenant with a given name (accessible by the current authenticated user…)

Attributes

  • name - A string



69
70
71
# File 'lib/open_stack/keystone/public/tenant.rb', line 69

def self.find_all_by_name(name)
  all.reject! { |tenant| tenant.name != name }
end

.find_by_name(name) ⇒ Object

List of tenants with a given name (accessible by the current authenticated user…)

Attributes

  • name - A string



61
62
63
# File 'lib/open_stack/keystone/public/tenant.rb', line 61

def self.find_by_name(name)
  all.detect { |tenant| tenant.name == name }
end

.find_every(options) ⇒ Object

:nodoc:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/open_stack/keystone/public/tenant.rb', line 36

def self.find_every(options) # :nodoc:
  class_name = self.name.split('::').last.downcase
  begin
    case from = options[:from]
      when Symbol
        instantiate_collection(get(from, options[:params]))
      when String
        path = "#{from}#{query_string(options[:params])}"
        instantiate_collection(format.decode(connection.get(path, headers).body)[class_name.pluralize] || [])
      else
        prefix_options, query_options = split_options(options[:params])
        path = collection_path(prefix_options, query_options)
        instantiate_collection((format.decode(connection.get(path, headers).body)[class_name.pluralize] || []), prefix_options)
    end
  rescue ActiveResource::ResourceNotFound
    # Swallowing ResourceNotFound exceptions and return nil - as per
    # ActiveRecord.
    nil
  end
end