QCloudGetPresignedURLRequest Class Reference
Inherits from | QCloudBizHTTPRequest |
---|---|
Declared in | QCloudGetPresignedURLRequest.h QCloudGetPresignedURLRequest.m |
Overview
生成对象预签名链接
功能说明
关于生成对象预签名链接接口的更多示例,请参见:https://cloud.tencent.com/document/product/436/34109
示例
@code
QCloudGetPresignedURLRequest* getPresignedURLRequest = [[QCloudGetPresignedURLRequest alloc] init];
// 存储桶名称,格式为 BucketName-APPID
getPresignedURLRequest.bucket = @"examplebucket-1250000000";
// 使用预签名 URL 的请求的 HTTP 方法。有效值(大小写敏感)为:@"GET"、@"PUT"、@"POST"、@"DELETE"
getPresignedURLRequest.HTTPMethod = @"GET";
// 对象键,是对象在 COS 上的完整路径,如果带目录的话,格式为 "dir1/object1"
getPresignedURLRequest.object = @"exampleobject";
[getPresignedURLRequest setFinishBlock:^(QCloudGetPresignedURLResult * _Nonnull result,
NSError * _Nonnull error) {
// 预签名 URL
NSString* presignedURL = result.presienedURL;
}];
[[QCloudCOSXMLService defaultCOSXML] getPresignedURL:getPresignedURLRequest];
bucket
填入使用预签名请求的Bucket
@property (nonatomic, copy) NSString *bucket
Declared In
QCloudGetPresignedURLRequest.h
object
填入对应的Object
@property (nonatomic, copy) NSString *object
Declared In
QCloudGetPresignedURLRequest.h
HTTPMethod
填入使用预签名URL的请求的HTTP方法。有效值(大小写敏感)为:@“GET”,@“PUT”,@“POST”,@“DELETE”
@property (nonatomic, copy) NSString *HTTPMethod
Declared In
QCloudGetPresignedURLRequest.h
contentType
如果使用预签名URL的请求有该头部,那么通过这里设置
@property (nonatomic, readonly) NSString *contentType
Declared In
QCloudGetPresignedURLRequest.h
contentMD5
如果使用预签名URL的请求有该头部,那么通过这里设置
@property (nonatomic, readonly) NSString *contentMD5
Declared In
QCloudGetPresignedURLRequest.h
– setValue:forRequestHeader:
添加使用预签名请求的头部
- (void)setValue:(NSString *_Nullable)value forRequestHeader:(NSString *_Nullable)requestHeader
Parameters
value |
HTTP header的值 |
---|---|
requestHeader |
HTTP header的key |
Declared In
QCloudGetPresignedURLRequest.h
– setValue:forRequestParameter:
添加使用预签名请求的URL参数
- (void)setValue:(NSString *_Nullable)value forRequestParameter:(NSString *_Nullable)requestParameter
Parameters
value |
参数的值 |
---|---|
requestParameter |
参数的key |
Declared In
QCloudGetPresignedURLRequest.h
– setFinishBlock:
设置完成回调。请求完成后会通过该回调来获取结果,如果没有error,那么可以认为请求成功。
- (void)setFinishBlock:(void ( ^ _Nullable ) ( QCloudGetPresignedURLResult *_Nullable result , NSError *_Nullable error ))finishBlock
Parameters
finishBlock |
请求完成回调 |
---|
Declared In
QCloudGetPresignedURLRequest.h