全部產品
Search
文件中心

Virtual Private Cloud:AddSourcesToTrafficMirrorSession

更新時間:Jun 19, 2026

呼叫AddSourcesToTrafficMirrorSession介面為鏡像工作階段增加鏡像源。

介面說明

  • AddSourcesToTrafficMirrorSession 介面屬於非同步介面,即系統傳回一個請求 ID,但該鏡像源尚未增加成功,系統後台的增加任務仍在進行。您可以呼叫 ListTrafficMirrorSessions 查詢鏡像源的增加狀態:
    • 當鏡像工作階段處於 Modifying 狀態時,表示鏡像源正在增加中。

    • 當鏡像工作階段處於 Created 狀態時,表示鏡像源增加成功。

  • AddSourcesToTrafficMirrorSession 介面不支援並行為同一個鏡像工作階段增加鏡像源。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

vpc:AddSourcesToTrafficMirrorSession

update

*TrafficMirrorSession

acs:vpc:{#regionId}:{#accountId}:trafficmirrorsession/{#TrafficMirrorSessionId}

請求參數

名稱

類型

必填

描述

樣本值

ClientToken

string

用戶端 Token,用於保證請求的冪等性。

從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元。

說明

若您未指定,則系統自動使用 API 請求的 RequestId 作為 ClientToken 標識。每次 API 請求的 RequestId 可能不一樣。

0c593ea1-3bea-11e9-b96b-88e9fe63****

DryRun

boolean

是否只預檢此次請求,取值:

  • true:傳送檢查請求,不會新增鏡像源。檢查項包括是否填寫了必需參數、請求格式和限制。如果檢查不通過,則傳回對應錯誤。如果檢查通過,則傳回錯誤碼DryRunOperation

  • false(預設值):傳送正常請求,通過檢查後直接新增鏡像源。

false

TrafficMirrorSessionId

string

需要增加鏡像源的鏡像工作階段執行個體 ID。

tms-j6cla50buc44ap8tu****

TrafficMirrorSourceIds

array

需要增加的鏡像源的執行個體 ID,目前支援彈性網卡作為鏡像源。其中 N 的預設值為 1,即一個鏡像工作階段只支援新增一個鏡像源。

eni-j6ccmrl8z3xkvxgw****

string

需要增加的鏡像源的執行個體 ID,目前支援彈性網卡作為鏡像源。其中 N 的預設值為 1,即一個鏡像工作階段只支援新增一個鏡像源。

eni-j6c8znm5l1yt4sox****

RegionId

string

鏡像工作階段的所屬地域 ID。

您可以透過呼叫 DescribeRegions 介面取得地域 ID。

關於流量鏡像支援的地域,請參見流量鏡像概述

cn-hongkong

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

87F70089-5B38-41A8-BAD8-0B55E2F8DC57

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

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.
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 %s is not found.
400 ResourceNotFound.EcsInstance The specified resource of ECS instance is not found.
400 OperationDenied.EcsNotSupportTrafficMirror 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.
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.
400 QuotaExceeded.SourceNumPerSession The quota of the number of traffic mirror sources per session is exceeded.
400 QuotaExceeded.SourceNumPerTarget The maximum number of traffic mirror sources for a target is exceeded.
400 OperationUnsupported.BondingNetworkInterface The specified traffic mirror source is bonding eni without slave.
400 OperationDenied.UnsupportedTargetType Traffic mirror target must be SLB if traffic mirror sources contain nat gateway network interface.
400 OperationDenied.InvalidSourceBondEniType The traffic mirroring source does not support the entered bond ENI type.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情