Sha256: db2f08214e801f4394bb996316590a3fd0775f6f604bfc0f01a2094889469e07
Contents?: true
Size: 1.11 KB
Versions: 9
Compression:
Stored size: 1.11 KB
Contents
module Fog module AWS class EC2 def security_groups Fog::AWS::EC2::SecurityGroups.new(:connection => self) end class SecurityGroups < Fog::Collection attribute :group_name model Fog::AWS::EC2::SecurityGroup def initialize(attributes) @group_name ||= [] super end def all(group_name = @group_name) data = connection.describe_security_groups(group_name).body security_groups = Fog::AWS::EC2::SecurityGroups.new({ :connection => connection, :group_name => group_name }.merge!(attributes)) data['securityGroupInfo'].each do |security_group| security_groups << Fog::AWS::EC2::SecurityGroup.new({ :collection => security_groups, :connection => connection }.merge!(security_group)) end security_groups end def get(group_name) if group_name all(group_name).first end rescue Excon::Errors::BadRequest nil end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems