GET Bucket notification
API Description
You can use this API to obtain the event notification settings of a bucket.
Method Definition
ObsClient.getBucketNotification
Request Parameter
| Field | Type | Optional or Mandatory | Description |
|---|---|---|---|
| Bucket | String | Mandatory | Bucket name |
Returned Result (InterfaceResult)
| Field | Type | Description | |||
|---|---|---|---|---|---|
| RequestId | String | Request ID returned by the OBS server | |||
| TopicConfigurations | Array | Configuration list of the Simple Notification Service (SMS) | |||
| ID | String | Configuration ID of the SMS | |||
| Topic | String | URN of the event notification topic. After detecting a specific event in a bucket, OBS sends a message to the topic. | |||
| Event | Array | Type of events that need to be notified. | |||
| Filter | Object | Filtering rule information | |||
| FilterRules | Array | List of filtering rules | |||
| Name | String | Prefix or suffix of object names for filtering | |||
| Value | String | Keyword of object name for filtering objects by prefix or suffix | |||
| FunctionGraphConfigurations | Array | FunctionGraph configuration list | |||
| ID | String | FunctionGraph configuration ID | |||
| FunctionGraph | String | URN of FunctionGraph. When OBS detects a specific event in the bucket, it sends a message to FunctionGraph and calls FunctionGraph. | |||
| Event | Array | List of event types that need to send messages to FunctionGraph. | |||
| Filter | Object | Filtering rule information | |||
| FilterRules | Array | List of filtering rules | |||
| Name | String | Prefix or suffix of object names for filtering | |||
| Value | String | Keyword of object name for filtering objects by prefix or suffix | |||
Sample Code
obsClient.getBucketNotification({
Bucket : 'bucketname'
},(err, result) => {
if(err){
console.error('Error-->' + err);
}else{
if(result.CommonMsg.Status < 300){
console.log('RequestId-->' + result.InterfaceResult.RequestId);
if(result.InterfaceResult.TopicConfigurations){
for(let j=0;j<result.InterfaceResult.TopicConfigurations;j++){
console.log('ID-->' + result.InterfaceResult.TopicConfigurations[j].ID);
console.log('Topic-->' + result.InterfaceResult.TopicConfigurations[j].Topic);
console.log('Event-->' + result.InterfaceResult.TopicConfigurations[j].Event);
if(result.InterfaceResult.TopicConfigurations[j].Filter){
for(let i=0;i<result.InterfaceResult.TopicConfigurations[j].Filter.FilterRules.length;i++){
console.log('FilterRule[' + i + '][Name]-->' + result.InterfaceResult.TopicConfigurations[j].Filter.FilterRules[i].Name);
console.log('FilterRule[' + i + '][Value]-->' + result.InterfaceResult.TopicConfigurations[j].Filter.FilterRules[i].Value);
}
}
}
}
}else{
console.log('Code-->' + result.CommonMsg.Code);
console.log('Message-->' + result.CommonMsg.Message);
}
}
}); 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.