diff --git a/lib/fog/aws/models/compute/security_groups.rb b/lib/fog/aws/models/compute/security_groups.rb index 32ae5b98a..f8010a09a 100644 --- a/lib/fog/aws/models/compute/security_groups.rb +++ b/lib/fog/aws/models/compute/security_groups.rb @@ -88,6 +88,28 @@ module Fog end end + # Used to retreive a security group + # group id is required to get the associated flavor information. + # + # You can run the following command to get the details: + # AWS.security_groups.get_by_id("default") + # + # ==== Returns + # + #>> AWS.security_groups.get_by_id("sg-123456") + # [{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>-1, "toPort"=>-1, "ipRanges"=>[], "ipProtocol"=>"icmp"}, {"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>0, "toPort"=>65535, "ipRanges"=>[], "ipProtocol"=>"tcp"}, {"groups"=>[{"groupName"=>"default", "userId"=>"312571045469"}], "fromPort"=>0, "toPort"=>65535, "ipRanges"=>[], "ipProtocol"=>"udp"}], + # owner_id="312571045469" + # > + # + + def get_by_id(group_id) + if group_id + self.class.new(:connection => connection).all('group-id' => group_id).first + end + end end end