QCloudPutObjectRequest.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //
  2. // PutObject.h
  3. // PutObject
  4. //
  5. // Created by tencent
  6. // Copyright (c) 2015年 tencent. All rights reserved.
  7. //
  8. // ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗ ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ██╗ █████╗ ██████╗
  9. // ██╔═══██╗██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗ ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ██║ ██╔══██╗██╔══██╗
  10. // ██║ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ██║ ███████║██████╔╝
  11. // ██║▄▄ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ██║ ██╔══██║██╔══██╗
  12. // ╚██████╔╝╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗ ███████╗██║ ██║██████╔╝
  13. // ╚══▀▀═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚═════╝
  14. //
  15. //
  16. // _ __ _ _
  17. // (_) / _| | | | |
  18. // ___ ___ _ ____ ___ ___ ___ | |_ ___ _ __ __| | _____ _____| | ___ _ __ ___ _ __ ___
  19. // / __|/ _ \ '__\ \ / / |/ __/ _ \ | _/ _ \| '__| / _` |/ _ \ \ / / _ \ |/ _ \| '_ \ / _ \ '__/ __|
  20. // \__ \ __/ | \ V /| | (_| __/ | || (_) | | | (_| | __/\ V / __/ | (_) | |_) | __/ | \__
  21. // |___/\___|_| \_/ |_|\___\___| |_| \___/|_| \__,_|\___| \_/ \___|_|\___/| .__/ \___|_| |___/
  22. // ______ ______ ______ ______ ______ ______ ______ ______ | |
  23. // |______|______|______|______|______|______|______|______| |_|
  24. //
  25. #import <Foundation/Foundation.h>
  26. #import <QCloudCore/QCloudCore.h>
  27. #import "QCloudCOSStorageClassEnum.h"
  28. NS_ASSUME_NONNULL_BEGIN
  29. /**
  30. 简单上传的方法.
  31. 简单上传主要适用于在单个请求中上传一个小于 5 GB 大小的对象. 对于大于 5 GB 的对象(或者在高带宽或弱网络环境中)优先使用分片上传的方式 (https://cloud.tencent.com/document/product/436/14112).
  32. 关于简单上传的具体描述,请查看 https://cloud.tencent.com/document/product/436/14113.
  33. 关于简单上传接口的具体描述,请查看 https://cloud.tencent.com/document/product/436/7749.
  34. cos iOS SDK 中简单上传请求的方法具体步骤如下:
  35. 1. 实例化 QCloudPutObjectRequest,填入需要的参数。
  36. 2. 调用 QCloudCOSXMLService 对象中的 PutObject 方法发出请求。
  37. 3. 从回调的 finishBlock 中的 outputObject 获取具体内容。
  38. 示例:
  39. @code
  40. QCloudPutObjectRequest* put = [QCloudPutObjectRequest new];
  41. put.object = @"object-name";
  42. put.bucket = @"bucket-12345678";
  43. put.body = [@"testFileContent" dataUsingEncoding:NSUTF8StringEncoding];
  44. [put setFinishBlock:^(id outputObject, NSError *error) {
  45. //完成回调
  46. if (nil == error) {
  47. //成功
  48. }
  49. }];
  50. [[QCloudCOSXMLService defaultCOSXML] PutObject:put];
  51. @endcode
  52. */
  53. @interface QCloudPutObjectRequest <BodyType> : QCloudBizHTTPRequest
  54. @property (nonatomic, strong) BodyType body;
  55. /**
  56. 对象 名称
  57. */
  58. @property (strong, nonatomic) NSString *object;
  59. /**
  60. 存储桶 名称
  61. */
  62. @property (strong, nonatomic) NSString *bucket;
  63. /**
  64. RFC 2616 中定义的缓存策略,将作为 Object 元数据保存
  65. */
  66. @property (strong, nonatomic) NSString *cacheControl;
  67. /**
  68. RFC 2616 中定义的文件名称,将作为 Object 元数据保存
  69. */
  70. @property (strong, nonatomic) NSString *contentDisposition;
  71. /**
  72. 当使用 Expect: 100-continue 时,在收到服务端确认后,才会发送请求内容
  73. */
  74. @property (strong, nonatomic) NSString *expect;
  75. /**
  76. RFC 2616 中定义的过期时间,将作为 Object 元数据保存
  77. */
  78. @property (strong, nonatomic) NSString *expires;
  79. @property (strong, nonatomic) NSString *contentSHA1;
  80. /**
  81. Object 的存储级别
  82. */
  83. @property (assign, nonatomic) QCloudCOSStorageClass storageClass;
  84. /**
  85. 定义 Object 的 ACL 属性。有效值:private,public-read-write,public-read;默认值:private
  86. */
  87. @property (strong, nonatomic) NSString *accessControlList;
  88. /**
  89. 赋予被授权者读的权限。格式:id=" ",id=" ";
  90. 当需要给子账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<SubUin>",
  91. 当需要给根账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<OwnerUin>"
  92. */
  93. @property (strong, nonatomic) NSString *grantRead;
  94. /**
  95. 赋予被授权者写的权限。格式:id=" ",id=" ";
  96. 当需要给子账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<SubUin>",
  97. 当需要给根账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<OwnerUin>"
  98. */
  99. @property (strong, nonatomic) NSString *grantWrite;
  100. /**
  101. 赋予被授权者读写权限。格式: id=" ",id=" " ;
  102. 当需要给子账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<SubUin>",
  103. 当需要给根账户授权时,id="qcs::cam::uin/<OwnerUin>:uin/<OwnerUin>"
  104. */
  105. @property (strong, nonatomic) NSString *grantFullControl;
  106. /*
  107. 在进行HTTP请求的时候,可以通过设置该参数来设置自定义的一些头部信息。
  108. 通常情况下,携带特定的额外HTTP头部可以使用某项功能,如果是这类需求,可以通过设置该属性来实现。
  109. */
  110. @property (strong, nonatomic) NSDictionary* customHeaders;
  111. @end
  112. NS_ASSUME_NONNULL_END