Sha256: 97cd86ff6e316bc0b83fb93c91406b842de5b8f5769ae3fd05c695e9665a30e8

Contents?: true

Size: 1.15 KB

Versions: 29

Compression:

Stored size: 1.15 KB

Contents

module Heirloom

  class Teardowner

    def initialize(args)
      @config = args[:config]
      @name   = args[:name]
      @domain = "heirloom_#{@name}"
      @logger = @config.logger
      @region = @config.metadata_region
    end

    def delete_buckets(args)
      regions       = args[:regions]
      bucket_prefix = args[:bucket_prefix]

      regions.each do |region|
        bucket = "#{bucket_prefix}-#{region}"

        if verifier.bucket_exists? :region        => region,
                                   :bucket_prefix => bucket_prefix
          @logger.info "Destroying bucket #{bucket} in #{region}."
          s3 = AWS::S3.new :config => @config,
                           :region => region
          s3.delete_bucket bucket
        end
      end
    end

    def delete_domain
      if verifier.domain_exists?
        @logger.info "Destroying domain #{@name} in #{@region}."
        sdb.delete_domain @domain 
      end
    end

    private

    def verifier
      @verifier ||= Verifier.new :config => @config,
                                 :name   => @name
    end

    def sdb
      @sdb ||= AWS::SimpleDB.new :config => @config
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
heirloom-0.7.3 lib/heirloom/archive/teardowner.rb
heirloom-0.7.3rc2 lib/heirloom/archive/teardowner.rb
heirloom-0.7.3rc1 lib/heirloom/archive/teardowner.rb
heirloom-0.7.2 lib/heirloom/archive/teardowner.rb
heirloom-0.7.2rc2 lib/heirloom/archive/teardowner.rb
heirloom-0.7.2rc1 lib/heirloom/archive/teardowner.rb
heirloom-0.7.1 lib/heirloom/archive/teardowner.rb
heirloom-0.7.0 lib/heirloom/archive/teardowner.rb
heirloom-0.7.0rc1 lib/heirloom/archive/teardowner.rb