Class: Occi::Infrastructure::Model

Inherits:
Core::Model show all
Defined in:
lib/occi/infrastructure/model.rb

Overview

See `Occi::Core::Model` for details.

Author:

Direct Known Subclasses

Occi::InfrastructureExt::Model

Constant Summary

Constants included from Core::Helpers::Renderable

Core::Helpers::Renderable::RENDERER_FACTORY_CLASS

Instance Attribute Summary

Attributes inherited from Core::Model

#categories

Instance Method Summary collapse

Methods inherited from Core::Model

#<<, #actions, #all, #associated_actions, #depended_on_mixins, #empty?, #find_by_identifier, #find_by_identifier!, #find_by_location, #find_by_schema, #find_by_term, #find_dependent, #find_related, #initialize, #kinds, #load_core!, #mixins, #parent_kinds, #remove, #valid!, #valid?

Methods included from Core::Helpers::Renderable

extended, included, #render, #renderer_factory, renderer_factory, renderer_factory_class, #renderer_for

Constructor Details

This class inherits a constructor from Occi::Core::Model

Instance Method Details

#find_os_tplsSet

Returns all mixins dependent on the base `os_tpl` mixin defined by OGF.

Returns:

  • (Set)

    set of mixins dependent on `os_tpl`


30
31
32
# File 'lib/occi/infrastructure/model.rb', line 30

def find_os_tpls
  find_dependent Occi::Infrastructure::Mixins::OsTpl.new
end

#find_resource_tplsSet

Returns all mixins dependent on the base `resource_tpl` mixin defined by OGF.

Returns:

  • (Set)

    set of mixins dependent on `resource_tpl`


37
38
39
# File 'lib/occi/infrastructure/model.rb', line 37

def find_resource_tpls
  find_dependent Occi::Infrastructure::Mixins::ResourceTpl.new
end

#instance_builderOcci::Infrastructure::InstanceBuilder

Returns an instance of `Occi::Infrastructure::InstanceBuilder` associated with this model.

Returns:


23
24
25
# File 'lib/occi/infrastructure/model.rb', line 23

def instance_builder
  Occi::Infrastructure::InstanceBuilder.new(model: self)
end

#load_infrastructure!Object

Loads OGF's OCCI Infrastructure Standard from `Occi::Infrastructure::Warehouse`.

Examples:

model = Occi::Infrastructure::Model.new
model.load_infrastructure!

12
13
14
15
16
17
18
# File 'lib/occi/infrastructure/model.rb', line 12

def load_infrastructure!
  logger.debug 'Loading Infrastructure from Infrastructure::Warehouse'
  Occi::Infrastructure::Warehouse.bootstrap! self
  self << Occi::Infrastructure::Mixins::OsTpl.new
  self << Occi::Infrastructure::Mixins::ResourceTpl.new
  nil
end