Sha256: 38466c4880e7d456d149a13c1760fe0a74a1a6c70c99f6ffa3b4a4edb0073237
Contents?: true
Size: 849 Bytes
Versions: 1
Compression:
Stored size: 849 Bytes
Contents
require 'aws-sdk' module Itamae module Resource class S3File < File define_attribute :object_key, type: String, default_name: true define_attribute :region, type: String, required: true define_attribute :bucket, type: String, required: true define_attribute :profile, type: String, default: 'default' private def pre_action credentials = Aws::SharedCredentials.new(profile_name: attributes.profile) @s3 = Aws::S3::Client.new(region: attributes.region, credentials: credentials) attributes.content = fetch_content super end def fetch_content case @current_action when :create, :delete, :edit resp = @s3.get_object(bucket: attributes.bucket, key: attributes.object_key) end resp.body.read end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
itamae-spec-0.0.2 | lib/itamae-spec/resource/s3_file.rb |