API | 操作名 | 操作描述 |
设置日志管理 | 为源存储桶开启日志记录 | |
查询日志管理 | 查询源存储桶的日志配置信息 |
public Guzzle\\Service\\Resource\\Model PutBucketLogging(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->putBucketLogging(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'LoggingEnabled' => array('TargetBucket' => 'examplebucket2-1250000000','TargetPrefix' => '',));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
public Guzzle\\Service\\Resource\\Model GetBucketLogging(array $args = array());
<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->getBucketLogging(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket));// 请求成功print_r($result);} catch (\\Exception $e) {// 请求失败echo($e);}
参数名称 | 描述 | 类型 |
Bucket | 源存储桶,格式为 BucketName-APPID ,详情请参见 命名规范 | String |
GuzzleHttp\\Command\\Result Object([LoggingEnabled] => Array([TargetBucket] => examplebucket2-1250000000[TargetPrefix] =>)[RequestId] => NWRmMWJjOThfMjZiMjU4NjRfODY4X2ExMjcy****)
成员变量 | 描述 | 类型 |
TargetBucket | 日志存放的目标存储桶 | String |
TargetPrefix | 日志存放的目标存储桶路径 | String |
本页内容是否解决了您的问题?