PUT Bucket notification
API Description
You can use this API to set event notification for a bucket. The user will be notified of all specified operations performed on the bucket.
Method Definition
ObsClient.setBucketNotification
Request Parameter
|
Field |
Type |
Optional or Mandatory |
Description |
|||
|---|---|---|---|---|---|---|
|
Bucket |
String |
Mandatory |
Bucket name |
|||
|
TopicConfigurations |
Array |
Optional |
Configuration list of the Simple Notification Service (SMS) |
|||
|
ID |
String |
Optional |
Configuration ID of the SMS |
|||
|
Topic |
String |
Mandatory |
URN of the event notification topic. After detecting a specific event in a bucket, OBS sends a message to the topic. |
|||
|
Event |
Array |
Mandatory |
Type of events that need to be notified |
|||
|
Filter |
Object |
Optional |
Filtering rule information |
|||
|
FilterRules |
Array |
Optional |
List of filtering rules |
|||
|
Name |
String |
Optional |
Prefix or suffix of object names for filtering. Possible values are:
|
|||
|
Value |
String |
Optional |
Keyword of object name for filtering objects by prefix or suffix |
|||
|
FunctionGraphConfigurations |
Array |
Optional |
FunctionGraph configuration list |
|||
|
ID |
String |
Optional |
FunctionGraph configuration ID |
|||
|
FunctionGraph |
String |
Mandatory |
URN of FunctionGraph. When OBS detects a specific event in the bucket, it sends a message to FunctionGraph and calls FunctionGraph. |
|||
|
Event |
Array |
Mandatory |
List of event types that need to send messages to FunctionGraph. |
|||
|
Filter |
Object |
Optional |
Filtering rule information |
|||
|
FilterRules |
Array |
Optional |
List of filtering rules |
|||
|
Name |
String |
Optional |
Prefix or suffix of object names for filtering. Possible values are:
|
|||
|
Value |
String |
Optional |
Keyword of object name for filtering objects by prefix or suffix |
|||
Returned Result (InterfaceResult)
|
Field |
Type |
Description |
|---|---|---|
|
RequestId |
String |
Request ID returned by the OBS server |
Sample Code
obsClient.setBucketNotification({
Bucket : 'bucketname',
TopicConfigurations : [
{
ID : '001',
Topic : 'your topic',
Event : [obsClient.enums.EventObjectCreatedAll],
Filter : {
FilterRules :[{Name : 'prefix', Value: 'smn'}, {Name : 'suffix', Value: '.jpg'}]
}
}
]
},(err, result) => {
if(err){
console.error('Error-->' + err);
}else{
if(result.CommonMsg.Status < 300){
console.log('RequestId-->' + result.InterfaceResult.RequestId);
}else{
console.log('Code-->' + result.CommonMsg.Code);
console.log('Message-->' + result.CommonMsg.Message);
}
}
});
Last Article: DELETE Bucket cors
Next Article: GET Bucket notification
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.