Class: SecurityGroupsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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

#destroyObject



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

def destroy
  uuid = params[:id]
  @netfilter_group = DcmgrResource::NetfilterGroup.destroy(uuid)
  render :json => @netfilter_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]
  }
  @netfilter_group = DcmgrResource::NetfilterGroup.list(data)
  respond_with(@netfilter_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]
  @netfilter_group = DcmgrResource::NetfilterGroup.show(uuid)
  respond_with(@netfilter_group,:to => [:json])
end

#show_groupsObject



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

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

#totalObject



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

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

#updateObject



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

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