Class: OpenNebula::MarketPlaceApp
- Inherits:
-
PoolElement
- Object
- XMLElement
- PoolElement
- OpenNebula::MarketPlaceApp
- Defined in:
- lib/opennebula/marketplaceapp.rb
Constant Summary collapse
- MARKETPLACEAPP_METHODS =
Constants and Class Methods
{ :info => 'marketapp.info', :allocate => 'marketapp.allocate', :delete => 'marketapp.delete', :update => 'marketapp.update', :chown => 'marketapp.chown', :chmod => 'marketapp.chmod', :rename => 'marketapp.rename', :enable => 'marketapp.enable', :lock => 'marketapp.lock', :unlock => 'marketapp.unlock' }
- MARKETPLACEAPP_STATES =
%w{INIT READY LOCKED ERROR DISABLED}
- SHORT_MARKETPLACEAPP_STATES =
{ 'INIT' => 'ini', 'READY' => 'rdy', 'LOCKED' => 'lck', 'ERROR' => 'err', 'DISABLED' => 'dis' }
- MARKETPLACEAPP_TYPES =
%w{UNKNOWN IMAGE VMTEMPLATE SERVICE_TEMPLATE}
- SHORT_MARKETPLACEAPP_TYPES =
{ 'UNKNOWN' => 'unk', 'IMAGE' => 'img', 'VMTEMPLATE' => 'tpl', 'SERVICE_TEMPLATE' => 'srv' }
Instance Attribute Summary
Attributes inherited from PoolElement
Class Method Summary collapse
-
.build_xml(pe_id = nil) ⇒ Object
Creates a MarketPlace description with just its identifier this method should be used to create plain MarketPlace objects.
Instance Method Summary collapse
-
#allocate(description, mp_id) ⇒ Integer, OpenNebula::Error
Allocates a new MarketPlace in OpenNebula.
-
#chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) ⇒ nil, OpenNebula::Error
Changes the marketplace app permissions.
-
#chmod_octet(octet) ⇒ nil, OpenNebula::Error
Changes the marketplace app permissions.
-
#chown(uid, gid) ⇒ nil, OpenNebula::Error
Changes the owner/group.
-
#delete ⇒ Object
Deletes the marketplace app.
-
#disable ⇒ Object
Enables this app.
-
#enable ⇒ Object
Enables this app.
-
#info ⇒ Object
(also: #info!)
Retrieves the information of the given marketplace app.
-
#initialize(xml, client) ⇒ MarketPlaceApp
constructor
Class constructor.
-
#rename(name) ⇒ nil, OpenNebula::Error
Renames this marketplace app.
-
#short_state_str ⇒ Object
Returns the state of the marketplace app (string value).
-
#short_type_str ⇒ Object
Returns the marketplace app type (string value).
-
#state ⇒ Object
Returns the state of the marketplace app (numeric value).
-
#state_str ⇒ Object
Returns the state of the marketplace app (string value).
-
#type ⇒ Object
Returns the marketplace app type.
-
#type_str ⇒ Object
Returns the marketplace app type (string value).
-
#update(new_template, append = false) ⇒ nil, OpenNebula::Error
Replaces the template contents.
Methods inherited from PoolElement
#id, new_with_id, #replace, #to_str
Methods inherited from XMLElement
#[], #add_element, #attr, #delete_element, #each, #each_xpath, #element_xml, #has_elements?, #initialize_xml, #name, #retrieve_elements, #retrieve_xmlelements, #set_content, #template_like_str, #template_str, #template_xml, #text, #to_hash, #to_xml, #xml_nil?
Constructor Details
#initialize(xml, client) ⇒ MarketPlaceApp
Class constructor
82 83 84 85 86 |
# File 'lib/opennebula/marketplaceapp.rb', line 82 def initialize(xml, client) LockableExt.make_lockable(self, MARKETPLACEAPP_METHODS) super(xml, client) end |
Class Method Details
.build_xml(pe_id = nil) ⇒ Object
Creates a MarketPlace description with just its identifier this method should be used to create plain MarketPlace objects. id
the id of the user
Example:
app = MarketPlaceApp.new(MarketPlace.build_xml(3),rpc_client)
71 72 73 74 75 76 77 78 79 |
# File 'lib/opennebula/marketplaceapp.rb', line 71 def MarketPlaceApp.build_xml(pe_id = nil) if pe_id app_xml = "<MARKETPLACEAPP><ID>#{pe_id}</ID></MARKETPLACEAPP>" else app_xml = '<MARKETPLACEAPP></MARKETPLACEAPP>' end XMLElement.build_xml(app_xml, 'MARKETPLACEAPP') end |
Instance Method Details
#allocate(description, mp_id) ⇒ Integer, OpenNebula::Error
Allocates a new MarketPlace in OpenNebula
106 107 108 |
# File 'lib/opennebula/marketplaceapp.rb', line 106 def allocate(description, mp_id) super(MARKETPLACEAPP_METHODS[:allocate], description, mp_id) end |
#chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) ⇒ nil, OpenNebula::Error
Changes the marketplace app permissions. Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
152 153 154 155 156 |
# File 'lib/opennebula/marketplaceapp.rb', line 152 def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) super(MARKETPLACEAPP_METHODS[:chmod], owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u, other_m, other_a) end |
#chmod_octet(octet) ⇒ nil, OpenNebula::Error
Changes the marketplace app permissions.
143 144 145 |
# File 'lib/opennebula/marketplaceapp.rb', line 143 def chmod_octet(octet) super(MARKETPLACEAPP_METHODS[:chmod], octet) end |
#chown(uid, gid) ⇒ nil, OpenNebula::Error
Changes the owner/group
134 135 136 |
# File 'lib/opennebula/marketplaceapp.rb', line 134 def chown(uid, gid) super(MARKETPLACEAPP_METHODS[:chown], uid, gid) end |
#delete ⇒ Object
Deletes the marketplace app
111 112 113 |
# File 'lib/opennebula/marketplaceapp.rb', line 111 def delete super(MARKETPLACEAPP_METHODS[:delete]) end |
#disable ⇒ Object
Enables this app
174 175 176 |
# File 'lib/opennebula/marketplaceapp.rb', line 174 def disable call(MARKETPLACEAPP_METHODS[:enable], @pe_id, false) end |
#enable ⇒ Object
Enables this app
169 170 171 |
# File 'lib/opennebula/marketplaceapp.rb', line 169 def enable call(MARKETPLACEAPP_METHODS[:enable], @pe_id, true) end |
#info ⇒ Object Also known as: info!
Retrieves the information of the given marketplace app
93 94 95 |
# File 'lib/opennebula/marketplaceapp.rb', line 93 def info super(MARKETPLACEAPP_METHODS[:info], 'MARKETPLACEAPP') end |
#rename(name) ⇒ nil, OpenNebula::Error
Renames this marketplace app
164 165 166 |
# File 'lib/opennebula/marketplaceapp.rb', line 164 def rename(name) call(MARKETPLACEAPP_METHODS[:rename], @pe_id, name) end |
#short_state_str ⇒ Object
Returns the state of the marketplace app (string value)
208 209 210 |
# File 'lib/opennebula/marketplaceapp.rb', line 208 def short_state_str SHORT_MARKETPLACEAPP_STATES[state_str] end |
#short_type_str ⇒ Object
Returns the marketplace app type (string value)
193 194 195 |
# File 'lib/opennebula/marketplaceapp.rb', line 193 def short_type_str SHORT_MARKETPLACEAPP_TYPES[type_str] end |
#state ⇒ Object
Returns the state of the marketplace app (numeric value)
198 199 200 |
# File 'lib/opennebula/marketplaceapp.rb', line 198 def state self['STATE'].to_i end |
#state_str ⇒ Object
Returns the state of the marketplace app (string value)
203 204 205 |
# File 'lib/opennebula/marketplaceapp.rb', line 203 def state_str MARKETPLACEAPP_STATES[state] end |
#type ⇒ Object
Returns the marketplace app type
183 184 185 |
# File 'lib/opennebula/marketplaceapp.rb', line 183 def type self['TYPE'].to_i end |
#type_str ⇒ Object
Returns the marketplace app type (string value)
188 189 190 |
# File 'lib/opennebula/marketplaceapp.rb', line 188 def type_str MARKETPLACEAPP_TYPES[type] end |
#update(new_template, append = false) ⇒ nil, OpenNebula::Error
Replaces the template contents
123 124 125 |
# File 'lib/opennebula/marketplaceapp.rb', line 123 def update(new_template, append = false) super(MARKETPLACEAPP_METHODS[:update], new_template, append ? 1 : 0) end |