Creates an event source.
Operation description
You can call this operation to create an event source.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
eventbridge:CreateEventSource | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
EventSourceName | string | Yes | The name of the event source. | myrabbitmq.sourc |
Description | string | No | The description of the event source. | |
LinkedExternalSource | boolean | No | Specifies whether to connect to an external data source. | |
ExternalSourceType | byte | No | The type of the external data source. | |
ExternalSourceConfig | object | No | The configurations of the external data source. | |
EventBusName | string | Yes | The name of the event bus with which the event source is associated. | my-event-bus |
SourceMNSParameters | object | No | The parameters that are configured if the event source is Message Service (MNS). If you specify MNS as the event source, you must configure RegionId, IsBase64Decode, and QueueName. | |
RegionId | string | No | The region where the MNS queue resides. Valid values: cn-qingdao, cn-beijing, cn-zhangjiakou, cn-huhehaote, cn-wulanchabu, cn-hangzhou, cn-shanghai, cn-shenzhen, cn-guangzhou, cn-chengdu, cn-hongkong, ap-southeast-1, ap-southeast-2, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1, us-west-1, us-east-1, ap-south-1, me-east-1, and cn-north-2-gov-1. | cn-hangzhou |
QueueName | string | No | The name of the MNS queue. | MyQueue |
IsBase64Decode | string | No | Specifies whether to enable Base64 decoding. Valid values: true and false. | true |
SourceRocketMQParameters | object | No | The parameters that are configured if the event source is Message Queue for Apache RocketMQ. | |
RegionId | string | No | The region where the Message Queue for Apache RocketMQ instance resides. | cn-hangzhou |
InstanceId | string | No | The ID of the Message Queue for Apache RocketMQ instance. For more information, see Limits . | MQ_INST_164901546557****_BAAN**** |
Topic | string | No | The name of the topic on the Message Queue for Apache RocketMQ instance. For more information, see Limits . | mytopic |
Tag | string | No | The tag that is used to filter messages. | test |
Offset | string | No | The offset from which message consumption starts. Valid values: CONSUME_FROM_LAST_OFFSET: Start message consumption from the latest offset. CONSUME_FROM_FIRST_OFFSET: Start message consumption from the earliest offset. CONSUME_FROM_TIMESTAMP: Start message consumption from the offset at the specified point in time. Default value: CONSUME_FROM_LAST_OFFSET. | CONSUME_FROM_LAST_OFFSET |
Timestamp | float | No | The timestamp that specifies the time from which messages are consumed. This parameter is valid only if you set Offset to CONSUME_FROM_TIMESTAMP. | 1636597951964 |
GroupID | string | No | The ID of the consumer group on the Message Queue for Apache RocketMQ instance. | GID-test |
InstanceType | string | No | The type of the Message Queue for Apache RocketMQ instance. Valid values:
| Cloud_4 |
InstanceNetwork | string | No | None. | None |
InstanceVpcId | string | No | The ID of the virtual private cloud (VPC) in which the Message Queue for Apache RocketMQ instance resides. | vpc-bp1a4gmlk31hyg6ptl3ss |
InstanceVSwitchIds | string | No | The ID of the vSwitch with which the Message Queue for Apache RocketMQ instance is associated. | vsw-bp10rbrt6rb6vrd89**** |
InstanceSecurityGroupId | string | No | The ID of the security group to which the Message Queue for Apache RocketMQ instance belongs. | sg-catalog-eventlistener |
AuthType | string | No | The authentication type. You can set this parameter to ACL or leave this parameter empty. | ACL |
InstanceEndpoint | string | No | The endpoint that is used to access the Message Queue for Apache RocketMQ instance. | registry-vpc****.aliyuncs.com |
InstanceUsername | string | No | The username that is used to access the Message Queue for Apache RocketMQ instance. | root |
InstancePassword | string | No | The password that is used to access the Message Queue for Apache RocketMQ instance. | ****** |
SourceRabbitMQParameters | object | No | The parameters that are configured if the event source is Message Queue for RabbitMQ. | |
RegionId | string | No | The ID of the region where the Message Queue for RabbitMQ instance resides. | cn-hangzhou |
InstanceId | string | No | The ID of the Message Queue for RabbitMQ instance. For more information, see Limits. | amqp-cn-nif22u74**** |
VirtualHostName | string | No | The name of the vhost of the Message Queue for RabbitMQ instance. For more information, see Limits . | eb-connect |
QueueName | string | No | The name of the queue on the Message Queue for RabbitMQ instance. For more information, see Limits . | demo |
SourceSLSParameters | object | No | The parameters that are configured if the event source is Log Service. | |
Project | string | No | The Log Service project. | test-project |
LogStore | string | No | The Log Service Logstore. | test-logstore |
ConsumePosition | string | No | The starting consumer offset. The value begin specifies the earliest offset, and the value end specifies the latest offset. You can also specify a time in seconds to start consumption. | end |
RoleName | string | No | The role name. If you want to authorize EventBridge to use this role to read logs in Log Service, you must select Alibaba Cloud Service for Selected Trusted Entity and EventBridge for Select Trusted Service when you create the role in the Resource Access Management (RAM) console. For information about the permission policy of this role, see Create a custom event source of the Log Service type. | testRole |
SourceHttpEventParameters | object | No | The parameters that are configured if the event source is HTTP events. | |
Type | string | No | The protocol type that is supported by the generated webhook URL. Valid values:
| HTTPS |
Method | array | No | The HTTP request method supported by the generated webhook URL. You can select multiple values. Valid values:
| |
string | No | The HTTP request method supported by the generated webhook URL. You can select multiple values. Valid values:
| GET | |
SecurityConfig | string | No | The type of security settings. Valid values:
| none |
Ip | array | No | The CIDR block that is used for security settings. This parameter is required only if you set SecurityConfig to ip. You can enter a CIDR block or an IP address. | |
string | No | The CIDR block that is used for security settings. This parameter is required only if you set SecurityConfig to ip. You can enter a CIDR block or an IP address. | 10.0.0.0/8 | |
Referer | array | No | The security domain name. This parameter is required only if you set SecurityConfig to referer. You can enter a domain name. | |
string | No | The security domain name. This parameter is required only if you set SecurityConfig to referer. You can enter a domain name. | aliyundoc.com | |
SourceScheduledEventParameters | object | No | The parameters that are configured if you specify scheduled events as the event source. | |
Schedule | string | No | The cron expression. | 10 * * * * * |
TimeZone | string | No | The time zone in which the cron expression is executed. | GMT+0:00 |
SourceKafkaParameters | object | No | The parameters that are configured if the event source is Message Queue for Apache Kafka. | |
InstanceId | string | No | The ID of the Message Queue for Apache Kafka instance. | pc-2zehmg67txzuyuuwlxv4f |
ConsumerGroup | string | No | The ID of the consumer group that subscribes to the topic. | wechat_peer_prod |
Topic | string | No | The name of the topic on the Message Queue for Apache Kafka instance. | prod_ma_dispatch_center_call_record |
OffsetReset | string | No | The consumer offset. | latest |
RegionId | string | No | The ID of the region where the Message Queue for Apache Kafka instance resides. | cn-hangzhou |
MaximumTasks | integer | No | The maximum number of consumers. | 1 |
Network | string | No | The network. Valid values: Default and PublicNetwork. Default value: Default. The value PublicNetwork indicates a self-managed network. | Default |
SecurityGroupId | string | No | The ID of the security group to which the Message Queue for Apache Kafka instance belongs. This parameter is required only if you set Network to PublicNetwork. | sg-8vbf66aoyp0wfzrzxlmy |
VSwitchIds | string | No | The ID of the vSwitch with which the Message Queue for Apache Kafka instance is associated. This parameter is required only if you set Network to PublicNetwork. | vsw-bp127azpeirmwu4q9ttqi |
VpcId | string | No | The ID of the VPC in which the Message Queue for Apache Kafka instance resides. This parameter is required only if you set Network to PublicNetwork. | vpc-2ze5ejm986a73qq3vshlk |
Sample requests `POST /openapi/createEventSource HTTP/1.1 Host: 164901546557****.eventbridge.cn-hangzhou.aliyuncs.com Date: Sat, 18 Apr 2020 05:30:41 GMT x-eventbridge-version: 2020-04-01 Authorization: acs vZ3VL0SuJdHi****:Jo2PbT******azYAYoYslKLvWzg= Content-Type: application/json;charset=UTF-8 Content-Length: 26
{ "EventSourceName":"myRabbitMQ.source", "Description":"Event source of the Message Queue for RabbitMQ type", "SourceRabbitMQParameters":{ "RegionId":"cn-hangzhou", "InstanceId":"amqp-cn-nif22u74****", "VirtualHostName":"eb-connect", "QueueName":"demo" }, "EventBusName":"my-event-bus" }`
Response parameters
Examples
Sample success responses
JSON
format
{
"Message": " Remote error. requestId: [A8EFABD2-95B9-1C46-9E01-xxxx], error code: [CreateRelatedResourceFailed], message: [Create related resource failed, EntityNotExist.Role : The role not exists: xxxx. \\r\\nRequestId : xxxx-168C-54ED-8FEB-BF11CB70AEB7] ",
"RequestId": "2922208e-e1c6-43ee-bfd1-aca50263bc8a",
"Data": {
"EventSourceARN": "acs:eventbridge:cn-hangzhou:164901546557****:eventbus/my-event-bus/eventsource/mymns.source"
},
"Code": "Success",
"Success": true
}
Error codes
HTTP status code | Error code | Error message |
---|---|---|
403 | ServiceNotEnable | Service not enable |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-10-19 | The Error code has changed | View Change Details |
2023-08-01 | The Error code has changed | View Change Details |
2023-08-01 | The Error code has changed | View Change Details |
2023-04-21 | The Error code has changed. The request parameters of the API has changed | View Change Details |
2023-04-06 | The Error code has changed | View Change Details |