Class: SecurityGroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/security_groups_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#dispatch, #get_locales, #is_dcmgr?, #set_application, #set_locale

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
# File 'app/controllers/security_groups_controller.rb', line 24

def create
  data = {
    :description => params[:description],
    :rule => params[:rule]
  }
  @security_group = DcmgrResource::SecurityGroup.create(data)
  render :json => @security_group
end

#destroyObject



33
34
35
36
37
# File 'app/controllers/security_groups_controller.rb', line 33

def destroy
  uuid = params[:id]
  @security_group = DcmgrResource::SecurityGroup.destroy(uuid)
  render :json => @security_group    
end

#indexObject



4
5
# File 'app/controllers/security_groups_controller.rb', line 4

def index
end

#listObject

security_groups/show/1.json



8
9
10
11
12
13
14
15
# File 'app/controllers/security_groups_controller.rb', line 8

def list
  data = {
    :start => params[:start].to_i - 1,
    :limit => params[:limit]
  }
  @security_group = DcmgrResource::SecurityGroup.list(data)
  respond_with(@security_group[0],:to => [:json])
end

#showObject

security_groups/detail/s-000001.json



18
19
20
21
22
# File 'app/controllers/security_groups_controller.rb', line 18

def show
  uuid = params[:id]
  @security_group = DcmgrResource::SecurityGroup.show(uuid)
  respond_with(@security_group,:to => [:json])
end

#show_groupsObject



49
50
51
52
# File 'app/controllers/security_groups_controller.rb', line 49

def show_groups
  @security_group = DcmgrResource::SecurityGroup.list
  respond_with(@security_group[0],:to => [:json])
end

#totalObject



54
55
56
57
# File 'app/controllers/security_groups_controller.rb', line 54

def total
 total_resource = DcmgrResource::SecurityGroup.total_resource
 render :json => total_resource
end

#updateObject



39
40
41
42
43
44
45
46
47
# File 'app/controllers/security_groups_controller.rb', line 39

def update
  uuid = params[:id]
  data = {
    :description => params[:description],
    :rule => params[:rule]
  }
  @security_group = DcmgrResource::SecurityGroup.update(uuid,data)
  render :json => @security_group    
end