Class: Ironfan::Provider::Rds

Inherits:
IaasProvider show all
Defined in:
lib/ironfan/headers.rb,
lib/ironfan/provider/rds.rb,
lib/ironfan/provider/rds/machine.rb,
lib/ironfan/provider/rds/security_group.rb

Defined Under Namespace

Classes: Machine, SecurityGroup

Class Method Summary collapse

Methods inherited from IaasProvider

#ensure_prerequisites!, machine_class, #save!

Methods inherited from Ironfan::Provider

aggregate!, forget!, load, prepare!, receive, #resources, validate

Methods inherited from Builder

ui, #ui

Class Method Details

.applicable(computer) ⇒ Object



37
38
39
# File 'lib/ironfan/provider/rds.rb', line 37

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

.aws_account_idObject



24
25
26
# File 'lib/ironfan/provider/rds.rb', line 24

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

.connectionObject

Utility functions



14
15
16
# File 'lib/ironfan/provider/rds.rb', line 14

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

.ensure_tags(tags, fog) ⇒ Object

Ensure that a fog object (machine, volume, etc.) has the proper tags on it



29
30
31
32
33
34
35
# File 'lib/ironfan/provider/rds.rb', line 29

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

.iamObject



18
19
20
21
22
# File 'lib/ironfan/provider/rds.rb', line 18

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

.resourcesObject



7
8
9
# File 'lib/ironfan/provider/rds.rb', line 7

def self.resources
  [ Machine, SecurityGroup ]
end