Class: Occi::Infrastructure::Compute

Inherits:
Core::Resource show all
Defined in:
lib/occi/infrastructure/compute.rb

Defined Under Namespace

Classes: Restart, Start, Stop, Suspend

Instance Attribute Summary

Attributes inherited from Core::Resource

#links

Attributes inherited from Core::Entity

#actions, #attributes, #id, #kind, #mixins, #model

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Resource

#as_json, #initialize, #link, #model=, #summary, #summary=, #to_header, #to_text

Methods inherited from Core::Entity

#as_json, check, #check, #initialize, #inspect, #location, new, #title, #title=, #to_header, #to_s, #to_text, type_identifier

Constructor Details

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

Class Method Details

.actionsObject



53
54
55
# File 'lib/occi/infrastructure/compute.rb', line 53

def self.actions
  Occi::Core::Actions.new << Start.new << Stop.new << Restart.new << Suspend.new
end

.mixinsObject



49
50
51
# File 'lib/occi/infrastructure/compute.rb', line 49

def self.mixins
  Occi::Core::Mixins.new << Occi::Infrastructure::Resource_tpl.new << Occi::Infrastructure::Os_tpl.new
end

Instance Method Details

#architectureObject



93
94
95
# File 'lib/occi/infrastructure/compute.rb', line 93

def architecture
  @attributes.occi.compute.architecture if @attributes.occi.compute if @attributes.occi
end

#architecture=(architecture) ⇒ Object



97
98
99
# File 'lib/occi/infrastructure/compute.rb', line 97

def architecture=(architecture)
  @attributes.occi!.compute!.architecture = architecture
end

#coresObject



101
102
103
# File 'lib/occi/infrastructure/compute.rb', line 101

def cores
  @attributes.occi.compute.cores if @attributes.occi.compute if @attributes.occi
end

#cores=(cores) ⇒ Object



105
106
107
# File 'lib/occi/infrastructure/compute.rb', line 105

def cores=(cores)
  @attributes.occi!.compute!.cores = cores
end

#hostnameObject



109
110
111
# File 'lib/occi/infrastructure/compute.rb', line 109

def hostname
  @attributes.occi.compute.hostname if @attributes.occi.compute if @attributes.occi
end

#hostname=(hostname) ⇒ Object



113
114
115
# File 'lib/occi/infrastructure/compute.rb', line 113

def hostname=(hostname)
  @attributes.occi!.compute!.hostname = hostname
end

#memoryObject



125
126
127
# File 'lib/occi/infrastructure/compute.rb', line 125

def memory
  @attributes.occi.compute.memory if @attributes.occi.compute if @attributes.occi
end

#memory=(memory) ⇒ Object



129
130
131
# File 'lib/occi/infrastructure/compute.rb', line 129

def memory=(memory)
  @attributes.occi!.compute!.memory = memory
end

#networkinterface(target, mixins = [], attributes = Occi::Core::Attributes.new) ⇒ Object



145
146
147
# File 'lib/occi/infrastructure/compute.rb', line 145

def networkinterface(target, mixins=[], attributes=Occi::Core::Attributes.new)
  link(target, Occi::Infrastructure::Networkinterface.kind, mixins, attributes)
end

#networkinterfacesObject



153
154
155
# File 'lib/occi/infrastructure/compute.rb', line 153

def networkinterfaces
  @links.select { |link| link.kind == Occi::Infrastructure::Networkinterface.kind }
end

#speedObject



117
118
119
# File 'lib/occi/infrastructure/compute.rb', line 117

def speed
  @attributes.occi.compute.speed if @attributes.occi.compute if @attributes.occi
end

#speed=(speed) ⇒ Object



121
122
123
# File 'lib/occi/infrastructure/compute.rb', line 121

def speed=(speed)
  @attributes.occi!.compute!.speed = speed
end

#stateObject



133
134
135
# File 'lib/occi/infrastructure/compute.rb', line 133

def state
  @attributes.occi.compute.state if @attributes.occi.compute if @attributes.occi
end

#state=(state) ⇒ Object



137
138
139
# File 'lib/occi/infrastructure/compute.rb', line 137

def state=(state)
  @attributes.occi!.compute!.state = state
end


141
142
143
# File 'lib/occi/infrastructure/compute.rb', line 141

def storagelink(target, mixins=[], attributes=Occi::Core::Attributes.new)
  link(target, Occi::Infrastructure::Storagelink.kind, mixins, attributes, rel=Occi::Infrastructure::Storage.type_identifier)
end


149
150
151
# File 'lib/occi/infrastructure/compute.rb', line 149

def storagelinks
  @links.select { |link| link.kind == Occi::Infrastructure::Storagelink.kind }
end