调用CreateTrafficMirrorSession接口创建镜像会话。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | CreateTrafficMirrorSession |
系统规定参数。取值:CreateTrafficMirrorSession。 |
TrafficMirrorSessionDescription | String | 否 | This is a trafficmirrorsession. |
镜像会话的描述信息。描述长度为2~256个字符,不能以 |
TrafficMirrorSessionName | String | 否 | test |
镜像会话的名称。名称长度为2~128个字符,以英文大小写字母或中文开头,可包含数字、下划线(_)和短划线(-)。 |
ClientToken | String | 否 | 0c593ea1-3bea-11e9-b96b-88e9fe63**** |
客户端Token,用于保证请求的幂等性。 由客户端生成该参数值,要保证在不同请求间唯一,最大值不超过64个ASCII字符。 说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId可能不一样。
|
DryRun | Boolean | 否 | false |
是否只预检此次请求,取值:
|
TrafficMirrorTargetId | String | 是 | eni-j6c8znm5l1yt4sox**** |
镜像目的的实例ID,目前支持弹性网卡和私网负载均衡实例作为镜像目的。 |
TrafficMirrorTargetType | String | 是 | NetworkInterface |
镜像目的类型,取值:
|
TrafficMirrorFilterId | String | 是 | tmf-j6cmls82xnc86vtpe**** |
流量镜像筛选条件的实例ID。 |
VirtualNetworkId | Integer | 否 | 1 |
指定VNI(VXLAN Network Identifier),用来区分不同的镜像流量,取值范围为0~16777215。 您可以通过VNI在镜像目的区分不同会话的镜像流量。您可以自定义VNI的值,也可以由系统随机分配该值。如果由系统随机分配该值,请不传该参数。 |
Priority | Integer | 是 | 1 |
镜像会话的优先级,取值范围为1~32766。 数字越小,优先级越高。同一账号在同一个地域创建的镜像会话优先级不能重复。 |
Enabled | Boolean | 否 | false |
是否开启流量会话,取值:
|
PacketLength | Integer | 否 | 1500 |
最大传输单元MTU(Maximum Transmission Unit),默认值为1500。 |
RegionId | String | 是 | cn-hongkong |
镜像会话的所属地域ID。您可以通过调用DescribeRegions接口获取地域ID。关于流量镜像支持的地域,请参见流量镜像概述。 |
TrafficMirrorSourceIds.N | String | 是 | eni-j6c2fp57q8rr47rp**** |
镜像源的实例ID,目前支持弹性网卡作为镜像源。其中N的默认值为1,即一个镜像会话只支持添加一个镜像源。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
TrafficMirrorSessionId | String | tms-j6ce5di4w7nvigfjz**** |
镜像会话的实例ID。 |
RequestId | String | 0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
请求ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=CreateTrafficMirrorSession
&TrafficMirrorSessionDescription=This is a trafficmirrorsession.
&TrafficMirrorSessionName=test
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe63****
&DryRun=false
&TrafficMirrorTargetId=eni-j6c8znm5l1yt4sox****
&TrafficMirrorTargetType=NetworkInterface
&TrafficMirrorFilterId=tmf-j6cmls82xnc86vtpe****
&VirtualNetworkId=1
&Priority=1
&Enabled=false
&PacketLength=1500
&TrafficMirrorSourceIds=["eni-j6c2fp57q8rr47rp****"]
&RegionId=cn-hongkong
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateTrafficMirrorSessionResponse>
<TrafficMirrorSessionId>tms-j6ce5di4w7nvigfjz****</TrafficMirrorSessionId>
<RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</CreateTrafficMirrorSessionResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"TrafficMirrorSessionId" : "tms-j6ce5di4w7nvigfjz****",
"RequestId" : "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}
错误码
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 | OperationDenied.DuplicateRole | The network interface must not be the source and the target of traffic mirror sessions at the same time. | 网卡不能同时作为流量镜像会话的源和目的。 |
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 | ResourceNotFound.Slb | The specified resource of SLB is not found. | 指定的SLB不存在。 |
400 | OperationDenied.SlbNotInVpc | The specified SLB is not in any VPC. | 指定的SLB不属于任何一个VPC。 |
400 | ResourceNotFound.TrafficMirrorFilter | The specified resource of traffic mirror filter is not found. | 指定的流量镜像筛选条件不存在。 |
400 | IncorrectStatus.TrafficMirrorFilter | The status of traffic mirror filter is incorrect. | 流量镜像筛选条件的状态不正确。 |
400 | OperationDenied.EcsNotSupportTrafficMirror | The ECS instance does not support traffic mirroring. | ECS实例不支持流量镜像功能。 |
400 | QuotaExceeded.SessionNum | The quota of the number of traffic mirror sessions is exceeded. | 流量镜像会话数量超限。 |
400 | QuotaExceeded.FilterRelatedSession | The quota of the number of traffic mirror sessions related to one filter is exceeded. | 流量镜像筛选条件所关联的镜像会话数量配额超限。 |
400 | QuotaExceeded.SourceNumPerSession | The quota of the number of traffic mirror sources per session is exceeded. | 每个流量镜像会话所允许关联的源的数量配额超限。 |
400 | QuotaExceeded.NetworkInterfaceRelatedSession | The quota of the number of traffic mirror sessions related to one network interface is exceeded. | 单个网卡所能关联的流量镜像会话数量配额超限。 |
400 | QuotaExceeded.SlbRelatedSession | The quota of the number of traffic mirror sessions related to one SLB is exceeded. | 单个SLB所能关联的流量镜像会话数量配额超限。 |
400 | UnsupportedRegion | The feature is not supported in current region. | 当前地域不支持该功能。 |
400 | InvalidLoadBalancerId.NotFound | The specified resource of load balancer is not found. | 指定的SLB实例不存在。 |
400 | OperationDenied.FreeNetworkInterface | The network interface is not attached to any ECS instance. | 指定的网卡未绑定任何ECS实例。 |
访问错误中心查看更多错误码。