调用AddSourcesToTrafficMirrorSession接口为镜像会话增加镜像源。
使用说明
- AddSourcesToTrafficMirrorSession接口属于异步接口,即系统返回一个请求ID,但该镜像源尚未增加成功,系统后台的增加任务仍在进行。您可以调用ListTrafficMirrorSessions查询镜像源的增加状态:
- 当镜像会话处于Modifying状态时,表示镜像源正在增加中。
- 当镜像会话处于Created状态时,表示镜像源增加成功。
- AddSourcesToTrafficMirrorSession接口不支持并发为同一个镜像会话增加镜像源。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | AddSourcesToTrafficMirrorSession | 系统规定参数。取值:AddSourcesToTrafficMirrorSession。 |
ClientToken | String | 否 | 0c593ea1-3bea-11e9-b96b-88e9fe63**** | 客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId可能不一样。 |
DryRun | Boolean | 否 | false | 是否只预检此次请求,取值:
|
TrafficMirrorSessionId | String | 是 | tms-j6cla50buc44ap8tu**** | 需要增加镜像源的镜像会话实例ID。 |
TrafficMirrorSourceIds.N | String | 否 | eni-j6c8znm5l1yt4sox**** | 需要增加的镜像源的实例ID,目前支持弹性网卡作为镜像源。其中N的默认值为1,即一个镜像会话只支持添加一个镜像源。 |
RegionId | String | 是 | cn-hongkong | 镜像会话的所属地域ID。 您可以通过调用DescribeRegions接口获取地域ID。 关于流量镜像支持的地域,请参见流量镜像概述。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 87F70089-5B38-41A8-BAD8-0B55E2F8DC57 | 请求ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=AddSourcesToTrafficMirrorSession
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe63****
&DryRun=false
&TrafficMirrorSessionId=tms-j6cla50buc44ap8tu****
&TrafficMirrorSourceIds=["eni-j6c8znm5l1yt4sox****"]
&RegionId=cn-hongkong
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<AddSourcesToTrafficMirrorSessionResponse>
<RequestId>87F70089-5B38-41A8-BAD8-0B55E2F8DC57</RequestId>
</AddSourcesToTrafficMirrorSessionResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "87F70089-5B38-41A8-BAD8-0B55E2F8DC57"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | IncorrectBusinessStatus.TrafficMirror | The business status of traffic mirror is incorrect. | 流量镜像的商业状态不正确。 |
400 | OptInRequired.TrafficMirror | You need to subscribe to the traffic mirror service first. | 未开通流量镜像服务。 |
400 | DuplicatedParam.SourceInstanceIds | The parameter of source instance IDs contains duplicate values. | 流量镜像源实例ID参数中包含重复值。 |
400 | ResourceNotFound.TrafficMirrorSession | The specified resource of traffic mirror session is not found. | 指定的流量镜像会话不存在。 |
400 | IncorrectStatus.TrafficMirrorSession | The status of traffic mirror session is incorrect. | 流量镜像会话状态不正确。 |
400 | ResourceAlreadyAssociated.TrafficMirrorSource | The specified traffic mirror source and session are already associated. | 指定的流量镜像源和会话已经绑定。 |
400 | ResourceNotFound.NetworkInterface | The specified resource of network interface is not found. | 指定的网卡不存在。 |
400 | ResourceNotFound.EcsInstance | The specified resource of ECS instance is not found. | 指定的ECS实例不存在。 |
400 | OperationDenied.EcsNotSupportTrafficMirror | The ECS instance does not support traffic mirroring. | ECS实例不支持流量镜像功能。 |
400 | OperationDenied.DuplicateRole | The network interface must not be the source and the target of traffic mirror sessions at the same time. | 网卡不能同时作为流量镜像会话的源和目的。 |
400 | QuotaExceeded.NetworkInterfaceRelatedSession | The quota of the number of traffic mirror sessions related to one network interface is exceeded. | 单个网卡所能关联的流量镜像会话数量配额超限。 |
400 | OperationDenied.FreeNetworkInterface | The network interface is not attached to any ECS instance. | 指定的网卡未绑定任何ECS实例。 |
400 | QuotaExceeded.SourceNumPerSession | The quota of the number of traffic mirror sources per session is exceeded. | 每个流量镜像会话所允许关联的源的数量配额超限。 |
访问错误中心查看更多错误码。