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

Version Path
build-cloud-1.1.7 lib/build-cloud/rdsserver.rb
build-cloud-1.1.6 lib/build-cloud/rdsserver.rb
build-cloud-1.1.5 lib/build-cloud/rdsserver.rb
build-cloud-1.1.4 lib/build-cloud/rdsserver.rb
build-cloud-1.1.3 lib/build-cloud/rdsserver.rb
build-cloud-1.1.2 lib/build-cloud/rdsserver.rb
build-cloud-1.0.1 lib/build-cloud/rdsserver.rb
build-cloud-1.1.1 lib/build-cloud/rdsserver.rb
build-cloud-1.0.0 lib/build-cloud/rdsserver.rb
build-cloud-0.0.24 lib/build-cloud/rdsserver.rb
build-cloud-0.0.23 lib/build-cloud/rdsserver.rb
build-cloud-0.0.22 lib/build-cloud/rdsserver.rb
build-cloud-0.0.21 lib/build-cloud/rdsserver.rb
build-cloud-0.0.20 lib/build-cloud/rdsserver.rb
build-cloud-0.0.19 lib/build-cloud/rdsserver.rb
build-cloud-0.0.18 lib/build-cloud/rdsserver.rb
build-cloud-0.0.17 lib/build-cloud/rdsserver.rb
build-cloud-0.0.16 lib/build-cloud/rdsserver.rb
build-cloud-0.0.15 lib/build-cloud/rdsserver.rb
build-cloud-0.0.14 lib/build-cloud/rdsserver.rb