Skip to content
大纲

事件通知

put_notification

本接口用于指定bucket上增加通知规则。

注意:

  • 只有bucket owner或者full control权限才能获取这个bucket的配置。
  • 如果不是bucket owner则返回403,如果对应的文件不存在则返回404。

相关参数的详细解释请参见PutNotification接口

python
notifications = list()
notifications.append(
    {
        "resources": ["/"],
        "encryption": {"key": "06a62b70f47dc4a0a7da349609f1a1ac"},
        "status": "enabled",
        "name": "name3",
        "id": "r3",
        "appId": "p3",
        "events": [
            "AppendObject",
            "CompleteMultipartUpload",
            "CopyObject",
            "PutObject",
            "PostObject",
            "FetchObject",
            "DeleteObject"
        ],
        "apps": [
            {
                "eventUrl": "http://www.liujiang.com",
                "id": "ImageCensor",
                "xVars": "{\"saveUrl\": \"http://xxx.com/ocr\"}"
            }
        ]
    }
)
response = fos_client.put_notification(bucket_name, notifications)

get_notification

本接口用于获取指定bucket上的通知规则。

python
response = fos_client.get_notification(bucket_name)

delete_notification

本接口用于删除指定bucket上的通知规则。

注意: 该接口为一次性全部删除当前bucket下全部规则

python
response = fos_client.delete_notification(bucket_name)