Class: Fog::Compute::Cloudstack::SecurityGroup

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/cloudstack/models/compute/security_group.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject


16
17
18
19
20
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 16

def destroy
  requires :id
  service.delete_security_group('id' => self.id)
  true
end

#egress_rulesObject


22
23
24
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 22

def egress_rules
  attributes[:egress_rules] || []
end

#ingress_rulesObject


26
27
28
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 26

def ingress_rules
  attributes[:ingress_rules] || []
end

#rulesObject


44
45
46
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 44

def rules
  service.security_group_rules.all("security_group_id" => self.id)
end

#saveObject


30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 30

def save
  requires :name

  options = {
    'name'        => self.name,
    'account'     => self.,
    'description' => self.description,
    'projectid'   => self.project_id,
    'domainid'    => self.domain_id,
  }
  data = service.create_security_group(options)
  merge_attributes(data['createsecuritygroupresponse']['securitygroup'])
end