Class: Fog::Compute::Cloudstack::SecurityGroups

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/cloudstack/models/compute/security_groups.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object


10
11
12
13
# File 'lib/fog/cloudstack/models/compute/security_groups.rb', line 10

def all(options={})
  data = service.list_security_groups(options)["listsecuritygroupsresponse"]["securitygroup"] || []
  load(data)
end

#get(security_group_id) ⇒ Object


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

def get(security_group_id)
  if security_group = service.list_security_groups('id' => security_group_id)["listsecuritygroupsresponse"]["securitygroup"].first
    new(security_group)
  end
rescue Fog::Compute::Cloudstack::BadRequest
  nil
end