Class: Fog::Compute::HP::SecurityGroup

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

Instance Method Summary collapse

Instance Method Details

#create_rule(range, ip_protocol = "tcp", cidr = "0.0.0.0/0", group_id = nil) ⇒ Object



29
30
31
32
# File 'lib/fog/hp/models/compute/security_group.rb', line 29

def create_rule(range, ip_protocol = "tcp", cidr = "0.0.0.0/0", group_id=nil)
  requires :id
  service.create_security_group_rule(id, ip_protocol, range.min, range.max, cidr, group_id)
end

#delete_all_rulesObject



39
40
41
42
43
44
# File 'lib/fog/hp/models/compute/security_group.rb', line 39

def delete_all_rules()
  self.rules.each do |rule|
    delete_rule(rule['id'])
  end
  true
end

#delete_rule(rule_id) ⇒ Object



34
35
36
37
# File 'lib/fog/hp/models/compute/security_group.rb', line 34

def delete_rule(rule_id)
  service.delete_security_group_rule(rule_id)
  true
end

#destroyObject



14
15
16
17
18
19
# File 'lib/fog/hp/models/compute/security_group.rb', line 14

def destroy
  requires :id

  service.delete_security_group(id)
  true
end

#saveObject



21
22
23
24
25
26
27
# File 'lib/fog/hp/models/compute/security_group.rb', line 21

def save
  requires :name, :description

  data = service.create_security_group(name, description)
  merge_attributes(data.body['security_group'])
  true
end