Skip to content

Commit

Permalink
Add tags attribute to Storage::File model
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosobral committed Nov 7, 2019
1 parent bd38f80 commit ab288f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
mkmf.log
tests/.fog
gemfiles/Gemfile-edge.lock
.idea
3 changes: 3 additions & 0 deletions lib/fog/aws/models/storage/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class File < Fog::Model
attribute :encryption_key, :aliases => 'x-amz-server-side-encryption-customer-key'
attribute :version, :aliases => 'x-amz-version-id'
attribute :kms_key_id, :aliases => 'x-amz-server-side-encryption-aws-kms-key-id'
attribute :tags, :aliases => 'x-amz-tagging'

# @note Chunk size to use for multipart uploads.
# Use small chunk sizes to minimize memory. E.g. 5242880 = 5mb
Expand Down Expand Up @@ -192,6 +193,7 @@ def public_url
# @option options [String] expires sets number of seconds before AWS Object expires.
# @option options [String] storage_class sets x-amz-storage-class HTTP header. Defaults to 'STANDARD'. Or, 'REDUCED_REDUNDANCY'
# @option options [String] encryption sets HTTP encryption header. Set to 'AES256' to encrypt files at rest on S3
# @option options [String] tags sets x-amz-tagging HTTP header. For example, 'Org-Id=1' or 'Org-Id=1&Service=MyService'
# @return [Boolean] true if no errors
#
def save(options = {})
Expand All @@ -208,6 +210,7 @@ def save(options = {})
options['Expires'] = expires if expires
options.merge!(metadata)
options['x-amz-storage-class'] = storage_class if storage_class
options['x-amz-tagging'] = tags if tags
options.merge!(encryption_headers)

# With a single PUT operation you can upload objects up to 5 GB in size. Automatically set MP for larger objects.
Expand Down

0 comments on commit ab288f2

Please sign in to comment.