Sha256: d55dd66912f26dc61b89deded8bbe62836ea148ff48fc2b9e4fae61c107f266f

Contents?: true

Size: 1005 Bytes

Versions: 4

Compression:

Stored size: 1005 Bytes

Contents

require 'fog/core/collection'
require 'fog/aws/models/compute/security_group'

module Fog
  module AWS
    class Compute

      class SecurityGroups < Fog::Collection

        attribute :filters

        model Fog::AWS::Compute::SecurityGroup

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters = filters)
          unless filters.is_a?(Hash)
            Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('group-name' => []) instead[/] [light_black](#{caller.first})[/]")
            filters = {'group-name' => [*filters]}
          end
          self.filters = filters
          data = connection.describe_security_groups(@filters).body
          load(data['securityGroupInfo'])
        end

        def get(group_name)
          if group_name
            self.class.new(:connection => connection).all('group-name' => group_name).first
          end
        end

      end

    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fog-0.3.25 lib/fog/aws/models/compute/security_groups.rb
fog-0.3.24 lib/fog/aws/models/compute/security_groups.rb
bbcloud-0.8.1 lib/bbcloud/vendor/fog-0.3.23/lib/fog/aws/models/compute/security_groups.rb
fog-0.3.23 lib/fog/aws/models/compute/security_groups.rb