All Products
Search
Document Center

:AddSourcesToTrafficMirrorSession

最終更新日:Aug 25, 2023

Adds a traffic mirror source to a traffic mirror session.

Usage notes

  • AddSourcesToTrafficMirrorSession is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the ListTrafficMirrorSessions operation to query the status of the task:
    • If the traffic mirror session is in the Modifying state, the traffic mirror source is being added to the traffic mirror session.
    • If the traffic mirror session is in the Created state, the traffic mirror source is added to the traffic mirror session.
  • You cannot repeatedly call the AddSourcesToTrafficMirrorSession operation within the specified period of time.

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 the 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.

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 token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each request.
DryRun Boolean No false

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
TrafficMirrorSessionId String Yes tms-j6cla50buc44ap8tu****

The ID of the traffic mirror session.

TrafficMirrorSourceIds.N String No eni-j6c8znm5l1yt4sox****

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

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.

Response parameters

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

The request ID.

Examples

Sample requests

http(s)://[Endpoint]/?Action=AddSourcesToTrafficMirrorSession
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe63****
&DryRun=false
&TrafficMirrorSessionId=tms-j6cla50buc44ap8tu****
&TrafficMirrorSourceIds=["eni-j6c8znm5l1yt4sox****"]
&RegionId=cn-hongkong
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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. Traffic mirroring is in an invalid state.
400 OptInRequired.TrafficMirror You need to subscribe to the traffic mirror service first. Traffic mirroring is disabled.
400 DuplicatedParam.SourceInstanceIds The parameter of source instance IDs contains duplicate values. Duplicate values are set for TrafficMirrorSourceIds.N.
400 ResourceNotFound.TrafficMirrorSession The specified resource of traffic mirror session is not found. The specified traffic mirror session does not exist.
400 IncorrectStatus.TrafficMirrorSession The status of traffic mirror session is incorrect. The traffic mirror session is in an invalid state.
400 ResourceAlreadyAssociated.TrafficMirrorSource The specified traffic mirror source and session are already associated. The specified traffic mirror source is already associated with a traffic mirror session.
400 ResourceNotFound.NetworkInterface The specified resource of %s is not found. The specified NetworkInterface %s does not exist.
400 ResourceNotFound.EcsInstance The specified resource of ECS instance is not found. The specified Elastic Compute Service (ECS) instance does not exist.
400 OperationDenied.EcsNotSupportTrafficMirror The ECS instance does not support traffic mirroring. 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. 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 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 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 number of traffic mirror sources associated with a traffic mirror session has reached the upper limit.
400 QuotaExceeded.SourceNumPerTarget The maximum number of traffic mirror sources for a target is exceeded. The number of traffic mirror sources associated with the traffic mirror destination exceeds the upper limit.

For a list of error codes, see Service error codes.