Sha256: 516d2d1d8ec7ca2310f7b191c59696cf9a68e71003dba1b47537fcb1beb44308

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

module Heirloom

  class ArtifactAuthorizer

    def initialize(args)
      @config = args[:config]
      @logger = args[:logger]
    end

    def authorize(args)
      id = args[:id]
      name = args[:name]
      public_readable = args[:public_readable]

      unless public_readable
        @logger.info "Authorizing access to artifact."

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

          s3_acl = ACL::S3.new :config => @config,
                               :logger => @logger,
                               :region => region

          s3_acl.allow_read_acccess_from_accounts :key_name => id,
                                                  :key_folder => name,
                                                  :bucket => bucket
        end
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
heirloom-0.1.2 lib/heirloom/artifact/artifact_authorizer.rb
heirloom-0.1.1 lib/heirloom/artifact/artifact_authorizer.rb