All Products
Search
Document Center

EventBridge:CreateEventSource

Last Updated:Nov 01, 2024

Creates an event source.

Operation description

You can call this operation to create an event source.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
eventbridge:CreateEventSourcecreate
  • EventSource
    acs:eventbridge:{#regionId}:{#accountId}:eventbus/{#EventBusName}/eventsource/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
EventSourceNamestringYes

The name of the event source.

myrabbitmq.sourc
DescriptionstringNo

The description of the event source.

LinkedExternalSourcebooleanNo

Specifies whether to connect to an external data source.

ExternalSourceTypebyteNo

The type of the external data source.

ExternalSourceConfigobjectNo

The configurations of the external data source.

EventBusNamestringYes

The name of the event bus with which the event source is associated.

my-event-bus
SourceMNSParametersobjectNo

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.

RegionIdstringNo

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
QueueNamestringNo

The name of the MNS queue.

MyQueue
IsBase64DecodestringNo

Specifies whether to enable Base64 decoding. Valid values: true and false.

true
SourceRocketMQParametersobjectNo

The parameters that are configured if the event source is Message Queue for Apache RocketMQ.

RegionIdstringNo

The region where the Message Queue for Apache RocketMQ instance resides.

cn-hangzhou
InstanceIdstringNo

The ID of the Message Queue for Apache RocketMQ instance. For more information, see Limits .

MQ_INST_164901546557****_BAAN****
TopicstringNo

The name of the topic on the Message Queue for Apache RocketMQ instance. For more information, see Limits .

mytopic
TagstringNo

The tag that is used to filter messages.

test
OffsetstringNo

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
TimestampfloatNo

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
GroupIDstringNo

The ID of the consumer group on the Message Queue for Apache RocketMQ instance.

GID-test
InstanceTypestringNo

The type of the Message Queue for Apache RocketMQ instance. Valid values:

  • Cloud_4: Message Queue for Apache RocketMQ 4.0 instance.
  • Cloud_5: Message Queue for Apache RocketMQ 5.0 instance.
Cloud_4
InstanceNetworkstringNo

None.

None
InstanceVpcIdstringNo

The ID of the virtual private cloud (VPC) in which the Message Queue for Apache RocketMQ instance resides.

vpc-bp1a4gmlk31hyg6ptl3ss
InstanceVSwitchIdsstringNo

The ID of the vSwitch with which the Message Queue for Apache RocketMQ instance is associated.

vsw-bp10rbrt6rb6vrd89****
InstanceSecurityGroupIdstringNo

The ID of the security group to which the Message Queue for Apache RocketMQ instance belongs.

sg-catalog-eventlistener
AuthTypestringNo

The authentication type. You can set this parameter to ACL or leave this parameter empty.

ACL
InstanceEndpointstringNo

The endpoint that is used to access the Message Queue for Apache RocketMQ instance.

registry-vpc****.aliyuncs.com
InstanceUsernamestringNo

The username that is used to access the Message Queue for Apache RocketMQ instance.

root
InstancePasswordstringNo

The password that is used to access the Message Queue for Apache RocketMQ instance.

******
SourceRabbitMQParametersobjectNo

The parameters that are configured if the event source is Message Queue for RabbitMQ.

RegionIdstringNo

The ID of the region where the Message Queue for RabbitMQ instance resides.

cn-hangzhou
InstanceIdstringNo

The ID of the Message Queue for RabbitMQ instance. For more information, see Limits.

amqp-cn-nif22u74****
VirtualHostNamestringNo

The name of the vhost of the Message Queue for RabbitMQ instance. For more information, see Limits .

eb-connect
QueueNamestringNo

The name of the queue on the Message Queue for RabbitMQ instance. For more information, see Limits .

demo
SourceSLSParametersobjectNo

The parameters that are configured if the event source is Log Service.

ProjectstringNo

The Log Service project.

test-project
LogStorestringNo

The Log Service Logstore.

test-logstore
ConsumePositionstringNo

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
RoleNamestringNo

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
SourceHttpEventParametersobjectNo

The parameters that are configured if the event source is HTTP events.

TypestringNo

The protocol type that is supported by the generated webhook URL. Valid values:

  • HTTP
  • HTTPS
  • HTTP&HTTPS
HTTPS
MethodarrayNo

The HTTP request method supported by the generated webhook URL. You can select multiple values. Valid values:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • HEAD
  • OPTIONS
  • TRACE
  • CONNECT
stringNo

The HTTP request method supported by the generated webhook URL. You can select multiple values. Valid values:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE
  • HEAD
  • OPTIONS
  • TRACE
  • CONNECT
GET
SecurityConfigstringNo

The type of security settings. Valid values:

  • none: No configuration is required.
  • ip: CIDR block.
  • referer: security domain name.
none
IparrayNo

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.

stringNo

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
RefererarrayNo

The security domain name. This parameter is required only if you set SecurityConfig to referer. You can enter a domain name.

stringNo

The security domain name. This parameter is required only if you set SecurityConfig to referer. You can enter a domain name.

aliyundoc.com
SourceScheduledEventParametersobjectNo

The parameters that are configured if you specify scheduled events as the event source.

SchedulestringNo

The cron expression.

10 * * * * *
TimeZonestringNo

The time zone in which the cron expression is executed.

GMT+0:00
SourceKafkaParametersobjectNo

The parameters that are configured if the event source is Message Queue for Apache Kafka.

InstanceIdstringNo

The ID of the Message Queue for Apache Kafka instance.

pc-2zehmg67txzuyuuwlxv4f
ConsumerGroupstringNo

The ID of the consumer group that subscribes to the topic.

wechat_peer_prod
TopicstringNo

The name of the topic on the Message Queue for Apache Kafka instance.

prod_ma_dispatch_center_call_record
OffsetResetstringNo

The consumer offset.

latest
RegionIdstringNo

The ID of the region where the Message Queue for Apache Kafka instance resides.

cn-hangzhou
MaximumTasksintegerNo

The maximum number of consumers.

1
NetworkstringNo

The network. Valid values: Default and PublicNetwork. Default value: Default. The value PublicNetwork indicates a self-managed network.

Default
SecurityGroupIdstringNo

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
VSwitchIdsstringNo

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
VpcIdstringNo

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

ParameterTypeDescriptionExample
object
Messagestring

The returned error 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]
RequestIdstring

The request ID.

2922208e-e1c6-43ee-bfd1-aca50263bc8a
Dataobject

The returned data.

EventSourceARNstring

The Alibaba Cloud Resource Name (ARN) of the resource.

acs:eventbridge:cn-hangzhou:164901546557****:eventbus/my-event-bus/eventsource/mymns.source
Codestring

The returned response code. Valid values:

  • Success: The request is successful.
  • Other codes: The request failed. For more information about error codes, see Error codes.
Success
Successboolean

Indicates whether the operation is successful. The value true indicates that the operation is successful.

true

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError message
403ServiceNotEnableService not enable

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-19The Error code has changedView Change Details
2023-08-01The Error code has changedView Change Details
2023-08-01The Error code has changedView Change Details
2023-04-21The Error code has changed. The request parameters of the API has changedView Change Details
2023-04-06The Error code has changedView Change Details