Adds a mirror source to a traffic mirror session.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates a sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes AddSourcesToTrafficMirrorSession

The operation that you want to perform. Set the value to AddSourcesToTrafficMirrorSession.

RegionId String Yes cn-hongkong

The ID of the region to which the traffic mirror session belongs. You can call the DescribeRegions operation to query the most recent region list. For more information about regions that support traffic mirroring, see Overview of traffic mirroring.

TrafficMirrorSessionId String Yes tms-j6cla50buc44ap8tu****

The ID of the traffic mirror session.

TrafficMirrorSourceIds.N RepeatList Yes eni-j6ccmrl8z3xkvxgw****

The ID of the mirror source. You can specify only an elastic network interface (ENI) as the mirror source. The default value of N is 1, which indicates that you can add only one mirror source to a traffic mirror session.

ClientToken String No 0c593ea1-3bea-11e9-b96b-88e9fe63****

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. ClientToken supports only ASCII characters. It can contain up to 64 ASCII characters.

DryRun Boolean No false

Specifies whether to precheck this request. Valid values:

  • true: only checks the API request. The mirror source is not added. The system checks the required parameters, request format, and limits. If the request fails the precheck, the corresponding error code is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: sends the request. After the request passes the precheck, the mirror source is added.

Response parameters

Parameter Type Example Description
RequestId String 87F70089-5B38-41A8-BAD8-0B55E2F8DC57

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AddSourcesToTrafficMirrorSession
&RegionId=cn-hongkong
&TrafficMirrorSessionId=tms-j6cla50buc44ap8tu****
&TrafficMirrorSourceIds.1=eni-j6ccmrl8z3xkvxgw****
&<Common request parameters>

Sample success responses

XML format

<AddSourcesToTrafficMirrorSessionResponse>
  <RequestId>87F70089-5B38-41A8-BAD8-0B55E2F8DC57</RequestId>
</AddSourcesToTrafficMirrorSessionResponse>

JSON format

{
    "RequestId": "87F70089-5B38-41A8-BAD8-0B55E2F8DC57"
}

Error codes

HttpCode Error code Error message Description
400 IncorrectBusinessStatus.TrafficMirror The business status of traffic mirror is incorrect. The error message returned because the mirrored traffic is in an invalid state.
400 OptInRequired.TrafficMirror You need to subscribe to the traffic mirror service first. The error message returned because traffic mirroring is not enabled.
400 DuplicatedParam.SourceInstanceIds The parameter of source instance IDs contains duplicate values. The error message returned because the specified mirror source ID has duplicate values.
400 ResourceNotFound.TrafficMirrorSession The specified resource of traffic mirror session is not found. The error message returned because the specified traffic mirror session does not exist.
400 IncorrectStatus.TrafficMirrorSession The status of traffic mirror session is incorrect. The error message returned because the traffic mirror session is in an invalid state.
400 ResourceAlreadyAssociated.TrafficMirrorSource The specified traffic mirror source and session are already associated. The error message returned because the specified mirror source is already associated with a traffic mirror session.
400 ResourceNotFound.NetworkInterface The specified resource of network interface is not found. The error message returned because the specified elastic network interface (ENI) does not exist.
400 ResourceNotFound.EcsInstance The specified resource of ECS instance is not found. The error message returned because the specified Elastic Compute Service (ECS) instance does not exist.
400 OperationDenied.EcsNotSupportTrafficMirror The ECS instance does not support traffic mirroring. The error message returned because the ECS instance does not support traffic mirroring.
400 OperationDenied.DuplicateRole The network interface must not be the source and the target of traffic mirror sessions at the same time. The error message returned because an ENI cannot be specified as both the source and destination of a traffic mirror session.
400 QuotaExceeded.NetworkInterfaceRelatedSession The quota of the number of traffic mirror sessions related to one network interface is exceeded. The error message returned because the number of traffic mirror sessions associated with an ENI has reached the upper limit.
400 OperationDenied.FreeNetworkInterface The network interface is not attached to any ECS instance. The error message returned because the specified ENI is not associated with an ECS instance.
400 QuotaExceeded.SourceNumPerSession The quota of the number of traffic mirror sources per session is exceeded. The error message returned because the number of mirror sources associated with a traffic mirror session has reached the upper limit.

For a list of error codes, visit the API Error Center.