帮助与文档

我们为你提供丰富、详尽的使用指南以及产品文档

GET Bucket Notification

获取存储空间的事件通知策略。

设置 Bucket Notification 请参见 PUT Bucket Notification

删除 Bucket Notification 请参见 DELETE Bucket Notification

Request Syntax

GET /?notification HTTP/1.1
Host: <bucket-name>.<zone_id>.qingstor.com
Date: <date>
Authorization: <authorization-string>

Request Parameters

没有请求参数

Request Headers

参见公共请求头

Request Body

没有请求消息体

Status Code

正常会返回 200, 失败的返回码参考错误码列表

Response Headers

参见公共响应头

Response Body

正常情况下会有一个 Json 消息体; 错误情况下会有返回码对应的 Json 消息, 参考错误码列表

Name Type Description Required
notifications Array bucket notification 的配置规则,配置项中的元素解释见下 Yes
id String 通知配置的标识 Yes
event_types Array 事件的类型,每当该类型的事件被触发时,发出通知。
目前支持的类型为:
- “create_object”: 创建对象完成
- “delete_object”: 删除对象完成
- “abort_multipart”: 终止分段上传
- “complete_multipart”: 完成分段上传
Yes
object_filter String 对象名匹配规则(glob patterns) Yes
cloudfunc String 事件处理云服务,接收通知中触发的事件并进行处理。目前支持:
- tupu-porn: 图谱鉴黄服务
- notifier: 通知服务, 将 QingStor 事件推送到 notify_url
Yes
cloudfunc_args Object 提供给 cloudfunc 的自定义参数 No
notify_url String 通知事件处理结果的 url ,当事件处理完成后,会将处理结果以 POST 方式向 notify_url 请求。如果 POST 超时,将会重试,超时时间是 5s, 重试间隔为 1s。 No

Example

Example Request

GET /?notification HTTP/1.1
Host: mybucket.pek3a.qingstor.com
Date: Sun, 16 Aug 2015 09:05:00 GMT
Authorization: authorization string

Example Response

HTTP/1.1 200 OK
Server: QingStor
Date: Sun, 16 Aug 2015 09:05:00 GMT
Content-Length: 125
Connection: close
x-qs-request-id: aa08cf7a43f611e5886952542e6ce14b

{
    "notifications": [
        {
            "cloudfunc": "tupu-porn",
            "event_types": [
                "create_object"
            ],
            "id": "notificaion-1",
            "notify_url": "http://tupu_porn_notify_url"
        },
        {
            "cloudfunc": "video-trans",
            "event_types": [
                "create_object",
                "complete_multipart"
            ],
            "id": "notificaion-2",
            "notify_url": "http://transcode_notify_url"
        }
    ]
}