Sha256: 3491830770746b59e3eaa0b26034518ccc9cae64d392576a952e2d8c4a802f05

Contents?: true

Size: 835 Bytes

Versions: 18

Compression:

Stored size: 835 Bytes

Contents

class BuildCloud::S3Bucket

    include ::BuildCloud::Component

    @@objects = []

    def initialize ( fog_interfaces, log, options = {} )

        @s3      = fog_interfaces[:s3]
        @log     = log
        @options = options

        @log.debug( options.inspect )

        required_options(:key, :location)

    end

    def create
        
        return if exists?

        @log.info( "Creating new S3 bucket #{@options[:key]}" )

        bucket = @s3.directories.new( @options )
        bucket.save

        @log.debug( bucket.inspect )

    end

    def read
        @s3.directories.select { |d| d.key == @options[:key] }.first
    end

    alias_method :fog_object, :read

    def delete

        return unless exists?

        @log.info( "Deleting S3 bucket #{@options[:key]}" )

        fog_object.destroy

    end

end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
build-cloud-0.0.19 lib/build-cloud/s3bucket.rb
build-cloud-0.0.18 lib/build-cloud/s3bucket.rb
build-cloud-0.0.17 lib/build-cloud/s3bucket.rb
build-cloud-0.0.16 lib/build-cloud/s3bucket.rb
build-cloud-0.0.15 lib/build-cloud/s3bucket.rb
build-cloud-0.0.14 lib/build-cloud/s3bucket.rb
build-cloud-0.0.13 lib/build-cloud/s3bucket.rb
build-cloud-0.0.12 lib/build-cloud/s3bucket.rb
build-cloud-0.0.11 lib/build-cloud/s3bucket.rb
build-cloud-0.0.10 lib/build-cloud/s3bucket.rb
build-cloud-0.0.9 lib/build-cloud/s3bucket.rb
build-cloud-0.0.8 lib/build-cloud/s3bucket.rb
build-cloud-0.0.7 lib/build-cloud/s3bucket.rb
build-cloud-0.0.6 lib/build-cloud/s3bucket.rb
build-cloud-0.0.5 lib/build-cloud/s3bucket.rb
build-cloud-0.0.4 lib/build-cloud/s3bucket.rb
build-cloud-0.0.3 lib/build-cloud/s3bucket.rb
build-cloud-0.0.1 lib/build-cloud/s3bucket.rb