QCloudPutBucketRequest Class Reference

Inherits from QCloudBizHTTPRequest
Declared in QCloudPutBucketRequest.h
QCloudPutBucketRequest.m

Overview

创建存储桶(Bucket)的方法.

功能描述

在开始使用 COS 时,需要在指定的账号下先创建一个 Bucket 以便于对象的使用和管理. 并指定 Bucket 所属的地域.创建 Bucket 的用户默认成为 Bucket 的持有者. 若创建 Bucket 时没有指定访问权限,则默认 为私有读写(private)权限.

可用地域,可以查看https://cloud.tencent.com/document/product/436/6224.

关于创建 Bucket 描述,请查看 https://cloud.tencent.com/document/product/436/14106.

示例

@code

QCloudPutBucketRequest* request = [QCloudPutBucketRequest new];

// 存储桶名称,格式为 BucketName-APPID
request.bucket = @"examplebucket-1250000000";

[request setFinishBlock:^(id outputObject, NSError* error) {
    // 可以从 outputObject 中获取服务器返回的 header 信息
    NSDictionary* info = (NSDictionary *) outputObject;
}];
[[QCloudCOSXMLService defaultCOSXML] PutBucket:request];;

  accessControlList

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

@property (strong, nonatomic) NSString *accessControlList

Declared In

QCloudPutBucketRequest.h

  grantRead

赋予被授权者读的权限,id=“OwnerUin";

@property (strong, nonatomic) NSString *grantRead

Declared In

QCloudPutBucketRequest.h

  grantWrite

赋予被授权者写的权限。格式: id=“OwnerUin";

@property (strong, nonatomic) NSString *grantWrite

Declared In

QCloudPutBucketRequest.h

  grantFullControl

赋予被授权者读写权限。格式: id=“OwnerUin";

@property (strong, nonatomic) NSString *grantFullControl

Declared In

QCloudPutBucketRequest.h

  bucket

要创建的存储桶名称,命名规范请参阅 [存储桶命名规范] (https://cloud.tencent.com/document/product/436/13312#.E5.91.BD.E5.90.8D.E8.A7.84.E8.8C.83) 注意存储桶名只能由数字和小写字母组成,并且长度不能超过40个字符,否则会创建失败

@property (strong, nonatomic) NSString *bucket

Declared In

QCloudPutBucketRequest.h