GET Bucket notification
API Description
You can use this API to obtain the event notification settings of a bucket.
Method Definition
1. ObsClient->getBucketNotification(array $parameter) 2. ObsClient->getBucketNotificationAsync(array $parameter, callable $callback)
Request Parameter
|
Field |
Type |
Optional or Mandatory |
Description |
|---|---|---|---|
|
Bucket |
string |
Mandatory |
Bucket name |
Returned Result
|
Field |
Type |
Description |
||
|---|---|---|---|---|
|
HttpStatusCode |
integer |
HTTP status code |
||
|
Reason |
string |
Reason description |
||
|
RequestId |
string |
Request ID returned by the OBS server |
||
|
TopicConfigurations |
indexed array |
Event notification setting list of the bucket |
||
|
ID |
string |
Event notification setting ID |
||
|
Topic |
string |
URN of the event notification topic. After detecting a specific event in the bucket, OBS sends a message to the topic. |
||
|
Event |
indexed array of strings |
Type of events that need to be notified |
||
|
Filter |
indexed array |
List of filtering rules |
||
|
Name |
string |
Prefix or suffix of object names for filtering |
||
|
Value |
string |
Keyword of object names for filtering objects by prefix or suffix |
||
Sample Code
try{
$resp = $obsClient -> getBucketNotification([
'Bucket' => 'bucketname'
]);
printf("RequestId:%s\n", $resp['RequestId']);
foreach ( $resp ['TopicConfigurations'] as $index => $topicConfiguration ) {
printf ( "TopicConfigurations[%d]\n", $index + 1 );
printf ( "ID:%s\n", $topicConfiguration ['ID'] );
printf ( "Topic:%s\n", $topicConfiguration ['Topic'] );
printf ( "Event:%s\n", print_r ( $topicConfiguration ['Event'], true ) );
foreach ( $topicConfiguration ['Filter'] as $index => $filter ) {
printf ( "Filter[%d]", $index + 1 );
printf ( "Name:%s\n", $filter ['Name'] );
printf ( "Value:%s\n", $filter ['Value'] );
}
}
}catch (Obs\Common\ObsException $obsException){
printf("ExceptionCode:%s\n", $obsException->getExceptionCode());
printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}
Last Article: PUT Bucket notification
Next Article: PUT Bucket tagging
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.