調用CreateTrafficMirrorSession建立鏡像會話。
介面說明
CreateTrafficMirrorSession 介面屬於非同步介面,即系統返回一個執行個體 ID,但該鏡像會話尚未建立成功,系統背景建立任務仍在進行。您可以調用 ListTrafficMirrorSessions 查詢鏡像會話的建立狀態:
當鏡像會話處於 Creating 狀態時,表示鏡像會話正在建立中。
當鏡像會話處於 Created 狀態時,表示鏡像會話建立完成。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| TrafficMirrorSessionDescription |
string |
否 |
鏡像會話的描述資訊。 描述長度為 1~256 個字元,不能以 |
This is a trafficmirrorsession. |
| TrafficMirrorSessionName |
string |
否 |
鏡像會話的名稱。 名稱長度為 1~128 個字元,不能以 |
test |
| ClientToken |
string |
否 |
用戶端 Token,用於保證請求的等冪性。 從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元。 說明
若您未指定,則系統自動使用 API 請求的 RequestId 作為 ClientToken 標識。每次 API 請求的 RequestId 不一樣。 |
0c593ea1-3bea-11e9-b96b-88e9fe63**** |
| DryRun |
boolean |
否 |
是否只預檢此次請求,取值:
|
false |
| TrafficMirrorTargetId |
string |
是 |
鏡像目的的執行個體 ID,目前支援彈性網卡和私網Server Load Balancer執行個體作為鏡像目的。 |
eni-j6c8znm5l1yt4sox**** |
| TrafficMirrorTargetType |
string |
是 |
鏡像目的類型,取值:
|
NetworkInterface |
| TrafficMirrorFilterId |
string |
是 |
流量鏡像篩選條件的執行個體 ID。 |
tmf-j6cmls82xnc86vtpe**** |
| VirtualNetworkId |
integer |
否 |
指定 VNI(VXLAN Network Identifier),用來區分不同的鏡像流量,取值範圍為 0~16777215。 您可以通過 VNI 在鏡像目的區分不同會話的鏡像流量。您可以自訂 VNI 的值,也可以由系統隨機分配該值。如果由系統隨機分配該值,請不傳該參數。 |
1 |
| Priority |
integer |
是 |
鏡像會話的優先順序,取值範圍為 1~32766。 數字越小,優先順序越高。同一帳號在同一個地區建立的鏡像會話優先順序不能重複。 |
1 |
| Enabled |
boolean |
否 |
是否開啟流量會話,取值:
|
false |
| PacketLength |
integer |
否 |
指定被鏡像的原始報文長度(不包含 VXLAN 報文長度),預設值 1500,取值範圍:64~8500,單位:位元組。 |
1500 |
| TrafficMirrorSourceIds |
array |
是 |
鏡像源的執行個體 ID,目前支援彈性網卡作為鏡像源。其中 N 的預設值為 1,即一個鏡像會話只支援添加一個鏡像源。 |
eni-j6c2fp57q8rr47rp**** |
|
string |
否 |
鏡像源的執行個體 ID,目前支援彈性網卡作為鏡像源。其中 N 的預設值為 1,即一個鏡像會話只支援添加一個鏡像源。 |
eni-j6c2fp57q8rr47rp**** |
|
| RegionId |
string |
是 |
鏡像會話的所屬地區 ID。您可以通過調用 DescribeRegions 介面擷取地區 ID。關於流量鏡像支援的地區,請參見流量鏡像概述。 |
cn-hongkong |
| ResourceGroupId |
string |
否 |
流量鏡像所屬的資源群組 ID。 |
rg-bp67acfmxazb4ph**** |
| Tag |
array<object> |
否 |
資源的標籤。 |
|
|
object |
否 |
標籤。 |
||
| Key |
string |
否 |
資源的標籤鍵。最多支援輸入 20 個標籤鍵。如需傳入該值,則不能輸入Null 字元串。 一個標籤鍵最多支援 128 個字元,不能以 |
FinanceDept |
| Value |
string |
否 |
資源的標籤值。最多支援輸入 20 個標籤值。如需傳入該值,可以輸入Null 字元串。 最多支援 128 個字元,不能以 |
FinanceJoshua |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
鏡像會話的執行個體 ID。 |
||
| TrafficMirrorSessionId |
string |
鏡像會話的執行個體 ID。 |
tms-j6ce5di4w7nvigfjz**** |
| RequestId |
string |
請求 ID。 |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
| ResourceGroupId |
string |
流量鏡像所屬的資源群組 ID。 |
rg-bp67acfmxazb4ph**** |
樣本
正常返回樣本
JSON格式
{
"TrafficMirrorSessionId": "tms-j6ce5di4w7nvigfjz****",
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"ResourceGroupId": "rg-bp67acfmxazb4ph****"
}
錯誤碼
|
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. | 流量鏡像源執行個體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 %s is not found. | 指定的NetworkInterface %s 不存在 |
| 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執行個體。 |
| 400 | OperationDenied.ClassicSLB | The operation is not allowed because of ClassicSLB. | 當前操作不支援傳統型Server Load Balancer執行個體 |
| 400 | ResourceNotFound.TargetInstance | The specified target instance for traffic mirroring is not found. | 指定的流量鏡像目標執行個體不存在。 |
| 400 | QuotaExceeded.SourceNumPerTarget | The maximum number of traffic mirror sources for a target is exceeded. | 該鏡像目標關聯的鏡像源數量超過限額。 |
| 400 | IncorrectStatus.NetworkInterface | The status of network interface is incorrect. | 彈性網卡狀態不正確。 |
| 400 | OperationFailed.NotSupportBizType | The specified instance type does not support the operation. | 操作失敗因為指定的執行個體類型不支援此操作。 |
| 400 | IllegalParam.Priority | The specified Priority is illegal or the same as other mirroring sessions. | 指定的Priority不合法或與其他的鏡像會話相同 |
| 400 | OperationDenied.UnsupportedTargetType | Traffic mirror target must be SLB if traffic mirror sources contain nat gateway network interface. | 流量鏡像源中存在NAT Gateway網卡時,流量鏡像目的必須為SLB類型 |
| 400 | OperationDenied.TargetTypeNotSupportGatewayLoadBalancerEndpoint | Operation denied because of target type can not be GatewayLoadBalancerEndpoint. | 網關型負載平衡終端節點不支援作為流量鏡像目的。 |
| 400 | OperationDenied.TargetTypeNotSupportBondEni | Operation denied because of target type can not be Bond Network Interface. | Bond彈性網卡不支援作為鏡像目的。 |
| 400 | OperationDenied.InvalidTargetBondEniType | The traffic mirroring target does not support the entered bond ENI type. | 流量鏡像目的不支援所輸入的託管彈性網卡類型。 |
| 400 | OperationDenied.InvalidSourceBondEniType | The traffic mirroring source does not support the entered bond ENI type. | 流量鏡像源不支援所輸入的託管彈性網卡類型。 |
| 400 | OperationDenied.TargetTypeNotSupportTrafficMirrorFullPacket | The traffic mirror session target type does not support the feature of mirroring source full packet. | 當前流量鏡像會話的目的類型不支援完整報文鏡像功能。 |
| 400 | OperationDenied.TrafficMirrorSessionSourceFullPacketNotSupport | The traffic mirror session does not support the feature of mirroring source full packet. | 流量鏡像當前不支援完整報文鏡像功能,TrafficMirrorSourceTruncateMode只能設定為0,即預設模式。 |
| 400 | QuotaExceeded.SessionNumPerTarget | The quota of the number of traffic mirror sessions per target is exceeded. | |
| 400 | OperationDenied.NotSupportBondEniAsTrafficMirrorSource | The operation is not allowed because bond eni cannot be the source of traffic mirror. | 不允許託管網卡作為流量鏡像的源. |
| 400 | IncorrectStatus.TrafficMirrorSessionTarget | The status of the target of the traffic mirror session is incorrect. | 流量鏡像會話的目的的狀態不正確。 |
| 404 | ResourceNotFound.GatewayLoadBalancerEndpoint | GatewayLoadBalancerEndpoint instance not found. | 未找到GatewayLoadBalancerEndpoint執行個體。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。