API | 操作名 | 操作描述 |
查询媒体处理开通情况 | 用于查询已经开通媒体处理功能的存储桶 |
using COSXML.Model.CI;using COSXML.Auth;using System;using COSXML;namespace COSSnippet{public class DescribeMediaBucketModel {private CosXml cosXml;DescribeMediaBucketModel() {CosXmlConfig config = new CosXmlConfig.Builder().SetRegion("COS_REGION") // 设置默认的地域, COS 地域的简称请参照 https://www.tencentcloud.com/document/product/436/6224.Build();string secretId = "SECRET_ID"; // 云 API 密钥 SecretId, 获取 API 密钥请参照 https://console.tencentcloud.com/cam/capistring secretKey = "SECRET_KEY"; // 云 API 密钥 SecretKey, 获取 API 密钥请参照 https://console.tencentcloud.com/cam/capilong durationSecond = 600; //每次请求签名有效时长,单位为秒QCloudCredentialProvider qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId,secretKey, durationSecond);this.cosXml = new CosXmlServer(config, qCloudCredentialProvider);}// 获取开通了万象功能的 Buckets 列表public void DescribeMediaBucket(){//.cssg-snippet-body-start:[DescribeMediaBucket]DescribeMediaBucketsRequest request = new DescribeMediaBucketsRequest();// 执行请求DescribeMediaBucketsResult result = cosXml.DescribeMediaBuckets(request);Console.WriteLine(result.GetResultInfo());// 遍历Bucket列表for (int i = 0; i < result.mediaBuckets.MediaBucketList.Count; i++){Console.WriteLine(result.mediaBuckets.MediaBucketList[i].BucketId);Console.WriteLine(result.mediaBuckets.MediaBucketList[i].Region);Console.WriteLine(result.mediaBuckets.MediaBucketList[i].CreateTime);}//.cssg-snippet-body-end}static void Main(string[] args){DescribeMediaBucketModel m = new DescribeMediaBucketModel();// 获取媒体Buckets列表m.DescribeMediaBucket();// .cssg-methods-pragma}}}
本页内容是否解决了您的问题?