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.12.7 lib/heirloom/archive/teardowner.rb
heirloom-0.12.5 lib/heirloom/archive/teardowner.rb
heirloom-0.12.4 lib/heirloom/archive/teardowner.rb
heirloom-0.12.3 lib/heirloom/archive/teardowner.rb
heirloom-0.12.2 lib/heirloom/archive/teardowner.rb
heirloom-0.12.1 lib/heirloom/archive/teardowner.rb
heirloom-0.12.0 lib/heirloom/archive/teardowner.rb
heirloom-0.11.2 lib/heirloom/archive/teardowner.rb
heirloom-0.11.1 lib/heirloom/archive/teardowner.rb
heirloom-0.11.0 lib/heirloom/archive/teardowner.rb
heirloom-0.11.0.beta.2 lib/heirloom/archive/teardowner.rb
heirloom-0.11.0.beta.1 lib/heirloom/archive/teardowner.rb
heirloom-0.10.1 lib/heirloom/archive/teardowner.rb
heirloom-0.10.0 lib/heirloom/archive/teardowner.rb
heirloom-0.9.0 lib/heirloom/archive/teardowner.rb
heirloom-0.8.3 lib/heirloom/archive/teardowner.rb
heirloom-0.8.2 lib/heirloom/archive/teardowner.rb
heirloom-0.8.1 lib/heirloom/archive/teardowner.rb
heirloom-0.8.0 lib/heirloom/archive/teardowner.rb
heirloom-0.7.4 lib/heirloom/archive/teardowner.rb