-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add bucket access monitor api and modify bucket lifecycle rule
- Loading branch information
1 parent
572d0f8
commit 207027f
Showing
26 changed files
with
2,135 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/Common.php'; | ||
|
||
use OSS\OssClient; | ||
use OSS\Core\OssException; | ||
|
||
$ossClient = Common::getOssClient(); | ||
if (is_null($ossClient)) exit(1); | ||
$bucket = Common::getBucketName(); | ||
|
||
//******************************* Simple Usage**************************************************************** | ||
|
||
// put access monitor | ||
$status = 'Enabled'; | ||
$ossClient->putBucketAccessMonitor($bucket, $status); | ||
printf('Put Bucket Access Monitor Success' . "\n"); | ||
|
||
|
||
// get access monitor | ||
$status = $ossClient->getBucketAccessMonitor($bucket); | ||
printf('Get Bucket Access Monitor Status:%s'."\n",$status); | ||
|
||
|
||
//******************************* For complete usage, see the following functions **************************************************** | ||
putBucketAccessMonitor($ossClient,$bucket); | ||
getBucketAccessMonitor($ossClient,$bucket); | ||
|
||
/** | ||
* putBucketAccessMonitor | ||
* @param $ossClient OssClient | ||
* @param string $bucket bucket_name string | ||
*/ | ||
function putBucketAccessMonitor($ossClient, $bucket) | ||
{ | ||
try{ | ||
$status = 'Enabled'; // set Enabled to enable access monitor; set Disabled to disable access monitor | ||
$ossClient->putBucketTransferAcceleration($bucket,$status); | ||
printf('Put Bucket Access Monitor Success' . "\n"); | ||
} catch(OssException $e) { | ||
printf($e->getMessage() . "\n"); | ||
return; | ||
} | ||
print(__FUNCTION__ . ": OK" . "\n"); | ||
} | ||
|
||
/** | ||
* @param $ossClient OssClient | ||
* @param string $bucket bucket_name | ||
*/ | ||
function getBucketAccessMonitor($ossClient, $bucket) | ||
{ | ||
try{ | ||
$status = $ossClient->getBucketAccessMonitor($bucket); | ||
printf('Get Bucket Access Monitor Status:%s'."\n",$status); | ||
} catch(OssException $e) { | ||
printf($e->getMessage() . "\n"); | ||
return; | ||
} | ||
print(__FUNCTION__ . ": OK" . "\n"); | ||
} |
Oops, something went wrong.