GET Bucket notification

API Description

You can use this API to obtain the event notification configuration of a bucket.

Method Definition

ObsClient.getBucketNotification

Request Parameter

Field

Type

Optional or Mandatory

Description

Bucket

String

Mandatory

Bucket name

RequestDate

String

or

Date

Optional

Request time

NOTE:

When the parameter type is String, the value must comply with the ISO8601 or RFC822 standards.

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 the bucket, OBS sends a message to the topic.

Event

Array

Type of events that need to be notified.

Filter

Object

List of filtering rules

  

FilterRules

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

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

List of filtering rules

  

FilterRules

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

obsClient.getBucketNotification({
       Bucket : 'bucketname'
},function (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(var j=0;j<result.InterfaceResult.TopicConfigurations.length;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(var 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);
              }
       }
});