class Rocci::Resource

rOCCI Resource class.

Public Class Methods

inherited(childclass) click to toggle source

Callback invoked whenever a subclass is created. This method dynamically defines virtual @endpoint attribute located in child instance, which contains backslash + name of inheriting class. It is used for request building.

Calls superclass method
# File lib/probe/occi/rocci/resource.rb, line 32
def self.inherited(childclass)
  super(childclass)

  path = childclass.to_s.split('::').last.downcase

  childclass.send(:define_method, :resource_uri) { "#{path}" }
end
new(opts) click to toggle source
# File lib/probe/occi/rocci/resource.rb, line 24
def initialize(opts)
  @opts = opts
  connect(:http, opts)
end

Public Instance Methods

all() click to toggle source

Returns the contents of the pool. 200 OK: An XML representation of the pool in the http body. This means query the point “network”, “storage” etc. Please read Occi::Api documentation here github.com/arax/rOCCI-api.

# File lib/probe/occi/rocci/resource.rb, line 48
def all
  describe(resource_uri)
end
create_check_destroy() click to toggle source
# File lib/probe/occi/rocci/resource.rb, line 58
def create_check_destroy
  # Overriden in sibling (compute)
end
entity(id) click to toggle source
# File lib/probe/occi/rocci/resource.rb, line 40
def entity(id)
  "/#{resource_uri}/#{id}"
end
find(id) click to toggle source

Returns the representation of specific resource identified by id. 200 OK: An XML representation of the pool in the http body.

# File lib/probe/occi/rocci/resource.rb, line 54
def find(id)
  describe(entity(id))
end