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-5.0.4 lib/ironfan/provider/rds.rb
ironfan-5.0.3 lib/ironfan/provider/rds.rb
ironfan-5.0.2 lib/ironfan/provider/rds.rb
ironfan-5.0.1 lib/ironfan/provider/rds.rb
ironfan-5.0.0 lib/ironfan/provider/rds.rb
ironfan-4.12.3 lib/ironfan/provider/rds.rb
ironfan-4.12.2 lib/ironfan/provider/rds.rb
ironfan-4.12.1 lib/ironfan/provider/rds.rb
ironfan-4.12.0 lib/ironfan/provider/rds.rb
ironfan-4.11.5 lib/ironfan/provider/rds.rb
ironfan-4.11.4 lib/ironfan/provider/rds.rb
ironfan-4.11.3 lib/ironfan/provider/rds.rb
ironfan-4.11.2 lib/ironfan/provider/rds.rb
ironfan-4.11.2.pre3 lib/ironfan/provider/rds.rb
ironfan-4.11.2.pre2 lib/ironfan/provider/rds.rb
ironfan-4.11.2.pre lib/ironfan/provider/rds.rb
ironfan-4.11.1 lib/ironfan/provider/rds.rb
ironfan-4.11.0 lib/ironfan/provider/rds.rb
ironfan-4.10.4 lib/ironfan/provider/rds.rb