Sha256: 83f42ebbd6b0ba1ea3c80291729a2220439083006e636d8201c38eaa32a7a45e

Contents?: true

Size: 1.38 KB

Versions: 58

Compression:

Stored size: 1.38 KB

Contents

module AWS
  class << self
    credential = (ARGV.first && :"#{ARGV.first}") || :default
    if Fog.credentials[:aws_access_key_id] && Fog.credentials[:aws_secret_access_key]

      def initialized?
        true
      end

      def [](service)
        @@connections ||= Hash.new do |hash, key|
          credentials = Fog.credentials.reject do |k, v|
            ![:aws_access_key_id, :aws_secret_access_key].include?(k)
          end
          hash[key] = case key
          when :ec2
            Fog::AWS::EC2.new(credentials)
          when :elb
            Fog::AWS::ELB.new(credentials)
          when :simpledb
            Fog::AWS::SimpleDB.new(credentials)
          when :s3
            Fog::AWS::S3.new(credentials)
          end
        end
        @@connections[service]
      end

      def addresses
        self[:ec2].addresses
      end

      def directories
        self[:s3].directories
      end

      def flavors
        self[:ec2].flavors
      end

      def images
        self[:ec2].images
      end

      def servers
        self[:ec2].servers
      end

      def key_pairs
        self[:ec2].key_pairs
      end

      def security_groups
        self[:ec2].security_groups
      end

      def snapshots
        self[:ec2].snapshots
      end

      def volumes
        self[:ec2].volumes
      end

    else

      def initialized?
        false
      end

    end
  end
end

Version data entries

58 entries across 58 versions & 2 rubygems

Version Path
fog-0.2.30 lib/fog/aws/bin.rb
fog-0.2.28 lib/fog/aws/bin.rb
fog-0.2.27 lib/fog/aws/bin.rb
fog-0.2.26 lib/fog/aws/bin.rb
fog-0.2.25 lib/fog/aws/bin.rb
fog-0.2.24 lib/fog/aws/bin.rb
tecnh-fog-0.2.23.vpc lib/fog/aws/bin.rb
fog-0.2.23 lib/fog/aws/bin.rb
fog-0.2.22 lib/fog/aws/bin.rb
fog-0.2.21 lib/fog/aws/bin.rb
fog-0.2.20 lib/fog/aws/bin.rb
fog-0.2.19 lib/fog/aws/bin.rb
fog-0.2.18 lib/fog/aws/bin.rb
fog-0.2.17 lib/fog/aws/bin.rb
fog-0.2.16 lib/fog/aws/bin.rb
fog-0.2.15 lib/fog/aws/bin.rb
fog-0.2.14 lib/fog/aws/bin.rb
fog-0.2.13 lib/fog/aws/bin.rb
fog-0.2.12 lib/fog/aws/bin.rb
fog-0.2.11 lib/fog/aws/bin.rb