Class: DcmgrResource::SecurityGroup
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- DcmgrResource::SecurityGroup
show all
- Defined in:
- app/models/dcmgr_resource/security_group.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
get_resource_state_count, set_debug, total_resource
Class Method Details
.create(params) ⇒ Object
4
5
6
7
8
9
10
|
# File 'app/models/dcmgr_resource/security_group.rb', line 4
def self.create(params)
security_group = self.new
security_group.description = params[:description]
security_group.rule = params[:rule]
security_group.save
security_group
end
|
.destroy(uuid) ⇒ Object
34
35
36
|
# File 'app/models/dcmgr_resource/security_group.rb', line 34
def self.destroy(uuid)
self.delete(uuid).body
end
|
.list(params = {}) ⇒ Object
22
23
24
|
# File 'app/models/dcmgr_resource/security_group.rb', line 22
def self.list(params = {})
self.find(:all,:params => params)
end
|
.show(uuid) ⇒ Object
26
27
28
|
# File 'app/models/dcmgr_resource/security_group.rb', line 26
def self.show(uuid)
self.get(uuid)
end
|
.update(uuid, params) ⇒ Object
30
31
32
|
# File 'app/models/dcmgr_resource/security_group.rb', line 30
def self.update(uuid,params)
self.put(uuid,params).body
end
|
Instance Method Details
#to_json(options = {}) ⇒ Object
workaround for the bug:
the value of the key "rule" is encoded to JSON wrongly by
ActiveSupport::JSON encoder.
"{\"security_group\":{\"description\":\"\",\"rule\":[[null,[],null]]}}"
So it has to use the encoder from JSON library.
17
18
19
20
|
# File 'app/models/dcmgr_resource/security_group.rb', line 17
def to_json(options={})
require 'json'
{'security_group'=>@attributes}.to_json
end
|