Sha256: ed74a95b3a2d45564e28bb4e0c6922381ddb0444dfe7fd0a4041f32ab5bfb855

Contents?: true

Size: 758 Bytes

Versions: 11

Compression:

Stored size: 758 Bytes

Contents

module Yao::Resources
  class Tenant < Base
    friendly_attributes :id, :name, :description, :enabled

    self.service        = "identity"
    self.resource_name  = "tenant"
    self.resources_name = "tenants"
    self.admin          = true
    self.return_single_on_querying = true

    def servers
      @servers ||= Yao::Server.list(all_tenants: 1, project_id: id)
    end

    def meters
      @meters ||= Yao::Meter.list({'q.field' => 'project_id', 'q.op' => 'eq', 'q.value' => id})
    end

    def ports
      @ports ||= Yao::Port.list(tenant_id: id)
    end

    def meters_by_name(meter_name)
      meters.select{|m| m.name == meter_name}
    end

    class << self
      def accessible
        as_member { self.list }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
yao-0.13.4 lib/yao/resources/tenant.rb
yao-0.13.3 lib/yao/resources/tenant.rb
yao-0.13.2 lib/yao/resources/tenant.rb
yao-0.13.1 lib/yao/resources/tenant.rb
yao-0.13.0 lib/yao/resources/tenant.rb
yao-0.12.0 lib/yao/resources/tenant.rb
yao-0.11.3 lib/yao/resources/tenant.rb
yao-0.11.2 lib/yao/resources/tenant.rb
yao-0.11.1 lib/yao/resources/tenant.rb
yao-0.11.0 lib/yao/resources/tenant.rb
yao-0.10.1 lib/yao/resources/tenant.rb