Creating a Custom Event Channel
Function
This API is used to create a custom event channel.
URI
POST /v1/{project_id}/channels
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant resource space ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enterprise_project_id |
No |
String |
ID of an enterprise project used for creating a channel. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Name of the event channel. The value must be unique under a tenant. Only letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. It must start with a letter or digit and cannot be default. |
description |
No |
String |
Description of the event channel. |
enterprise_project_id |
No |
String |
Enterprise project ID. |
cross_account |
No |
Boolean |
Indicates whether cross-account feature is enabled. |
policy |
No |
Object |
Policy. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
X-Request-Id |
String |
This field is the request ID number for task tracking. Format is request_uuid-timestamp-hostname. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
ID of the event channel. |
name |
String |
Name of the event channel. |
description |
String |
Description of the event channel. |
provider_type |
String |
Event channel provider type, which can be OFFICIAL (official event channel), CUSTOM (custom event channel), or PARTNER (partner event channel). |
created_time |
String |
UTC time when the event channel is created. |
updated_time |
String |
UTC time when the event channel is updated. |
enterprise_project_id |
String |
Enterprise project ID. |
Example Requests
Create a custom event channel.
POST https://{endpoint}/v1/{project_id}/channels { "name" : "channel", "description" : "first channel", "enterprise_project_id" : "string", "cross_account" : true, "policy" : { "additionalProp1" : { "Sid" : "allow_account_to_put_events", "Effect" : "Allow", "Principal" : { "additionalProp1" : { "IAM" : [ "domainID" ] }, "additionalProp2" : { "IAM" : [ "domainID" ] }, "additionalProp3" : { "IAM" : [ "domainID" ] } }, "Action" : "eg:channels:putEvents", "Resource" : "urn:eg:cn-east-2:07d52e5245000fef0f08c008b20dc5c0:channel:testChannel" }, "additionalProp2" : { "Sid" : "allow_account_to_put_events", "Effect" : "Allow", "Principal" : { "additionalProp1" : { "IAM" : [ "domainID" ] }, "additionalProp2" : { "IAM" : [ "domainID" ] }, "additionalProp3" : { "IAM" : [ "domainID" ] } }, "Action" : "eg:channels:putEvents", "Resource" : "urn:eg:cn-east-2:07d52e5245000fef0f08c008b20dc5c0:channel:testChannel" }, "additionalProp3" : { "Sid" : "allow_account_to_put_events", "Effect" : "Allow", "Principal" : { "additionalProp1" : { "IAM" : [ "domainID" ] }, "additionalProp2" : { "IAM" : [ "domainID" ] }, "additionalProp3" : { "IAM" : [ "domainID" ] } }, "Action" : "eg:channels:putEvents", "Resource" : "urn:eg:cn-east-2:07d52e5245000fef0f08c008b20dc5c0:channel:testChannel" } } }
Example Responses
Status code: 200
Demo Information
{ "id" : "bd14144e-8f3c-43d6-bdfd-bf09b52c2b96", "name" : "channel", "description" : "first channel", "provider_type" : "CUSTOM", "created_time" : "2021-12-09 09:00:00", "updated_time" : "2021-12-09 09:00:00", "enterprise_project_id" : "string" }
Status Codes
Status Code |
Description |
---|---|
200 |
Demo Information |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot