opennebula 4.14.2 → 4.90.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/NOTICE +1 -1
  3. data/lib/cloud/CloudClient.rb +3 -3
  4. data/lib/opennebula.rb +8 -2
  5. data/lib/opennebula/acl.rb +20 -14
  6. data/lib/opennebula/acl_pool.rb +1 -1
  7. data/lib/opennebula/client.rb +1 -1
  8. data/lib/opennebula/cluster.rb +1 -1
  9. data/lib/opennebula/cluster_pool.rb +1 -1
  10. data/lib/opennebula/datastore.rb +2 -2
  11. data/lib/opennebula/datastore_pool.rb +3 -3
  12. data/lib/opennebula/document.rb +16 -1
  13. data/lib/opennebula/document_json.rb +13 -1
  14. data/lib/opennebula/document_pool.rb +1 -1
  15. data/lib/opennebula/document_pool_json.rb +1 -1
  16. data/lib/opennebula/error.rb +1 -1
  17. data/lib/opennebula/group.rb +17 -10
  18. data/lib/opennebula/group_pool.rb +1 -1
  19. data/lib/opennebula/host.rb +26 -14
  20. data/lib/opennebula/host_pool.rb +1 -1
  21. data/lib/opennebula/image.rb +7 -3
  22. data/lib/opennebula/image_pool.rb +1 -2
  23. data/lib/opennebula/ldap_auth.rb +1 -1
  24. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  25. data/lib/opennebula/marketplace.rb +161 -0
  26. data/lib/opennebula/marketplace_pool.rb +55 -0
  27. data/lib/opennebula/marketplaceapp.rb +267 -0
  28. data/lib/opennebula/marketplaceapp_pool.rb +77 -0
  29. data/lib/opennebula/oneflow_client.rb +10 -8
  30. data/lib/opennebula/pool.rb +1 -1
  31. data/lib/opennebula/pool_element.rb +1 -1
  32. data/lib/opennebula/security_group.rb +43 -2
  33. data/lib/opennebula/security_group_pool.rb +1 -1
  34. data/lib/opennebula/server_cipher_auth.rb +1 -1
  35. data/lib/opennebula/server_x509_auth.rb +1 -1
  36. data/lib/opennebula/ssh_auth.rb +1 -1
  37. data/lib/opennebula/system.rb +1 -1
  38. data/lib/opennebula/template.rb +42 -13
  39. data/lib/opennebula/template_pool.rb +1 -1
  40. data/lib/opennebula/user.rb +1 -1
  41. data/lib/opennebula/user_pool.rb +1 -1
  42. data/lib/opennebula/vdc.rb +1 -1
  43. data/lib/opennebula/vdc_pool.rb +1 -1
  44. data/lib/opennebula/virtual_machine.rb +65 -50
  45. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  46. data/lib/opennebula/virtual_network.rb +13 -2
  47. data/lib/opennebula/virtual_network_pool.rb +1 -1
  48. data/lib/opennebula/virtual_router.rb +203 -0
  49. data/lib/opennebula/virtual_router_pool.rb +79 -0
  50. data/lib/opennebula/x509_auth.rb +1 -1
  51. data/lib/opennebula/xml_element.rb +6 -1
  52. data/lib/opennebula/xml_pool.rb +1 -1
  53. data/lib/opennebula/xml_utils.rb +1 -1
  54. data/lib/opennebula/zone.rb +1 -1
  55. data/lib/opennebula/zone_pool.rb +1 -1
  56. metadata +11 -5
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -41,7 +41,8 @@ module OpenNebula
41
41
  :snapshotflatten=> "image.snapshotflatten"
42
42
  }
43
43
 
44
- IMAGE_STATES=%w{INIT READY USED DISABLED LOCKED ERROR CLONE DELETE USED_PERS}
44
+ IMAGE_STATES=%w{INIT READY USED DISABLED LOCKED ERROR CLONE DELETE
45
+ USED_PERS LOCKED_USED LOCKED_USED_PERS}
45
46
 
46
47
  SHORT_IMAGE_STATES={
47
48
  "INIT" => "init",
@@ -52,7 +53,9 @@ module OpenNebula
52
53
  "ERROR" => "err",
53
54
  "CLONE" => "clon",
54
55
  "DELETE" => "dele",
55
- "USED_PERS" => "used"
56
+ "USED_PERS" => "used",
57
+ "LOCKED_USED" => "lock",
58
+ "LOCKED_USED_PERS" => "lock"
56
59
  }
57
60
 
58
61
  IMAGE_TYPES=%w{OS CDROM DATABLOCK KERNEL RAMDISK CONTEXT}
@@ -252,6 +255,7 @@ module OpenNebula
252
255
  def snapshot_flatten(snap_id)
253
256
  return call(IMAGE_METHODS[:snapshotflatten], @pe_id, snap_id)
254
257
  end
258
+
255
259
  #######################################################################
256
260
  # Helpers to get Image information
257
261
  #######################################################################
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -23,7 +23,6 @@ module OpenNebula
23
23
  # Constants and Class attribute accessors
24
24
  #######################################################################
25
25
 
26
-
27
26
  IMAGE_POOL_METHODS = {
28
27
  :info => "imagepool.info"
29
28
  }
@@ -1,5 +1,5 @@
1
1
  # ---------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # ---------------------------------------------------------------------------- #
2
- # Copyright 2002-2015, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -0,0 +1,161 @@
1
+ # -------------------------------------------------------------------------- #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
+ # #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
+ # not use this file except in compliance with the License. You may obtain #
6
+ # a copy of the License at #
7
+ # #
8
+ # http://www.apache.org/licenses/LICENSE-2.0 #
9
+ # #
10
+ # Unless required by applicable law or agreed to in writing, software #
11
+ # distributed under the License is distributed on an "AS IS" BASIS, #
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
+ # See the License for the specific language governing permissions and #
14
+ # limitations under the License. #
15
+ #--------------------------------------------------------------------------- #
16
+
17
+ require 'opennebula/pool_element'
18
+
19
+ module OpenNebula
20
+ class MarketPlace < PoolElement
21
+ #######################################################################
22
+ # Constants and Class Methods
23
+ #######################################################################
24
+
25
+ MARKETPLACE_METHODS = {
26
+ :info => "market.info",
27
+ :allocate => "market.allocate",
28
+ :delete => "market.delete",
29
+ :update => "market.update",
30
+ :chown => "market.chown",
31
+ :chmod => "market.chmod",
32
+ :rename => "market.rename"
33
+ }
34
+
35
+ # Creates a MarketPlace description with just its identifier
36
+ # this method should be used to create plain MarketPlace objects.
37
+ # +id+ the id of the user
38
+ #
39
+ # Example:
40
+ # marketplace = MarketPlace.new(MarketPlace.build_xml(3),rpc_client)
41
+ #
42
+ def MarketPlace.build_xml(pe_id=nil)
43
+ if pe_id
44
+ marketplace_xml = "<MARKETPLACE><ID>#{pe_id}</ID></MARKETPLACE>"
45
+ else
46
+ marketplace_xml = "<MARKETPLACE></MARKETPLACE>"
47
+ end
48
+
49
+ XMLElement.build_xml(marketplace_xml,'MARKETPLACE')
50
+ end
51
+
52
+ # Class constructor
53
+ def initialize(xml, client)
54
+ super(xml,client)
55
+ end
56
+
57
+ #######################################################################
58
+ # XML-RPC Methods for the MarketPlace Object
59
+ #######################################################################
60
+
61
+ # Retrieves the information of the given marketplace.
62
+ def info()
63
+ super(MARKETPLACE_METHODS[:info], 'MARKETPLACE')
64
+ end
65
+
66
+ alias_method :info!, :info
67
+
68
+ # Allocates a new marketplace in OpenNebula
69
+ #
70
+ # @param description [String] The template of the marketplace.
71
+ #
72
+ # @return [Integer, OpenNebula::Error] the new ID in case of
73
+ # success, error otherwise
74
+ def allocate(description)
75
+ super(MARKETPLACE_METHODS[:allocate], description)
76
+ end
77
+
78
+ # Deletes the marketplace
79
+ def delete()
80
+ super(MARKETPLACE_METHODS[:delete])
81
+ end
82
+
83
+ # Replaces the template contents
84
+ #
85
+ # @param new_template [String] New template contents
86
+ # @param append [true, false] True to append new attributes instead of
87
+ # replace the whole template
88
+ #
89
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
90
+ # otherwise
91
+ def update(new_template, append=false)
92
+ super(MARKETPLACE_METHODS[:update], new_template, append ? 1 : 0)
93
+ end
94
+
95
+ # Changes the owner/group
96
+ #
97
+ # @param uid [Integer] the new owner id. Set to -1 to leave the current one
98
+ # @param gid [Integer] the new group id. Set to -1 to leave the current one
99
+ #
100
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
101
+ # otherwise
102
+ def chown(uid, gid)
103
+ super(MARKETPLACE_METHODS[:chown], uid, gid)
104
+ end
105
+
106
+ # Changes the marketplace permissions.
107
+ #
108
+ # @param octet [String] Permissions octed , e.g. 640
109
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
110
+ # otherwise
111
+ def chmod_octet(octet)
112
+ super(MARKETPLACE_METHODS[:chmod], octet)
113
+ end
114
+
115
+ # Changes the marketplace permissions.
116
+ # Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
117
+ #
118
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
119
+ # otherwise
120
+ def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u,
121
+ other_m, other_a)
122
+ super(MARKETPLACE_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
123
+ group_m, group_a, other_u, other_m, other_a)
124
+ end
125
+
126
+ # Renames this marketplace
127
+ #
128
+ # @param name [String] New name for the marketplace
129
+ #
130
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
131
+ # otherwise
132
+ def rename(name)
133
+ return call(MARKETPLACE_METHODS[:rename], @pe_id, name)
134
+ end
135
+
136
+ # ---------------------------------------------------------------------
137
+ # Helpers to get information
138
+ # ---------------------------------------------------------------------
139
+
140
+ # Returns whether or not the marketplace app with id 'id' is part of
141
+ # this marketplace
142
+ def contains(id)
143
+ #This doesn't work in ruby 1.8.5
144
+ #return self["MARKETPLACE/MARKETPLACEAPPS/ID[.=#{uid}]"] != nil
145
+
146
+ id_array = retrieve_elements('MARKETPLACEAPPS/ID')
147
+ return id_array != nil && id_array.include?(uid.to_s)
148
+ end
149
+
150
+ # Returns an array with the numeric image ids
151
+ def marketapp_ids
152
+ array = Array.new
153
+
154
+ self.each("MARKETPLACEAPPS/ID") do |id|
155
+ array << id.text.to_i
156
+ end
157
+
158
+ return array
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,55 @@
1
+ # -------------------------------------------------------------------------- #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
+ # #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
+ # not use this file except in compliance with the License. You may obtain #
6
+ # a copy of the License at #
7
+ # #
8
+ # http://www.apache.org/licenses/LICENSE-2.0 #
9
+ # #
10
+ # Unless required by applicable law or agreed to in writing, software #
11
+ # distributed under the License is distributed on an "AS IS" BASIS, #
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
+ # See the License for the specific language governing permissions and #
14
+ # limitations under the License. #
15
+ #--------------------------------------------------------------------------- #
16
+
17
+
18
+ require 'opennebula/pool'
19
+
20
+ module OpenNebula
21
+ class MarketPlacePool < Pool
22
+ #######################################################################
23
+ # Constants and Class attribute accessors
24
+ #######################################################################
25
+
26
+ MARKETPLACE_POOL_METHODS = {
27
+ :info => "marketpool.info"
28
+ }
29
+
30
+ #######################################################################
31
+ # Class constructor & Pool Methods
32
+ #######################################################################
33
+
34
+ # +client+ a Client object that represents a XML-RPC connection
35
+ def initialize(client)
36
+ super('MARKETPLACE_POOL','MARKETPLACE', client)
37
+ end
38
+
39
+ # Factory method to create MarketPlace objects
40
+ def factory(element_xml)
41
+ OpenNebula::MarketPlace.new(element_xml, @client)
42
+ end
43
+
44
+ #######################################################################
45
+ # XML-RPC Methods for the User Object
46
+ #######################################################################
47
+
48
+ # Retrieves all the marketplace apps
49
+ def info()
50
+ super(MARKETPLACE_POOL_METHODS[:info])
51
+ end
52
+
53
+ alias_method :info!, :info
54
+ end
55
+ end
@@ -0,0 +1,267 @@
1
+ # -------------------------------------------------------------------------- #
2
+ # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
3
+ # #
4
+ # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
+ # not use this file except in compliance with the License. You may obtain #
6
+ # a copy of the License at #
7
+ # #
8
+ # http://www.apache.org/licenses/LICENSE-2.0 #
9
+ # #
10
+ # Unless required by applicable law or agreed to in writing, software #
11
+ # distributed under the License is distributed on an "AS IS" BASIS, #
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
+ # See the License for the specific language governing permissions and #
14
+ # limitations under the License. #
15
+ #--------------------------------------------------------------------------- #
16
+
17
+ require 'opennebula/pool_element'
18
+
19
+ module OpenNebula
20
+ class MarketPlaceApp < PoolElement
21
+ #######################################################################
22
+ # Constants and Class Methods
23
+ #######################################################################
24
+
25
+ MARKETPLACEAPP_METHODS = {
26
+ :info => "marketapp.info",
27
+ :allocate => "marketapp.allocate",
28
+ :delete => "marketapp.delete",
29
+ :update => "marketapp.update",
30
+ :chown => "marketapp.chown",
31
+ :chmod => "marketapp.chmod",
32
+ :rename => "marketapp.rename",
33
+ :enable => "marketapp.enable"
34
+ }
35
+
36
+ MARKETPLACEAPP_STATES=%w{INIT READY LOCKED ERROR DISABLED}
37
+
38
+ SHORT_MARKETPLACEAPP_STATES={
39
+ "INIT" => "ini",
40
+ "READY" => "rdy",
41
+ "LOCKED" => "lck",
42
+ "ERROR" => "err",
43
+ "DISABLED" => "dis"
44
+ }
45
+
46
+ MARKETPLACEAPP_TYPES=%w{UNKNOWN IMAGE VMTEMPLATE SERVICE_TEMPLATE}
47
+
48
+ SHORT_MARKETPLACEAPP_TYPES = {
49
+ "UNKNOWN" => "unk",
50
+ "IMAGE" => "img",
51
+ "VMTEMPLATE" => "tpl",
52
+ "SERVICE_TEMPLATE" => "srv"
53
+ }
54
+ # Creates a MarketPlace description with just its identifier
55
+ # this method should be used to create plain MarketPlace objects.
56
+ # +id+ the id of the user
57
+ #
58
+ # Example:
59
+ # app = MarketPlaceApp.new(MarketPlace.build_xml(3),rpc_client)
60
+ #
61
+ def MarketPlaceApp.build_xml(pe_id=nil)
62
+ if pe_id
63
+ app_xml = "<MARKETPLACEAPP><ID>#{pe_id}</ID></MARKETPLACEAPP>"
64
+ else
65
+ app_xml = "<MARKETPLACEAPP></MARKETPLACEAPP>"
66
+ end
67
+
68
+ XMLElement.build_xml(app_xml,'MARKETPLACEAPP')
69
+ end
70
+
71
+ # Class constructor
72
+ def initialize(xml, client)
73
+ super(xml, client)
74
+ end
75
+
76
+ #######################################################################
77
+ # XML-RPC Methods for the MarketPlace Object
78
+ #######################################################################
79
+
80
+ # Retrieves the information of the given marketplace app
81
+ def info()
82
+ super(MARKETPLACEAPP_METHODS[:info], 'MARKETPLACEAPP')
83
+ end
84
+
85
+ alias_method :info!, :info
86
+
87
+ # Allocates a new MarketPlace in OpenNebula
88
+ #
89
+ # @param description [String] The template of the marketplace app
90
+ # @param mp_id [Integer] The id of the marketplace to create the app
91
+ #
92
+ # @return [Integer, OpenNebula::Error] the new ID in case of
93
+ # success, error otherwise
94
+ def allocate(description, mp_id)
95
+ super(MARKETPLACEAPP_METHODS[:allocate], description, mp_id)
96
+ end
97
+
98
+ # Deletes the marketplace app
99
+ def delete()
100
+ super(MARKETPLACEAPP_METHODS[:delete])
101
+ end
102
+
103
+ # Replaces the template contents
104
+ #
105
+ # @param new_template [String] New template contents
106
+ # @param append [true, false] True to append new attributes instead of
107
+ # replace the whole template
108
+ #
109
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
110
+ # otherwise
111
+ def update(new_template, append=false)
112
+ super(MARKETPLACEAPP_METHODS[:update], new_template, append ? 1 : 0)
113
+ end
114
+
115
+ # Changes the owner/group
116
+ #
117
+ # @param uid [Integer] the new owner id. Set to -1 to leave the current one
118
+ # @param gid [Integer] the new group id. Set to -1 to leave the current one
119
+ #
120
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
121
+ # otherwise
122
+ def chown(uid, gid)
123
+ super(MARKETPLACEAPP_METHODS[:chown], uid, gid)
124
+ end
125
+
126
+ # Changes the marketplace app permissions.
127
+ #
128
+ # @param octet [String] Permissions octed , e.g. 640
129
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
130
+ # otherwise
131
+ def chmod_octet(octet)
132
+ super(MARKETPLACEAPP_METHODS[:chmod], octet)
133
+ end
134
+
135
+ # Changes the marketplace app permissions.
136
+ # Each [Integer] argument must be 1 to allow, 0 deny, -1 do not change
137
+ #
138
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
139
+ # otherwise
140
+ def chmod(owner_u, owner_m, owner_a, group_u, group_m, group_a, other_u,
141
+ other_m, other_a)
142
+ super(MARKETPLACEAPP_METHODS[:chmod], owner_u, owner_m, owner_a,
143
+ group_u, group_m, group_a, other_u, other_m, other_a)
144
+ end
145
+
146
+ # Renames this marketplace app
147
+ #
148
+ # @param name [String] New name for the marketplace app
149
+ #
150
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
151
+ # otherwise
152
+ def rename(name)
153
+ return call(MARKETPLACEAPP_METHODS[:rename], @pe_id, name)
154
+ end
155
+
156
+ # Exports this app to a suitable OpenNebula object
157
+ # @param appid [Integer] id of the marketplace app
158
+ # @param options [Hash] to control the export behavior
159
+ # dsid [Integer] datastore to save images
160
+ # name [String] of the new object
161
+ # vmtemplate_name [String] name for the VM Template, if the App has one
162
+ #
163
+ # @return [Hash, OpenNebula::Error] with the ID and type of the created
164
+ # objects. Instead of an ID, the array may contain OpenNebula::Error with
165
+ # specific object creation errors
166
+ # { :vm => [ vm ids/OpenNebula::Error ],
167
+ # :vmtemplate => [ vmtemplates ids/OpenNebula::Error ],
168
+ # :image => [ vm ids/OpenNebula::Error ] }
169
+ def export(options={})
170
+ return Error.new("Missing datastore id") if options[:dsid].nil?
171
+ return Error.new("Missing name to export app") if options[:name].nil?
172
+
173
+ rc = info
174
+ return rc if OpenNebula.is_error?(rc)
175
+ return Error.new("App is not in READY state") if state_str!="READY"
176
+
177
+ case type_str
178
+ when "IMAGE"
179
+ if !self['APPTEMPLATE64'].nil?
180
+ tmpl=Base64::decode64(self['APPTEMPLATE64'])
181
+ else
182
+ tmpl=""
183
+ end
184
+
185
+ name = options[:name] || "marketapp-#{self.id}"
186
+
187
+ tmpl << "\n"
188
+ tmpl << "NAME=\"" << name << "\"\n"
189
+ tmpl << "FROM_APP=\"" << self['ID'] << "\"\n"
190
+
191
+ image = Image.new(Image.build_xml, @client)
192
+ rc = image.allocate(tmpl, options[:dsid])
193
+
194
+ return { :image => [rc] } if OpenNebula.is_error?(rc)
195
+
196
+ image_id = image.id
197
+ vmtpl_id = -1
198
+
199
+ if !self['TEMPLATE/VMTEMPLATE64'].nil?
200
+ tmpl=Base64::decode64(self['TEMPLATE/VMTEMPLATE64'])
201
+
202
+ tmpl_name = options[:vmtemplate_name] || name
203
+
204
+ tmpl << "\nNAME=\"#{tmpl_name}\"\n"
205
+ tmpl << "DISK=[ IMAGE_ID = #{image.id} ]\n"
206
+
207
+ vmtpl = Template.new(Template.build_xml, @client)
208
+ rc = vmtpl.allocate(tmpl)
209
+
210
+ if OpenNebula.is_error?(rc)
211
+ return { :image => [image_id], :vmtemplate => [rc] }
212
+ end
213
+
214
+ vmtpl_id = vmtpl.id
215
+ end
216
+
217
+ return { :image => [image_id], :vmtemplate => [vmtpl_id] }
218
+ else
219
+ return Error.new("App type #{app.type_str} not supported")
220
+ end
221
+ end
222
+
223
+ # Enables this app
224
+ def enable
225
+ return call(MARKETPLACEAPP_METHODS[:enable], @pe_id, true)
226
+ end
227
+
228
+ # Enables this app
229
+ def disable
230
+ return call(MARKETPLACEAPP_METHODS[:enable], @pe_id, false)
231
+ end
232
+
233
+ # ---------------------------------------------------------------------
234
+ # Helpers to get information
235
+ # ---------------------------------------------------------------------
236
+
237
+ # Returns the marketplace app type
238
+ def type
239
+ self['TYPE'].to_i
240
+ end
241
+
242
+ # Returns the marketplace app type (string value)
243
+ def type_str
244
+ MARKETPLACEAPP_TYPES[type]
245
+ end
246
+
247
+ # Returns the marketplace app type (string value)
248
+ def short_type_str
249
+ SHORT_MARKETPLACEAPP_TYPES[type_str]
250
+ end
251
+
252
+ # Returns the state of the marketplace app (numeric value)
253
+ def state
254
+ self['STATE'].to_i
255
+ end
256
+
257
+ # Returns the state of the marketplace app (string value)
258
+ def state_str
259
+ MARKETPLACEAPP_STATES[state]
260
+ end
261
+
262
+ # Returns the state of the marketplace app (string value)
263
+ def short_state_str
264
+ SHORT_MARKETPLACEAPP_STATES[state_str]
265
+ end
266
+ end
267
+ end