From f0f24772d1dbc44226b37b57f92ca2858f9cc353 Mon Sep 17 00:00:00 2001 From: bdorry Date: Wed, 7 Sep 2011 11:10:20 -0400 Subject: [PATCH] [aws|compute] added security group get by id method --- lib/fog/aws/models/compute/security_groups.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) 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