Sha256: 8e3c102c6c1010ac50da066f965b6042a7bc58d84bfa0fb54952dc595c87fc1f
Contents?: true
Size: 1.46 KB
Versions: 32
Compression:
Stored size: 1.46 KB
Contents
class BuildCloud::RDSServer include ::BuildCloud::Component @@objects = [] def initialize ( fog_interfaces, log, options = {} ) @rds = fog_interfaces[:rds] @log = log @options = options @log.debug( options.inspect ) required_options(:id, :engine, :allocated_storage, :backup_retention_period, :flavor_id, :db_name, :master_username, :password, :vpc_security_group_names) end def create return if exists? @log.info( "Creating RDS Server #{@options[:id]}" ) options = @options.dup options[:db_security_groups] = [] unless options[:vpc_security_groups] options[:vpc_security_groups] = [] options[:vpc_security_group_names].each do |sg| options[:vpc_security_groups] << BuildCloud::SecurityGroup.get_id_by_name( sg ) end options.delete(:vpc_security_group_names) end @log.debug( options.inspect) rds_server = @rds.servers.new( options ) rds_server.save @log.debug( rds_server.inspect ) end def ready_timeout 20 * 60 # RDS instances take a while end def read @rds.servers.select { |r| r.id == @options[:id] }.first end alias_method :fog_object, :read def delete return unless exists? @log.info( "Deleting RDS Server #{@options[:id]}" ) fog_object.destroy end end
Version data entries
32 entries across 32 versions & 1 rubygems