Sha256: f2dee56eaa0bc7ead319b3d7355065c2af1a629a0f55d4b363626f70f70fdf5b

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

module Heirloom

  class Authorizer

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

    def authorize(args)
      regions = args[:regions]
      accounts = args[:accounts]

      @logger.info "Authorizing access to artifact."

      regions.each do |region|
        bucket = reader.get_bucket :region => region

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

        s3_acl.allow_read_access_from_accounts :key_name   => @id,
                                               :key_folder => @name,
                                               :bucket     => bucket,
                                               :accounts   => accounts
      end

      @logger.info "Authorization complete."
    end

    private

    def reader
      @reader ||= Reader.new :config => @config,
                             :name   => @name,
                             :id     => @id
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
heirloom-0.5.0rc3 lib/heirloom/archive/authorizer.rb
heirloom-0.5.0rc2 lib/heirloom/archive/authorizer.rb
heirloom-0.5.0rc1 lib/heirloom/archive/authorizer.rb
heirloom-0.4.1rc1 lib/heirloom/archive/authorizer.rb
heirloom-0.4.0 lib/heirloom/archive/authorizer.rb
heirloom-0.3.1 lib/heirloom/archive/authorizer.rb
heirloom-0.3.0 lib/heirloom/archive/authorizer.rb
heirloom-0.3.0.rc1 lib/heirloom/archive/authorizer.rb