API | 操作名 | 操作描述 |
设置存储桶 Referer | 设置存储桶 Referer 白名单或者黑名单 | |
查询存储桶 Referer | 查询存储桶 Referer 白名单或者黑名单 |
QCloudPutBucketRefererRequest* request = [QCloudPutBucketRefererRequest new];// 防盗链类型,枚举值:Black-List、White-Listrequest.refererType = QCloudBucketRefererTypeBlackList;// 是否开启防盗链,枚举值:Enabled、Disabledrequest.status = QCloudBucketRefererStatusEnabled;// 是否允许空 Referer 访问,枚举值:Allow、Deny,默认值为 Denyrequest.configuration = QCloudBucketRefererConfigurationDeny;// 生效域名列表, 支持多个域名且为前缀匹配, 支持带端口的域名和 IP, 支持通配符*,做二级域名或多级域名的通配request.domainList = @[@"*.com",@"*.qq.com"];// 存储桶名称,格式为 BucketName-APPIDrequest.bucket = @"examplebucket-1250000000";[request setFinishBlock:^(id outputObject, NSError *error) {if (error){// 添加防盗链失败}else{// 添加防盗链失败}}];[[QCloudCOSXMLService defaultCOSXML] PutBucketReferer:request];
let request = QCloudPutBucketRefererRequest.init();// 防盗链类型,枚举值:Black-List、White-Listrequest.refererType = QCloudBucketRefererType.blackList;// 是否开启防盗链,枚举值:Enabled、Disabledrequest.status = QCloudBucketRefererStatus.enabled;// 是否允许空 Referer 访问,枚举值:Allow、Deny,默认值为 Denyrequest.configuration = QCloudBucketRefererConfiguration.allow;// 生效域名列表, 支持多个域名且为前缀匹配, 支持带端口的域名和 IP, 支持通配符*,做二级域名或多级域名的通配request.domainList = ["*.com","*.qq.com"];// 存储桶名称,格式为 BucketName-APPIDrequest.bucket = "examplebucket-1250000000";request.finishBlock = {(result,error) inif (error != nil){// 添加防盗链失败}else{// 添加防盗链失败}}QCloudCOSXMLService.defaultCOSXML().putBucketReferer(request);
QCloudGetBucketRefererRequest* request = [QCloudGetBucketRefererRequest new];// 存储桶名称,格式为 BucketName-APPIDrequest.bucket = @"examplebucket-1250000000";[request setFinishBlock:^(QCloudBucketRefererInfo * outputObject, NSError *error) {// outputObject 请求到的防盗链,详细字段请查看api文档或者SDK源码// QCloudBucketRefererInfo 类;}];[[QCloudCOSXMLService defaultCOSXML] GetBucketReferer:request];
let request = QCloudGetBucketRefererRequest.init();// 存储桶名称,格式为 BucketName-APPIDrequest.bucket = "examplebucket-1250000000";request.finishBlock = {(result,error) in// outputObject 请求到的防盗链,详细字段请查看api文档或者SDK源码// QCloudBucketRefererInfo 类;}QCloudCOSXMLService.defaultCOSXML().getBucketReferer(request);
本页内容是否解决了您的问题?