Sha256: a9324c5f164c6d85538af03ace3ea5a5ec0d50244ed73e06462e8637d0ef4bf0

Contents?: true

Size: 880 Bytes

Versions: 7

Compression:

Stored size: 880 Bytes

Contents

module Yao::Resources
  class Project < Base
    include ServerUsageAssociationable

    friendly_attributes :id, :name, :description, :enabled, :parent_id, :domain_id
    alias :enabled? :enabled

    self.service        = "identity"
    self.resource_name  = "project"
    self.resources_name = "projects"
    self.admin          = true

    # @return [Bool]
    def domain?
      @data["is_domain"]
    end

    # @return [Array<Yao::Resources::Server>]
    def servers
      @servers ||= Yao::Server.list(all_tenants: 1, project_id: id)
    end

    # @return [Yao::Resources::Port]
    def ports
      @ports ||= Yao::Port.list(tenant_id: id)
    end

    # @return [Yao::Resources::RoleAssignment]
    def role_assignment
      Yao::RoleAssignment.get(project: id)
    end

    class << self

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
yao-0.21.0 lib/yao/resources/project.rb
yao-0.20.0 lib/yao/resources/project.rb
yao-0.19.0 lib/yao/resources/project.rb
yao-0.18.0 lib/yao/resources/project.rb
yao-0.17.0 lib/yao/resources/project.rb
yao-0.16.0 lib/yao/resources/project.rb
yao-0.15.0 lib/yao/resources/project.rb