Method: Aliyun::OSS::OSSObject.copy

Defined in:
lib/aliyun/oss/object.rb

.copy(key, copy_key, bucket = nil, options = {}) ⇒ Object

Makes a copy of the object with key to copy_key, preserving the ACL of the existing object if the :copy_acl option is true (default false).



183
184
185
186
187
188
189
# File 'lib/aliyun/oss/object.rb', line 183

def copy(key, copy_key, bucket = nil, options = {})
  bucket          = bucket_name(bucket)
  source_key      = path!(bucket, key)
  default_options = {'x-oss-copy-source' => source_key}
  target_key      = path!(bucket, copy_key)
  put(target_key, default_options.merge(options))
end