Sha256: 7e9044f9390795d43135a1661745a26196cf84454207df52d2c864e96b0166c9

Contents?: true

Size: 1.3 KB

Versions: 39

Compression:

Stored size: 1.3 KB

Contents

module Ironfan
  class Provider

    class Rds < Ironfan::IaasProvider
      self.handle = :rds

      def self.resources
        [ Machine, SecurityGroup ]
      end

      #
      # Utility functions
      #
      def self.connection
        @@connection ||=  Fog::AWS::RDS.new(self.aws_credentials)
      end

      def self.iam
        credentials = self.aws_credentials
        credentials.delete(:region)
        @@iam ||= Fog::AWS::IAM.new(credentials)
      end

      def self.aws_account_id()
        Chef::Config[:knife][:aws_account_id]
      end

      # Ensure that a fog object (machine, volume, etc.) has the proper tags on it
      def self.ensure_tags(tags, fog)
        tags.delete_if {|k, v| fog.tags[k] == v.to_s  rescue false }
        return if tags.empty?

        Ironfan.step(fog.id, "tagging with #{tags.inspect}", :green)
        fog.add_tags(tags)
      end

      def self.applicable(computer)
        computer.server and computer.server.clouds.include?(:rds)
      end

      private

      def self.aws_credentials
        return {
          :aws_access_key_id     => Chef::Config[:knife][:aws_access_key_id],
          :aws_secret_access_key => Chef::Config[:knife][:aws_secret_access_key],
          :region                => Chef::Config[:knife][:region]
        }
      end

    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
ironfan-6.1.9 lib/ironfan/provider/rds.rb
ironfan-6.0.9 lib/ironfan/provider/rds.rb
ironfan-6.1.7 lib/ironfan/provider/rds.rb
ironfan-6.1.6 lib/ironfan/provider/rds.rb
ironfan-6.0.8 lib/ironfan/provider/rds.rb
ironfan-6.1.5 lib/ironfan/provider/rds.rb
ironfan-6.1.4 lib/ironfan/provider/rds.rb
ironfan-6.1.3 lib/ironfan/provider/rds.rb
ironfan-6.1.0 lib/ironfan/provider/rds.rb
ironfan-6.0.7 lib/ironfan/provider/rds.rb
ironfan-5.0.11 lib/ironfan/provider/rds.rb
ironfan-6.0.6 lib/ironfan/provider/rds.rb
ironfan-6.0.5 lib/ironfan/provider/rds.rb
ironfan-6.0.4 lib/ironfan/provider/rds.rb
ironfan-6.0.3 lib/ironfan/provider/rds.rb
ironfan-6.0.1 lib/ironfan/provider/rds.rb
ironfan-6.0.0 lib/ironfan/provider/rds.rb
ironfan-5.0.10 lib/ironfan/provider/rds.rb
ironfan-5.0.8 lib/ironfan/provider/rds.rb
ironfan-5.0.5 lib/ironfan/provider/rds.rb