2011shenlin | f9fb2e9 | 2023-06-10 15:39:06 +0800 | [diff] [blame] | 1 | ## Use HttpSource to put events |
| 2 | |
| 3 | EventBridge HttpSource allows you to put events to eventbus in the form of webhook. |
| 4 | |
| 5 | Here is an example explaining how to put events using EventBridge HttpSource. |
| 6 | |
| 7 | 1. Create an EventBridge HttpSource |
| 8 | |
| 9 | - eventSourceName: Name of EventSource |
| 10 | - eventBusName: Name of EventBus |
| 11 | - description: Description |
| 12 | - className: HttpEvent. This parameter is a fixed value and cannot be modified. |
| 13 | - config: HttpSource Config |
| 14 | - Type: Request type. Available values are 'HTTP', 'HTTPS' and 'HTTP&HTTPS'. |
| 15 | - Method: Allowed HTTP request methods. The request will be filtered if the http request method type for accessing |
| 16 | the webhook does not meet the configuration. |
| 17 | - SecurityConfig: Security configuration type. Available values are 'none', 'ip' and 'referer'. |
| 18 | - Ip: IP security configuration. Http requests whose source ip is not in the configured network segment will be |
| 19 | filtered if the security configuration is selected as 'ip'. |
| 20 | - Referer: Referer security configuration. HTTP requests whose referer is not in this configuration will be filtered |
| 21 | if the security configuration is selected as 'referer'. |
| 22 | |
| 23 | A webhook will be generated after the creation of HttpSource. |
| 24 | |
| 25 | ```text |
| 26 | POST /source/createEventSource HTTP/1.1 |
| 27 | Host: demo.eventbridge.com |
| 28 | Content-Type: application/json; charset=utf-8 |
| 29 | { |
| 30 | "eventSourceName": "httpEventSourceDemo", |
| 31 | "eventBusName": "demo", |
| 32 | "description": "http source demo", |
| 33 | "className": "HttpEvent", |
| 34 | "config": { |
| 35 | "Type": "HTTP&HTTPS", |
| 36 | "Method": ["GET", "POST"], |
| 37 | "SecurityConfig": "ip", |
| 38 | "Ip": ["10.0.0.0/8"], |
| 39 | "Referer":[] |
| 40 | } |
| 41 | } |
| 42 | ``` |