QCloudCOSXMLCopyObjectRequest Class Reference

Inherits from QCloudAbstractRequest
Declared in QCloudCOSXMLCopyObjectRequest.h
QCloudCOSXMLCopyObjectRequest.m

Overview

复制对象

1:先初始化一个 QCloudCOSXMLCopyObjectRequest 对象

2:然后调用 QCloudCOSTransferMangerService 的 CopyObject 方法即可。

注意对于比较大的文件,将会使用分块复制的方式进行复制。这个过程对于用户是没有感知的。

示例

@code

QCloudCOSXMLCopyObjectRequest* request = [[QCloudCOSXMLCopyObjectRequest alloc] init];
request.bucket = @"examplebucket-1250000000";//目的 \<BucketName-APPID>,需要是公有读或者在当前账号有权限
request.object = @"exampleobject";//目的文件名称
//文件来源 \<BucketName-APPID>,需要是公有读或者在当前账号有权限
request.sourceBucket = @"sourcebucket-1250000000";
request.sourceObject = @"sourceObject";//源文件名称
request.sourceAPPID = @"1250000000";//源文件的 APPID
request.sourceRegion= @"COS_REGION";//来源的地域

[request setFinishBlock:^(QCloudCopyObjectResult* result, NSError* error) {
    //可以从 outputObject 中获取 response 中 etag 或者自定义头部等信息
}];

//注意如果是跨地域复制,这里使用的 transferManager 所在的 region 必须为目标桶所在的 region
[[QCloudCOSTransferMangerService defaultCOSTransferManager] CopyObject:request];

  object

对象名

@property (strong, nonatomic) NSString *object

Declared In

QCloudCOSXMLCopyObjectRequest.h

  bucket

存储桶名

@property (strong, nonatomic) NSString *bucket

Declared In

QCloudCOSXMLCopyObjectRequest.h

  sourceBucket

复制的源文件所在Bucket

@property (nonatomic, copy) NSString *sourceBucket

Declared In

QCloudCOSXMLCopyObjectRequest.h

  sourceObject

复制的源文件的对象名,key

@property (nonatomic, copy) NSString *sourceObject

Declared In

QCloudCOSXMLCopyObjectRequest.h

  sourceAPPID

复制的源文件的appID

@property (nonatomic, copy) NSString *sourceAPPID

Declared In

QCloudCOSXMLCopyObjectRequest.h

  sourceRegion

复制的源文件所在的区域。

@property (nonatomic, copy) NSString *sourceRegion

Declared In

QCloudCOSXMLCopyObjectRequest.h

  sourceObjectVersionID

源文件的版本ID

@property (nonatomic, copy) NSString *sourceObjectVersionID

Declared In

QCloudCOSXMLCopyObjectRequest.h

  metadataDirective

是否拷贝元数据,枚举值:Copy, Replaced,默认值 Copy。假如标记为 Copy,忽略 Header 中的用户元数据信息直接复制;假如标记为 Replaced,按 Header 信息修改元数据。当目标路径和原路径一致 ,即用户试图修改元数据时,必须为 Replaced

@property (strong, nonatomic) NSString *metadataDirective

Declared In

QCloudCOSXMLCopyObjectRequest.h

  objectCopyIfModifiedSince

当 Object 在指定时间后被修改,则执行操作,否则返回 412。可与 x-cos-copy-source-If-None-Match 一起使用,与其他条件联合使用返回冲突。

@property (strong, nonatomic) NSString *objectCopyIfModifiedSince

Declared In

QCloudCOSXMLCopyObjectRequest.h

  objectCopyIfUnmodifiedSince

当 Object 在指定时间后未被修改,则执行操作,否则返回 412。可与 x-cos-copy-source-If-Match 一起使用,与其他条件联合使用返回冲突。

@property (strong, nonatomic) NSString *objectCopyIfUnmodifiedSince

Declared In

QCloudCOSXMLCopyObjectRequest.h

  objectCopyIfMatch

当 Object 的 Etag 和给定一致时,则执行操作,否则返回 412。可与x-cos-copy-source-If-Unmodified-Since 一起使用,与其他条件联合使用返回冲突。

@property (strong, nonatomic) NSString *objectCopyIfMatch

Declared In

QCloudCOSXMLCopyObjectRequest.h

  objectCopyIfNoneMatch

当 Object 的 Etag 和给定不一致时,则执行操作,否则返回 412。可与 x-cos-copy-source-If-Modified-Since 一起使用,与其他条件联合使用返回冲突。

@property (strong, nonatomic) NSString *objectCopyIfNoneMatch

Declared In

QCloudCOSXMLCopyObjectRequest.h

  storageClass

Object 的存储级别

@property (assign, nonatomic) QCloudCOSStorageClass storageClass

Declared In

QCloudCOSXMLCopyObjectRequest.h

  accessControlList

定义 Object 的 ACL 属性。有效值:private,public-read-write,public-read;默认值:private

@property (strong, nonatomic) NSString *accessControlList

Declared In

QCloudCOSXMLCopyObjectRequest.h

  grantRead

赋予被授权者读的权限。格式:id=“ ”,id=“ "; 当需要给子账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<SubUin>", 当需要给根账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<OwnerUin>”

@property (strong, nonatomic) NSString *grantRead

Declared In

QCloudCOSXMLCopyObjectRequest.h

  grantWrite

赋予被授权者写的权限。格式:id=“ ”,id=“ "; 当需要给子账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<SubUin>", 当需要给根账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<OwnerUin>”

@property (strong, nonatomic) NSString *grantWrite

Declared In

QCloudCOSXMLCopyObjectRequest.h

  grantFullControl

赋予被授权者读写权限。格式: id=“ ”,id=“ ” ; 当需要给子账户授权时,id=“qcs::cam::uin/<OwnerUin>:uin/<SubUin>", 当需要给根账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<OwnerUin>”

@property (strong, nonatomic) NSString *grantFullControl

Declared In

QCloudCOSXMLCopyObjectRequest.h

– setCopyProgressBlock:

在对大文件进行复制的过程中,会通过分片的方式进行复制。从该进度回调里可以获取当前已经复制了多少分片。

- (void)setCopyProgressBlock:(void ( ^ ) ( int64_t partsSent , int64_t totalPartsExpectedToSent ))copyProgressBlock

Parameters

copyProgressBlock

进度回调block

Declared In

QCloudCOSXMLCopyObjectRequest.h

– setFinishBlock:

Copy操作完成后的回调

- (void)setFinishBlock:(void ( ^ _Nullable ) ( QCloudCopyObjectResult *_Nullable result , NSError *_Nullable error ))QCloudRequestFinishBlock

Parameters

QCloudRequestFinishBlock

完成回调

Declared In

QCloudCOSXMLCopyObjectRequest.h