调用 CreateSubscription 接口,订阅系统事件通知。
同一Type
(订阅类型)仅支持使用本接口订阅一次事件通知。如需调整该Type
订阅的EventTypes.N
(事件类型),请调用ModifySubscriptionEventTypes接口,传入本接口返回的SubscriptionId
(订阅ID)完成操作。
下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。
参数 | 类型 | 是否必填 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | CreateSubscription | 要执行的操作,取值:CreateSubscription。 |
Version | String | 是 | 2020-04-01 | API的版本,取值:2020-04-01。 |
EventTypes.N | Array of String | 是 | EventTypes.1=SystemFailure.Stop:Succeeded&EventTypes.2=SystemFailure.Stop:Succeeded | 事件类型,最多支持100个。
|
Type | String | 是 | Notification | 订阅类型,取值:
|
下表仅列出本接口特有的返回参数。更多信息请参见返回结构。
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
SubscriptionId | String | s-4shu38sa4mjx****** | 订阅ID。 |
GET /?Action=CreateSubscription&Version=2020-04-01&EventTypes.1=SystemFailure.Stop:Succeeded&EventTypes.2=SystemFailure.Stop:Succeeded&Type=Notification HTTP/1.1 Host: open.volcengineapi.com Region: cn-beijing ServiceName: ecs
{ "ResponseMetadata": { "RequestId": "20210611144510010225243100005******", "Action": "CreateSubscription", "Version": "2020-04-01", "Service": "ecs", "Region": "cn-beijing" }, "Result": { "SubscriptionId": "s-4shu38sa4mjx******" } }
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。
状态码 | 错误码 | 错误信息 | 说明 |
---|---|---|---|
400 | InvalidArgument | The specified argument is invalid. | 指定的参数不合法。 |
400 | InvalidEventTypes.Malformed | The specified EventTypes is malformed. | 指定的EventTypes不合法。 |
400 | InvalidType.Malformed | The specified Type is malformed. | 指定的Type不合法。 |
400 | LimitExceeded.MaximumEventTypes | The number of specified EventTypes exceeds the maximum limit. | 指定的EventTypes超过最大限制。 |
400 | LimitExceeded.MaximumSubscriptions | You've reached the limit on the number of subscriptions that you can create. | 订阅数量超过最大限制,同类型订阅仅允许创建一个。 |
400 | MissingParameter.EventTypes | The required parameter EventTypes is not supplied. | 参数EventTypes不能为空。 |
400 | MissingParameter.Type | The required parameter Type is not supplied. | 参数Type不能为空。 |
500 | InternalError | An internal error has occurred. | 内部错误,请重试。如果多次尝试失败,请提交工单。 |