ALB擴充版支援MCP(Model Context Protocol)協議代理能力,支援將現有的MCP伺服器、REST API或Function Compute快速接入,統一轉換為MCP格式的工具介面供AI Agent調用,簡化智能體與企業系統的整合。
ALB擴充版的MCP服務管理為白名單功能,如需使用,請聯絡您的商務經理申請開通。
方案架構
擴充版ALB執行個體接收MCP協議請求,通過轉寄規則路由至MCP類型伺服器組。MCP類型伺服器組統一代理後端的MCP伺服器、REST API和Function Compute服務,將響應轉換為MCP格式返回。同時,MCP代理組件內建語義搜尋能力,Agent可按需檢索匹配的工具,無需載入全量工具列表,減少Token消耗。
-
擴充版ALB執行個體:提供負載平衡和流量轉寄能力。
-
HTTPS監聽:接收用戶端請求。
-
轉寄規則:根據請求路徑匹配MCP協議請求並轉寄至MCP類型伺服器組。
-
服務擴充:通過MCP代理組件實現MCP協議轉換和語義搜尋。
-
MCP類型伺服器組:統一代理MCP伺服器、REST API和Function Compute三類後端服務。
適用範圍
-
使用者已擷取ALB擴充版公測資格。
-
使用者已在華北6(烏蘭察布)地區建立一個Virtual Private Cloud,分別在可用性區域A和可用性區域B建立一個交換器,且交換器已配置公網SNAT(用於ALB訪問公網 MCP 服務)。
-
使用者已準備好與自訂網域名匹配的伺服器憑證。非阿里雲購買的認證需要上傳到阿里雲認證服務。
操作步驟
1.建立擴充版ALB執行個體
-
登入ALB控制台,選擇華北6(烏蘭察布)地區,單擊建立應用型負載平衡。
-
在購買頁完成以下配置,單擊立即建立。
-
地區:預設選擇華北6(烏蘭察布)。
-
執行個體網路類型:選擇公網。
-
VPC和可用性區域:選擇目標VPC,勾選烏蘭察布 可用性區域A和烏蘭察布 可用性區域B後選擇對應交換器,並自動分配公網IP。
-
協議版本:選擇IPv4。
-
功能版本(執行個體費):選擇擴充版。
-
-
在確認訂單頁面確認執行個體配置詳情,單擊立即開通。
2.建立伺服器組
建立空伺服器組
建立伺服器類型的空伺服器組,在後續建立監聽時將作為預設規則的轉寄目標。本文的MCP請求均通過轉寄規則精確匹配,不會命中預設規則,因此該伺服器組無需添加後端伺服器。
-
在伺服器組控制台,單擊建立伺服器組。
-
伺服器群組類型:選擇伺服器類型。
-
伺服器組名稱:一個易於識別的名稱,本文為
sgp-default。 -
VPC:選擇ALB執行個體所在VPC。
-
-
勾選對話方塊底部的適用於擴充版執行個體,單擊建立。
建立MCP類型伺服器組
-
在伺服器組控制台,單擊建立伺服器組,伺服器群組類型選擇MCP服務類型,給其一個易於識別的名稱,本文為
sgp-mcp。 -
單擊建立,在伺服器組建立成功對話方塊單擊添加後端伺服器。
建立伺服器組後,根據後端服務的類型,參考對應的標籤頁添加MCP服務。
MCP伺服器
本樣本接入一個自建的溫度轉換MCP服務。
單擊添加MCP服務,完成以下配置,單擊確定。
-
服務名稱:輸入易於大模型理解的名稱,本文為
temperature-converter,表示提供溫度換算服務。 -
服務類型:選擇MCP伺服器。
-
MCP服務節點:輸入MCP服務的網域名稱訪問地址,如
http://mcp-backend.example.com:8000/mcp。MCP服務節點不支援直接填寫IP地址,需使用網域名稱格式。ALB擴充版訪問MCP服務節點時僅通過公網權威DNS解析,如需訪問VPC內網服務,需在公網DNS上將網域名稱解析到對應的私網IP。 -
訪問方式:選擇Streamable HTTP。
以下為提供溫度換算功能的MCP伺服器範例程式碼,可部署在與ALB同VPC的ECS執行個體中。該ECS執行個體需確保與ALB執行個體網路互連,且安全性群組規則允許ALB訪問MCP服務連接埠(文中為8000)。本文以Alibaba Cloud Linux 3.2104作業系統為例。
-
登入ECS執行個體,安裝Python 3.11和pip,然後安裝MCP依賴:
# Install Python 3.11 (requires 3.10 or later) sudo yum install -y python3.11 python3.11-pip # Install MCP dependencies sudo pip3.11 install "mcp>=1.0.0" -
建立專案目錄和服務端代碼:
mkdir mcp-server && cd mcp-server建立服務端代碼
server.py:from mcp.server.fastmcp import FastMCP server = FastMCP("temperature-converter", host="0.0.0.0") @server.tool() def celsius_to_fahrenheit(celsius: float) -> str: """ Convert temperature from Celsius to Fahrenheit. Args: celsius: Temperature in degrees Celsius Returns: Temperature in Fahrenheit (e.g., "77.0") """ fahrenheit = celsius * 9 / 5 + 32 return str(fahrenheit) @server.tool() def fahrenheit_to_celsius(fahrenheit: float) -> str: """ Convert temperature from Fahrenheit to Celsius. Args: fahrenheit: Temperature in degrees Fahrenheit Returns: Temperature in Celsius (e.g., "25.0") """ celsius = (fahrenheit - 32) * 5 / 9 return str(celsius) if __name__ == "__main__": server.run(transport="streamable-http") -
啟動MCP伺服器:
nohup python3.11 server.py > server.log 2>&1 &查看日誌確認啟動成功:
cat server.log輸出類似以下資訊表示啟動成功:
INFO: Started server process [12345] INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) -
驗證服務是否正常運行,執行以下命令:
curl -X POST http://127.0.0.1:8000/mcp \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'返回包含
serverInfo欄位的JSON響應,表示MCP伺服器已正常運行。
REST API
本樣本接入阿里雲OpenAPI來查詢和管理ALB資源。阿里雲OpenAPI需要AccessKey認證,需先建立憑證。
-
在ALB控制台左側導覽列選擇身份管理,單擊建立身份憑證,憑證類型 選擇AccessKey ,填入待管理的阿里雲帳號的AccessKey ID和AccessKey Secret,單擊建立。該AccessKey需具備對應介面的調用許可權。
AccessKey憑證類型為白名單功能。如需使用,請聯絡商務經理申請。
-
返回MCP伺服器組,單擊添加MCP服務,完成以下配置後單擊確定。
-
服務名稱:輸入易於大模型理解的名稱,本文為
alb-operator,表示提供ALB管理服務。 -
服務類型:選擇REST API。
-
OpenAPI 配置:訪問阿里雲OpenAPI門戶,在左側導覽列單擊擷取中繼資料下載OpenAPI設定檔,根據實際需求編輯僅保留所需介面後,粘貼或匯入。本文以僅保留查詢類介面為例,樣本中endpoints指定的地區為華北6(烏蘭察布),使用者可根據實際情況修改。
OpenAPI設定檔樣本(僅保留查詢類介面)
{ "version": "1.0", "info": { "style": "RPC", "product": "Alb", "version": "2020-06-16" }, "components": { "schemas": {} }, "apis": { "DescribeRegions": { "summary": "查詢ALB可用地區。", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "abilityTreeCode": "203", "abilityTreeNodes": [ "FEATUREslbRXTOWD" ], "tenantRelevance": "publicInformation" }, "parameters": [ { "name": "AcceptLanguage", "in": "query", "schema": { "title": "語言", "description": "支援的語言。取值:\n\n- **zh-CN**(預設):中文\n\n- **en-US**:英文\n\n- **ja**:日文", "type": "string", "required": false, "example": "zh-CN", "default": "zh-CN" } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": "返回資料的結構。", "type": "object", "properties": { "Regions": { "title": "Region列表", "description": "地區列表。", "type": "array", "items": { "description": "地區資訊結構。", "type": "object", "properties": { "LocalName": { "title": "名稱", "description": "地區名稱。", "type": "string", "example": "華東1(杭州)" }, "RegionEndpoint": { "title": "endpoint", "description": "地區服務的Endpoint地址。", "type": "string", "example": "alb.cn-hangzhou.aliyuncs.com" }, "RegionId": { "title": "RegionId", "description": "地區ID。", "type": "string", "example": "cn-hangzhou" } } } }, "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3" } } } } }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"Regions\\\": [\\n {\\n \\\"LocalName\\\": \\\"華東1(杭州)\\\",\\n \\\"RegionEndpoint\\\": \\\"alb.cn-hangzhou.aliyuncs.com\\\",\\n \\\"RegionId\\\": \\\"cn-hangzhou\\\"\\n }\\n ],\\n \\\"RequestId\\\": \\\"593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3\\\"\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<DescribeRegionsResponse>\\n <Regions>\\n <LocalName>華東1(杭州)</LocalName>\\n <RegionEndpoint>alb.cn-hangzhou.aliyuncs.com</RegionEndpoint>\\n <RegionId>cn-hangzhou</RegionId>\\n </Regions>\\n <RequestId>593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3</RequestId>\\n</DescribeRegionsResponse>\",\"errorExample\":\"\"}]", "title": "查詢地區" }, "DescribeZones": { "summary": "查詢ALB一個地區下的可用性區域列表", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "abilityTreeCode": "204", "abilityTreeNodes": [ "FEATUREslbRXTOWD" ], "tenantRelevance": "publicInformation" }, "parameters": [ { "name": "AcceptLanguage", "in": "query", "schema": { "description": "支援的語言。取值:\n\n- **zh-CN**(預設):中文\n\n- **en-US**:英文\n\n- **ja**:日文", "type": "string", "required": false, "example": "zh-CN", "default": "zh-CN" } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": "返回資料的結構。", "type": "object", "properties": { "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3" }, "Zones": { "title": "可用性區域列表", "description": "可用性區域列表。", "type": "array", "items": { "description": "可用性區域資訊結構。", "type": "object", "properties": { "LocalName": { "title": "可用性區域名稱", "description": "可用性區域名稱。", "type": "string", "example": "杭州 可用性區域G" }, "ZoneId": { "title": "可用性區域id", "description": "可用性區域ID。", "type": "string", "example": "cn-hangzhou-g" } } } } } } } }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"RequestId\\\": \\\"593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3\\\",\\n \\\"Zones\\\": [\\n {\\n \\\"LocalName\\\": \\\"杭州 可用性區域G\\\",\\n \\\"ZoneId\\\": \\\"cn-hangzhou-g\\\"\\n }\\n ]\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<DescribeZonesResponse>\\n <RequestId>593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3</RequestId>\\n <Zones>\\n <LocalName>華東 1 可用性區域G</LocalName>\\n <ZoneId>cn-hangzhou-g</ZoneId>\\n </Zones>\\n</DescribeZonesResponse>\",\"errorExample\":\"\"}]", "title": "查詢可用性區域" }, "GetLoadBalancerAttribute": { "summary": "查詢指定Server Load Balancer執行個體的詳細資料。", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "abilityTreeCode": "200", "abilityTreeNodes": [ "FEATUREslbM7ALO6", "FEATUREslbK3ZR0L", "FEATUREslbN5IE4S" ] }, "parameters": [ { "name": "LoadBalancerId", "in": "query", "schema": { "title": "執行個體標識", "description": "應用型Server Load Balancer執行個體ID。", "type": "string", "required": true, "example": "alb-o9ulmq5hgn68jk****" } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": "應用型Server Load Balancer執行個體詳細配置資訊。", "type": "object", "properties": { "AccessLogConfig": { "title": "訪問日誌屬性", "description": "訪問日誌配置。", "type": "object", "properties": { "LogProject": { "title": "訪問日誌投遞的logProject", "description": "記錄項目。", "type": "string", "example": "sls-setter" }, "LogStore": { "title": "刪除保護開啟時間", "description": "日誌儲存。\n\n", "type": "string", "example": "test" } } }, "AddressAllocatedMode": { "title": "地址分配方式", "description": "地址模式。取值 :\n\n- **Fixed**:固定IP模式,表示使用固定的IP地址。\n\n- **Dynamic**:動態IP模式,表示在每個可用性區域動態分配IP地址。", "type": "string", "example": "Dynamic" }, "AddressType": { "title": "地址類型", "description": "應用型Server Load Balancer執行個體的網路地址類型。取值:\n\n- **Internet**:負載平衡具有公網IP地址,DNS網域名稱被解析到公網IP,因此可以在公網環境訪問。\n\n- **Intranet**:負載平衡只有私網IP地址,DNS網域名稱被解析到私網IP,因此只能被負載平衡所在VPC的內網環境訪問。\n\n", "type": "string", "example": "Intranet" }, "BandwidthPackageId": { "title": "頻寬包ID", "description": "公網類型執行個體關聯的共用頻寬包ID。", "type": "string", "example": "cbwp-bp1vevu8h3ieh****" }, "CreateTime": { "title": "資源建立時間", "description": "資源建立時間,使用格林威治時間,格式為`yyyy-MM-ddTHH:mm:ssZ`。", "type": "string", "example": "2022-07-02T02:49:05Z" }, "DNSName": { "title": "DNS網域名稱", "description": "DNS網域名稱。", "type": "string", "example": "alb-95qnr2itwu9orb****.cn-hangzhou.alb.aliyuncs.com" }, "DeletionProtectionConfig": { "title": "負載平衡刪除保護相關資訊", "description": "刪除保護配置。", "type": "object", "properties": { "Enabled": { "title": "刪除保護狀態", "description": "刪除保護狀態,取值:\n\n- **true**:開啟狀態。\n\n- **false**:關閉狀態。", "type": "boolean", "example": "true" }, "EnabledTime": { "title": "刪除保護開啟時間", "description": "刪除保護開啟時間,使用格林威治時間,格式為`yyyy-MM-ddTHH:mm:ssZ`。", "type": "string", "example": "2022-08-02T02:49:05Z" } } }, "LoadBalancerBillingConfig": { "title": "計費相關屬性", "description": "應用型Server Load Balancer執行個體計費配置。", "type": "object", "properties": { "PayType": { "title": "執行個體的計費類型", "description": "計費類型。\n\n取值: **PostPay**表示隨用隨付。", "type": "string", "example": "PostPay", "default": "PostPay" } } }, "LoadBalancerBussinessStatus": { "title": "執行個體業務狀態", "description": "應用型負載平衡的業務狀態。取值:\n\n- **Abnormal**:異常狀態。\n\n- **Normal**:正常狀態。", "type": "string", "example": "Normal" }, "LoadBalancerEdition": { "title": "負載平衡的版本", "description": "應用型負載平衡的版本,不同版本有不同功能限制和計費策略。取值:\n\n- **Basic**:基礎版。\n\n- **Standard**:標準版。\n\n- **StandardWithWaf**:WAF增強版。", "type": "string", "example": "Standard" }, "LoadBalancerId": { "title": "負載平衡標識", "description": "應用型Server Load Balancer執行個體ID。", "type": "string", "example": "alb-o9ulmq5hgn68jk****" }, "LoadBalancerName": { "title": "執行個體名稱", "description": "執行個體名稱。\n\n長度為2~128個英文或中文字元,必須以字母或中文開頭,可包含數字、半形句號(.)、底線(_)和短劃線(-)。", "type": "string", "example": "alb1" }, "LoadBalancerOperationLocks": { "title": "鎖定原因", "description": "應用型負載平衡操作鎖配置。", "type": "array", "items": { "description": "應用型負載平衡操作鎖配置。", "type": "object", "properties": { "LockReason": { "title": "鎖定原因", "description": "鎖定的原因。在**LoadBalancerBussinessStatus**為**異常**時有效。", "type": "string", "example": "欠費" }, "LockType": { "title": "鎖定類型", "description": "鎖定的類型。取值 :\n\n- **SecurityLocked**:安全鎖定。\n\n- **RelatedResourceLocked**:關聯鎖定。\n\n- **FinancialLocked**:欠費鎖定。\n\n- **ResidualLocked**:殘留鎖定。", "type": "string", "example": "FinancialLocked" } } } }, "LoadBalancerStatus": { "title": "執行個體狀態", "description": "應用型Server Load Balancer執行個體狀態。取值:\n\n- **Inactive**: 已停止,表示執行個體監聽不會再轉寄流量。\n\n- **Active**: 運行中。\n\n- **Provisioning**:建立中。\n\n- **Configuring**:變更配置中。\n\n- **CreateFailed**:建立失敗,此時不會產生費用,執行個體只能被刪除。", "type": "string", "example": "Active" }, "ModificationProtectionConfig": { "title": "負載平衡修改保護相關資訊", "description": "修改保護配置。", "type": "object", "properties": { "Reason": { "title": "設定修改保護狀態的原因", "description": "開啟修改保護的原因。\n\n長度為2~128個英文或中文字元,必須以大小字母或中文開頭,可包含數字、半形句號(.)、底線(_)和短劃線(-)。\n\n僅在**Status**為**ConsoleProtection**時返回。", "type": "string", "example": "受管理的執行個體" }, "Status": { "title": "負載平衡修改保護狀態", "description": "應用型Server Load Balancer執行個體的修改保護狀態。取值:\n\n- **NonProtection**:未開啟修改保護。如有配置**Reason**,**Reason**會被強制置空。\n\n- **ConsoleProtection**:已開啟控制台修改保護。如有配置**Reason**,**Reason**可生效。\n\n> 當取值為**ConsoleProtection**,即開啟修改保護後,使用者不能通過負載平衡控制台修改執行個體配置,但可以通過調用API修改執行個體配置。", "type": "string", "example": "ConsoleProtection" } } }, "RegionId": { "title": "地區", "description": "應用型Server Load Balancer執行個體的地區ID。", "type": "string", "example": "cn-hangzhou" }, "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "365F4154-92F6-4AE4-92F8-7FF34B540710" }, "ResourceGroupId": { "title": "企業資源組ID", "description": "企業資源組ID。", "type": "string", "example": "rg-atstuj3rtop****" }, "Tags": { "title": "標籤列表", "description": "標籤。", "type": "array", "items": { "description": "標籤。", "type": "object", "properties": { "Key": { "title": "執行個體的標籤鍵", "description": "執行個體的標籤鍵。\n\n最多支援128個字元,不能以`aliyun`或`acs:`開頭,不能包含`http://`或`https://`。", "type": "string", "example": "FinanceDept" }, "Value": { "title": "執行個體的標籤值", "description": "執行個體的標籤值。\n\n最多支援128個字元,不能以`aliyun`或`acs:`開頭,不能包含`http://`或`https://`。", "type": "string", "example": "FinanceJoshua" } } } }, "VpcId": { "title": "Vpc網路ID", "description": "執行個體的專用網路ID。", "type": "string", "example": "vpc-bp1b49rqrybk45nio****" }, "ZoneMappings": { "title": "負載平衡的可用性區域資源", "description": "可用性區域及交換器映射列表,最多返回10個可用性區域。若當前地區支援2個及以上可用性區域,至少返回2個及以上可用性區域。", "type": "array", "items": { "description": "可用性區域及交換器映射列表,最多返回10個可用性區域。若當前地區支援2個及以上可用性區域,至少返回2個及以上可用性區域。", "type": "object", "properties": { "LoadBalancerAddresses": { "title": "固定VIP模式下,負載平衡在此可用性區域中的地址清單", "description": "執行個體地址。", "type": "array", "items": { "description": "執行個體地址。", "type": "object", "properties": { "Address": { "title": "IP地址", "description": "標識IPv4類型的IP地址。\n\n**AddressIPVersion**為**IPv4**和**DualStack**均生效,公網或私網IP地址由**AddressType**決定。", "type": "string", "example": "10.1.0.61" }, "Ipv6Address": { "title": "Ipv6地址", "description": "標識IPv6類型的IP地址。\n\n僅在**AddressIPVersion**為**DualStack**時有效,公網或私網IP地址由**Ipv6AddressType**決定。", "type": "string", "example": "2408:xxxx:249:dd01:6f4:750f:xxxx:bcd9" }, "IntranetAddress": { "title": "私網地址", "description": "IPv4私網地址。", "type": "string", "example": "10.1.0.61" }, "AllocationId": { "description": "Elastic IP Address標識。", "type": "string", "example": "eip-uf6wm****1zj9" }, "EipType": { "description": "公網EIP的類型。取值:\n\n- **Common**:Elastic IP Address,簡稱EIP。\n- **Anycast**:任播Elastic IP Address,簡稱Anycast EIP。\n\n> ALB支援綁定Anycast EIP的地區,請參見[使用限制](~~460727~~)。", "type": "string", "example": "Common" }, "IntranetAddressHcStatus": { "description": "應用型Server Load Balancer執行個體私網IPv4地址探測狀態。\n\n只有可用性區域的狀態為Active時才返回。取值:\n\n- **Healthy**:健康。\n- **Unhealthy**:異常。", "type": "string", "example": "Healthy" }, "Ipv6AddressHcStatus": { "description": "應用型Server Load Balancer執行個體IPv6地址探測狀態。\n\n只有可用性區域的狀態為Active時才返回。取值:\n\n- **Healthy**:健康。\n- **Unhealthy**:異常。", "type": "string", "example": "Healthy" }, "Ipv4LocalAddresses": { "description": "IPv4 Local地址清單。ALB與後端服務互動使用的地址清單。", "type": "array", "items": { "description": "IPv4 Local地址。", "type": "string", "example": "10.1.0.62" } }, "Ipv6LocalAddresses": { "description": "IPv6 Local地址清單。ALB與後端服務互動使用的地址清單。", "type": "array", "items": { "description": " IPv6 Local地址。", "type": "string", "example": "2408:xxxx:249:dd01:6f4:750f:xxxx:bcda" } } } } }, "VSwitchId": { "title": "交換器標識", "description": "可用性區域對應的交換器,每個可用性區域只能使用一台交換器和一個子網。", "type": "string", "example": "vsw-bp12mw1f8k3jgy****" }, "ZoneId": { "title": "可用性區域標識", "description": "應用型Server Load Balancer執行個體的可用性區域ID。\n\n您可以通過調用[DescribeZones](~~189196~~)介面擷取可用性區域ID對應的可用性區域的資訊。", "type": "string", "example": "cn-hangzhou-a" }, "Status": { "description": "可用性區域狀態。取值:\n\n- **Active**:運行中。\n- **Stopped**:已停止。\n- **Shifted**:已移除。\n- **Starting**:啟動中。\n- **Stopping**:停止中。", "type": "string", "example": "Active" } } } }, "AddressIpVersion": { "title": "協議版本", "description": "協議版本。取值:\n\n- **IPv4**:IPv4類型\n- **DualStack**:雙棧類型", "type": "string", "example": "DualStack" }, "Ipv6AddressType": { "title": "IPV6地址類型", "description": "應用型負載平衡IPv6的網路地址類型。取值:\n\n- **Internet**:公網。負載平衡具有公網IP地址,DNS網域名稱被解析到公網IP,因此可以在公網環境訪問。\n- **Intranet**:私網。負載平衡只有私網IP地址,DNS網域名稱被解析到私網IP,因此只能被負載平衡所在VPC的內網環境訪問。", "type": "string", "example": "Intranet" }, "SecurityGroupIds": { "description": "應用型Server Load Balancer執行個體綁定的安全性群組ID集合。", "type": "array", "items": { "description": "應用型Server Load Balancer執行個體綁定的安全性群組ID。", "type": "string", "example": "sg-uf63j385dzwlm6cy****" } } } } } }, "errorCodes": { "400": [ { "errorCode": "Forbidden.LoadBalancer", "errorMessage": "Authentication has failed for LoadBalancer." } ], "404": [ { "errorCode": "ResourceNotFound.LoadBalancer", "errorMessage": "The specified resource %s is not found." } ] }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"AccessLogConfig\\\": {\\n \\\"LogProject\\\": \\\"sls-setter\\\",\\n \\\"LogStore\\\": \\\"test\\\"\\n },\\n \\\"AddressAllocatedMode\\\": \\\"Dynamic\\\",\\n \\\"AddressType\\\": \\\"Intranet\\\",\\n \\\"BandwidthPackageId\\\": \\\"cbwp-bp1vevu8h3ieh****\\\",\\n \\\"CreateTime\\\": \\\"2022-07-02T02:49:05Z\\\",\\n \\\"DNSName\\\": \\\"alb-95qnr2itwu9orb****.cn-hangzhou.alb.aliyuncs.com\\\",\\n \\\"DeletionProtectionConfig\\\": {\\n \\\"Enabled\\\": true,\\n \\\"EnabledTime\\\": \\\"2022-08-02T02:49:05Z\\\"\\n },\\n \\\"LoadBalancerBillingConfig\\\": {\\n \\\"PayType\\\": \\\"PostPay\\\"\\n },\\n \\\"LoadBalancerBussinessStatus\\\": \\\"Normal\\\",\\n \\\"LoadBalancerEdition\\\": \\\"Standard\\\",\\n \\\"LoadBalancerId\\\": \\\"alb-o9ulmq5hgn68jk****\\\",\\n \\\"LoadBalancerName\\\": \\\"alb1\\\",\\n \\\"LoadBalancerOperationLocks\\\": [\\n {\\n \\\"LockReason\\\": \\\"欠費\\\",\\n \\\"LockType\\\": \\\"FinancialLocked\\\"\\n }\\n ],\\n \\\"LoadBalancerStatus\\\": \\\"Active\\\",\\n \\\"ModificationProtectionConfig\\\": {\\n \\\"Reason\\\": \\\"受管理的執行個體\\\",\\n \\\"Status\\\": \\\"ConsoleProtection\\\"\\n },\\n \\\"RegionId\\\": \\\"cn-hangzhou\\\",\\n \\\"RequestId\\\": \\\"365F4154-92F6-4AE4-92F8-7FF34B540710\\\",\\n \\\"ResourceGroupId\\\": \\\"rg-atstuj3rtop****\\\",\\n \\\"Tags\\\": [\\n {\\n \\\"Key\\\": \\\"FinanceDept\\\",\\n \\\"Value\\\": \\\"FinanceJoshua\\\"\\n }\\n ],\\n \\\"VpcId\\\": \\\"vpc-bp1b49rqrybk45nio****\\\",\\n \\\"ZoneMappings\\\": [\\n {\\n \\\"LoadBalancerAddresses\\\": [\\n {\\n \\\"Address\\\": \\\"10.1.0.61\\\",\\n \\\"Ipv6Address\\\": \\\"2408:xxxx:249:dd01:6f4:750f:xxxx:bcd9\\\",\\n \\\"IntranetAddress\\\": \\\"10.1.0.61\\\",\\n \\\"AllocationId\\\": \\\"eip-uf6wm****1zj9\\\",\\n \\\"EipType\\\": \\\"Common\\\",\\n \\\"IntranetAddressHcStatus\\\": \\\"Healthy\\\",\\n \\\"Ipv6AddressHcStatus\\\": \\\"Healthy\\\",\\n \\\"Ipv4LocalAddresses\\\": [\\n \\\"10.1.0.62\\\"\\n ],\\n \\\"Ipv6LocalAddresses\\\": [\\n \\\"2408:xxxx:249:dd01:6f4:750f:xxxx:bcda\\\"\\n ]\\n }\\n ],\\n \\\"VSwitchId\\\": \\\"vsw-bp12mw1f8k3jgy****\\\",\\n \\\"ZoneId\\\": \\\"cn-hangzhou-a\\\",\\n \\\"Status\\\": \\\"Active\\\"\\n }\\n ],\\n \\\"AddressIpVersion\\\": \\\"DualStack\\\",\\n \\\"Ipv6AddressType\\\": \\\"Intranet\\\",\\n \\\"SecurityGroupIds\\\": [\\n \\\"sg-uf63j385dzwlm6cy****\\\"\\n ]\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<GetLoadBalancerAttributeResponse>\\n <AccessLogConfig>\\n <LogProject>sls-setter</LogProject>\\n <LogStore>test</LogStore>\\n </AccessLogConfig>\\n <AddressAllocatedMode>Dynamic</AddressAllocatedMode>\\n <AddressType>Intranet</AddressType>\\n <BandwidthPackageId>cbwp-bp1vevu8h3ieh****</BandwidthPackageId>\\n <CreateTime>2022-07-02T02:49:05Z</CreateTime>\\n <DNSName>alb-95qnr2itwu9orb****.cn-hangzhou.alb.aliyuncs.com</DNSName>\\n <DeletionProtectionConfig>\\n <Enabled>true</Enabled>\\n <EnabledTime>2022-08-02T02:49:05Z</EnabledTime>\\n </DeletionProtectionConfig>\\n <LoadBalancerBillingConfig>\\n <PayType>PostPay</PayType>\\n </LoadBalancerBillingConfig>\\n <LoadBalancerBussinessStatus>Normal</LoadBalancerBussinessStatus>\\n <LoadBalancerEdition>Standard</LoadBalancerEdition>\\n <LoadBalancerId>alb-o9ulmq5hgn68jk****</LoadBalancerId>\\n <LoadBalancerName>alb1</LoadBalancerName>\\n <LoadBalancerOperationLocks>\\n <LockReason>欠費</LockReason>\\n <LockType>FinancialLocked</LockType>\\n </LoadBalancerOperationLocks>\\n <LoadBalancerStatus>Active</LoadBalancerStatus>\\n <ModificationProtectionConfig>\\n <Reason>受管理的執行個體</Reason>\\n <Status>ConsoleProtection</Status>\\n </ModificationProtectionConfig>\\n <RegionId>cn-hangzhou</RegionId>\\n <RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>\\n <ResourceGroupId>rg-atstuj3rtop****</ResourceGroupId>\\n <Tags>\\n <Key>FinanceDept</Key>\\n <Value>FinanceJoshua</Value>\\n </Tags>\\n <VpcId>vpc-bp1b49rqrybk45nio****</VpcId>\\n <ZoneMappings>\\n <LoadBalancerAddresses>\\n <Address>192.168.10.1</Address>\\n <Ipv6Address>2408:XXXX:39d:eb00::/56</Ipv6Address>\\n </LoadBalancerAddresses>\\n <VSwitchId>vsw-bp12mw1f8k3jgy****</VSwitchId>\\n <ZoneId>cn-hangzhou-a</ZoneId>\\n </ZoneMappings>\\n <AddressIpVersion>DualStack</AddressIpVersion>\\n <Ipv6AddressType>Intranet</Ipv6AddressType>\\n</GetLoadBalancerAttributeResponse>\",\"errorExample\":\"\"}]", "title": "查詢Server Load Balancer執行個體的詳細資料" }, "ListLoadBalancers": { "summary": "查詢執行個體配置", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "riskType": "none", "chargeType": "free", "abilityTreeNodes": [ "FEATUREslb6TP8T4" ] }, "parameters": [ { "name": "NextToken", "in": "query", "schema": { "title": "用來標記當前開始讀取的位置,置空表示從頭開始。", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 第一次查詢和沒有下一次查詢時,均無需填寫。\n- 如果有下一次查詢,取值為上一次API調用返回的**NextToken**值。", "type": "string", "required": false, "example": "FFmyTO70tTpLG6I3FmYAXGKPd****" } }, { "name": "MaxResults", "in": "query", "schema": { "title": "本次讀取的最巨量資料記錄數量,此參數為選擇性參數,取值1-100,使用者傳入為空白時,預設為20。", "description": "分批次查詢時每次顯示的條目數。取值範圍:**1**~**100**,預設值:**20**。\n\n", "type": "integer", "format": "int32", "required": false, "example": "20" } }, { "name": "ZoneId", "in": "query", "schema": { "title": "可用性區域ID", "description": "應用型Server Load Balancer執行個體所在的可用性區域ID。\n\n您可以通過調用[DescribeZones](~~189196~~)介面擷取可用性區域ID對應的可用性區域資訊。", "type": "string", "required": false, "example": "cn-hangzhou-a" } }, { "name": "LoadBalancerStatus", "in": "query", "schema": { "title": "執行個體狀態", "description": "應用型Server Load Balancer執行個體狀態。取值:\n\n- **Inactive**: 已停止,監聽不再轉寄流量。\n\n- **Active**::運行中。\n\n- **Provisioning**:建立中。\n\n- **Configuring**:變更配置中。\n\n- **CreateFailed**:建立失敗,此時不會產生費用,執行個體只能被刪除。系統預設清理最近1天建立失敗的執行個體。", "type": "string", "required": false, "example": "Active" } }, { "name": "LoadBalancerBussinessStatus", "in": "query", "schema": { "title": "執行個體業務狀態", "description": "應用型負載平衡的業務狀態。取值:\n\n- **Abnormal**:異常。\n\n- **Normal**:正常。", "type": "string", "required": false, "example": "Normal" } }, { "name": "LoadBalancerIds", "in": "query", "style": "flat", "schema": { "title": "執行個體ID列表,N最大支援20", "description": "執行個體ID列表。最多支援20個應用型Server Load Balancer執行個體ID。", "type": "array", "items": { "description": "執行個體的ID。", "type": "string", "required": false, "example": "alb-o9ulmq5hgn68jk****" }, "required": false, "maxItems": 21, "minItems": 1 } }, { "name": "LoadBalancerNames", "in": "query", "style": "flat", "schema": { "title": "執行個體Name列表,N最大支援10", "description": "執行個體名稱列表。最多支援10個執行個體名稱。", "type": "array", "items": { "description": "執行個體名稱。\n\n長度為2~128個英文或中文字元,必須以大小寫英文字母或中文開頭,可包含數字、半形句號(.)、底線(_)和短劃線(-)。", "type": "string", "required": false, "example": "alb-instance-test" }, "required": false, "maxItems": 11, "minItems": 1 } }, { "name": "VpcIds", "in": "query", "style": "flat", "schema": { "title": "vpcId列表", "description": "應用型Server Load Balancer執行個體所屬的VPC ID。最多支援10個VPC ID。", "type": "array", "items": { "description": "應用型Server Load Balancer執行個體所屬的VPC ID。", "type": "string", "required": false, "example": "vpc-bp1b49rqrybk45nio****" }, "required": false, "maxItems": 11, "minItems": 1 } }, { "name": "Tag", "in": "query", "style": "flat", "schema": { "title": "tag列表", "description": "執行個體標籤。", "type": "array", "items": { "description": "執行個體標籤結構。", "type": "object", "properties": { "Key": { "title": "執行個體的標籤鍵", "description": "執行個體的標籤鍵。最多支援輸入20個標籤鍵。一旦輸入該值,則不允許為空白字串。\n\n最多支援64個字元,不能以`aliyun`和`acs:`開頭,不能包含`http://`或者`https://`。", "type": "string", "required": false, "example": "KeyTest" }, "Value": { "title": "執行個體的標籤值", "description": "執行個體的標籤值。最多支援輸入20個標籤值。一旦輸入該值,可以為空白字串。\n\n最多支援128個字元,不能以`aliyun`和`acs:`開頭,不能包含`http://`或者`https://`。", "type": "string", "required": false, "example": "alueTest" } }, "required": false }, "required": false, "maxItems": 21, "minItems": 1 } }, { "name": "AddressType", "in": "query", "schema": { "title": "負載平衡的地址類型", "description": "執行個體地址類型。取值:\n\n- **Internet**:負載平衡具有公網IP地址,DNS網域名稱被解析到公網IP,因此可以在公網環境訪問。\n\n- **Intranet**:負載平衡只有私網IP地址,DNS網域名稱被解析到私網IP,因此只能被負載平衡所在VPC的內網環境訪問。", "type": "string", "required": false, "example": "Intranet" } }, { "name": "PayType", "in": "query", "schema": { "title": "付費類型", "description": "執行個體的計費類型。取值:\n\n**PostPay**(預設值):表示隨用隨付。", "type": "string", "required": false, "example": "PostPay" } }, { "name": "ResourceGroupId", "in": "query", "schema": { "title": "資源群組ID", "description": "企業資源組ID。", "type": "string", "required": false, "example": "rg-acfmxazb4ph****" } }, { "name": "AddressIpVersion", "in": "query", "schema": { "title": "需要過濾的協議版本", "description": "協議版本。取值:\n\n- **IPv4**:IPv4類型。\n- **DualStack**:雙棧類型。", "type": "string", "required": false, "example": "IPv4" } }, { "name": "Ipv6AddressType", "in": "query", "schema": { "title": "IPV6的地址網路類型", "description": "應用型負載平衡的IPv6地址類型。取值:\n\n- **Internet**:負載平衡具有公網IP地址,DNS網域名稱被解析到公網IP,因此可以在公網環境訪問。\n\n- **Intranet**:負載平衡只有私網IP地址,DNS網域名稱被解析到私網IP,因此只能被負載平衡所在VPC的內網環境訪問。", "type": "string", "required": false, "example": "Intranet" } }, { "name": "DNSName", "in": "query", "schema": { "description": "DNS網域名稱。", "type": "string", "required": false, "example": "alb-95qnr2itwu9orb****.cn-hangzhou.alb.aliyuncs.com" } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": "應用型Server Load Balancer執行個體配置資訊。", "type": "object", "properties": { "LoadBalancers": { "title": "執行個體列表", "description": "應用型Server Load Balancer執行個體列表。", "type": "array", "items": { "description": "應用型Server Load Balancer執行個體結構。", "type": "object", "properties": { "AccessLogConfig": { "title": "訪問日誌屬性", "description": "訪問日誌配置結構。", "type": "object", "properties": { "LogProject": { "title": "訪問日誌投遞的logProject", "description": "記錄項目。", "type": "string", "example": "sls-setter" }, "LogStore": { "title": "刪除保護開啟時間", "description": "日誌儲存。", "type": "string", "example": "test" } } }, "AddressAllocatedMode": { "title": "地址模式", "description": "地址模式。取值 :\n\n- **Fixed**:固定IP模式,表示使用固定IP地址。\n\n- **Dynamic**:動態IP模式,表示每個可用性區域動態分配IP地址。", "type": "string", "example": "Fixed" }, "AddressType": { "title": "地址類型", "description": "負載平衡的地址類型。取值:\n\n- **Internet**:負載平衡具有公網IP地址,DNS網域名稱被解析到公網IP,因此可以在公網環境訪問。\n\n- **Intranet**:負載平衡只有私網IP地址,DNS網域名稱被解析到私網IP,因此只能被負載平衡所在VPC的內網環境訪問。", "type": "string", "example": "Intranet" }, "BandwidthPackageId": { "title": "頻寬包ID", "description": "公網類型執行個體關聯的共用頻寬包ID。", "type": "string", "example": "cbwp-bp1vevu8h3ieh****" }, "CreateTime": { "title": "資源建立時間", "description": "資源建立時間。", "type": "string", "example": "2022-07-02T02:49:05Z" }, "DNSName": { "title": "DNS網域名稱", "description": "DNS網域名稱。", "type": "string", "example": "alb-95qnr2itwu9orb****.cn-hangzhou.alb.aliyuncs.com" }, "DeletionProtectionConfig": { "title": "負載平衡刪除保護相關資訊", "description": "刪除保護配置。", "type": "object", "properties": { "Enabled": { "title": "刪除保護狀態", "description": "刪除保護狀態,取值:\n\n- **true**:開啟。\n\n- **false**:關閉。", "type": "boolean", "example": "true" }, "EnabledTime": { "title": "刪除保護開啟時間", "description": "開啟刪除保護時間。", "type": "string", "example": "2022-08-02T02:49:05Z" } } }, "LoadBalancerBillingConfig": { "title": "計費相關屬性", "description": "Server Load Balancer執行個體計費配置。", "type": "object", "properties": { "PayType": { "title": "執行個體的計費類型", "description": "計費類型。取值:\n\n**PostPay**:隨用隨付。", "type": "string", "example": "PostPay", "default": "PostPay" } } }, "LoadBalancerBussinessStatus": { "title": "執行個體業務狀態", "description": "負載平衡的業務狀態。取值:\n\n- **Abnormal**:異常。\n\n- **Normal**:正常。", "type": "string", "example": "Normal" }, "LoadBalancerEdition": { "title": "負載平衡的版本", "description": "負載平衡的版本,不同版本有不同功能限制和計費策略。取值:\n\n- **Basic**:基礎版。\n\n- **Standard**:標準版。\n\n- **StandardWithWaf**:WAF增強版。\n\n", "type": "string", "example": "Standard" }, "LoadBalancerId": { "title": "負載平衡標識", "description": "應用型Server Load Balancer執行個體ID。", "type": "string", "example": "alb-o9ulmq5hgn68jk****" }, "LoadBalancerName": { "title": "執行個體名稱", "description": "Server Load Balancer執行個體名稱。", "type": "string", "example": "alb-instance-test" }, "LoadBalancerOperationLocks": { "title": "鎖定的原因", "description": "負載平衡操作鎖配置。", "type": "array", "items": { "description": "負載平衡操作鎖結構。", "type": "object", "properties": { "LockReason": { "title": "鎖定的原因", "description": "鎖定的原因。在**LoadBalancerBussinessStatus**為**異常**時有效。", "type": "string" }, "LockType": { "title": "鎖定的類型", "description": "鎖定的類型。取值 :\n\n- **SecurityLocked**:安全鎖定。\n\n- **RelatedResourceLocked**:關聯鎖定。\n\n- **FinancialLocked**:欠費鎖定。\n\n- **ResidualLocked**:殘留鎖定。", "type": "string", "example": "FinancialLocked" } } } }, "LoadBalancerStatus": { "title": "執行個體狀態", "description": "應用型Server Load Balancer執行個體狀態。取值:\n\n- **Inactive**: 已停止,表示執行個體監聽不會再轉寄流量。\n\n- **Active**: 運行中。\n\n- **Provisioning**:建立中。\n\n- **Configuring**:變更配置中。\n\n- **CreateFailed**:建立失敗。", "type": "string", "example": "Active" }, "ModificationProtectionConfig": { "title": "負載平衡修改保護相關資訊", "description": "修改保護配置。", "type": "object", "properties": { "Reason": { "title": "設定修改保護狀態的原因", "description": "開啟修改保護的原因。\n\n長度為2~128個英文或中文字元,必須以大小寫英文字母或中文開頭,可包含數字、半形句號(.)、底線(_)和短劃線(-)。\n\n僅在**Status**為**ConsoleProtection**時返回。", "type": "string", "example": "Managed Instance" }, "Status": { "title": "負載平衡修改保護狀態", "description": "應用型Server Load Balancer執行個體的修改保護狀態。取值:\n\n- **NonProtection**:未開啟修改保護。如有配置**Reason**,**Reason**會被強制置空。\n\n- **ConsoleProtection**:已開啟控制台修改保護。如有配置**Reason**,**Reason**可生效。\n\n> 當取值為**ConsoleProtection**,即開啟修改保護後,使用者不能通過負載平衡控制台修改執行個體配置,但可以通過調用API修改執行個體配置。", "type": "string", "example": "ConsoleProtection" } } }, "ResourceGroupId": { "title": "企業資源組ID", "description": "企業資源組ID。", "type": "string", "example": "rg-atstuj3rtop****" }, "Tags": { "title": "標籤列表", "description": "標籤列表。", "type": "array", "items": { "description": "標籤結構。", "type": "object", "properties": { "Key": { "title": "執行個體的標籤鍵", "description": "執行個體的標籤鍵。", "type": "string", "example": "KeyTest" }, "Value": { "title": "執行個體的標籤值", "description": "執行個體的標籤值。", "type": "string", "example": "alueTest" } } } }, "VpcId": { "title": "Vpc網路ID", "description": "應用型Server Load Balancer執行個體的專用網路ID。", "type": "string", "example": "vpc-bp1b49rqryhk45nio****" }, "AddressIpVersion": { "title": "協議版本", "description": "協議版本。取值:\n\n- **IPv4**:IPv4類型。\n\n- **DualStack**:雙棧類型。", "type": "string", "example": "DualStack" }, "Ipv6AddressType": { "title": "IPV6地址類型", "description": "應用型負載平衡IPv6的網路地址類型。取值:\n\n- **Internet**:公網。負載平衡具有公網IP地址,DNS網域名稱被解析到公網IP,因此可以在公網環境訪問。\n\n- **Intranet**:私網。負載平衡只有私網IP地址,DNS網域名稱被解析到私網IP,因此只能被負載平衡所在VPC的內網環境訪問。", "type": "string", "example": "Intranet" }, "SecurityGroupIds": { "description": "應用型Server Load Balancer執行個體加入的安全性群組。", "type": "array", "items": { "description": "應用型Server Load Balancer執行個體加入的安全性群組。", "type": "string", "example": "sg-2zejdtxxpu8c9tny****" } } } } }, "MaxResults": { "title": "本次請求所返回的最大記錄條數。", "description": "分批次查詢時每次顯示的條目數。\n\n", "type": "integer", "format": "int32", "example": "20" }, "NextToken": { "title": "用來表示當前調用返回讀取到的位置,空代表資料已經讀取完畢。", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 如果**NextToken**為空白表示沒有下一次查詢。\n- 如果**NextToken**有傳回值,該取值表示下一次查詢開始的令牌。", "type": "string", "example": "FFmyTO70tTpLG6I3FmYAXGKPd****" }, "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "365F4154-92F6-4AE4-92F8-7FF34B540710" }, "TotalCount": { "title": "本次請求條件下的資料總量。", "description": "列表條目數。", "type": "integer", "format": "int32", "example": "100" } } } } }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"LoadBalancers\\\": [\\n {\\n \\\"AccessLogConfig\\\": {\\n \\\"LogProject\\\": \\\"sls-setter\\\",\\n \\\"LogStore\\\": \\\"test\\\"\\n },\\n \\\"AddressAllocatedMode\\\": \\\"Fixed\\\",\\n \\\"AddressType\\\": \\\"Intranet\\\",\\n \\\"BandwidthPackageId\\\": \\\"cbwp-bp1vevu8h3ieh****\\\",\\n \\\"CreateTime\\\": \\\"2022-07-02T02:49:05Z\\\",\\n \\\"DNSName\\\": \\\"alb-95qnr2itwu9orb****.cn-hangzhou.alb.aliyuncs.com\\\",\\n \\\"DeletionProtectionConfig\\\": {\\n \\\"Enabled\\\": true,\\n \\\"EnabledTime\\\": \\\"2022-08-02T02:49:05Z\\\"\\n },\\n \\\"LoadBalancerBillingConfig\\\": {\\n \\\"PayType\\\": \\\"PostPay\\\"\\n },\\n \\\"LoadBalancerBussinessStatus\\\": \\\"Normal\\\",\\n \\\"LoadBalancerEdition\\\": \\\"Standard\\\",\\n \\\"LoadBalancerId\\\": \\\"alb-o9ulmq5hgn68jk****\\\",\\n \\\"LoadBalancerName\\\": \\\"alb-instance-test\\\",\\n \\\"LoadBalancerOperationLocks\\\": [\\n {\\n \\\"LockReason\\\": \\\"\\\",\\n \\\"LockType\\\": \\\"FinancialLocked\\\"\\n }\\n ],\\n \\\"LoadBalancerStatus\\\": \\\"Active\\\",\\n \\\"ModificationProtectionConfig\\\": {\\n \\\"Reason\\\": \\\"Managed Instance\\\",\\n \\\"Status\\\": \\\"ConsoleProtection\\\"\\n },\\n \\\"ResourceGroupId\\\": \\\"rg-atstuj3rtop****\\\",\\n \\\"Tags\\\": [\\n {\\n \\\"Key\\\": \\\"KeyTest\\\",\\n \\\"Value\\\": \\\"alueTest\\\"\\n }\\n ],\\n \\\"VpcId\\\": \\\"vpc-bp1b49rqryhk45nio****\\\",\\n \\\"AddressIpVersion\\\": \\\"DualStack\\\",\\n \\\"Ipv6AddressType\\\": \\\"Intranet\\\",\\n \\\"SecurityGroupIds\\\": [\\n \\\"sg-2zejdtxxpu8c9tny****\\\"\\n ]\\n }\\n ],\\n \\\"MaxResults\\\": 20,\\n \\\"NextToken\\\": \\\"FFmyTO70tTpLG6I3FmYAXGKPd****\\\",\\n \\\"RequestId\\\": \\\"365F4154-92F6-4AE4-92F8-7FF34B540710\\\",\\n \\\"TotalCount\\\": 100\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<ListLoadBalancersResponse>\\n <LoadBalancers>\\n <AccessLogConfig>\\n <LogProject>sls-setter</LogProject>\\n <LogStore>test</LogStore>\\n </AccessLogConfig>\\n <AddressAllocatedMode>Fixed</AddressAllocatedMode>\\n <AddressType>Intranet</AddressType>\\n <BandwidthPackageId>cbwp-bp1vevu8h3ieh****</BandwidthPackageId>\\n <CreateTime>2022-07-02T02:49:05Z</CreateTime>\\n <DNSName>alb-95qnr2itwu9orb****.cn-hangzhou.alb.aliyuncs.com</DNSName>\\n <DeletionProtectionConfig>\\n <Enabled>true</Enabled>\\n <EnabledTime>2022-08-02T02:49:05Z</EnabledTime>\\n </DeletionProtectionConfig>\\n <LoadBalancerBillingConfig>\\n <PayType>PostPay</PayType>\\n </LoadBalancerBillingConfig>\\n <LoadBalancerBussinessStatus>Normal</LoadBalancerBussinessStatus>\\n <LoadBalancerEdition>Standard</LoadBalancerEdition>\\n <LoadBalancerId>alb-o9ulmq5hgn68jk****</LoadBalancerId>\\n <LoadBalancerName>alb-instance-test</LoadBalancerName>\\n <LoadBalancerOperationLocks>\\n <LockReason>欠費</LockReason>\\n <LockType>FinancialLocked</LockType>\\n </LoadBalancerOperationLocks>\\n <LoadBalancerStatus>Active</LoadBalancerStatus>\\n <ModificationProtectionConfig>\\n <Reason>受管理的執行個體</Reason>\\n <Status>ConsoleProtection</Status>\\n </ModificationProtectionConfig>\\n <ResourceGroupId>rg-atstuj3rtop****</ResourceGroupId>\\n <Tags>\\n <Key>KeyTest</Key>\\n <Value>alueTest</Value>\\n </Tags>\\n <VpcId>vpc-bp1b49rqrybk45nio****</VpcId>\\n <AddressIpVersion>DualStack</AddressIpVersion>\\n <Ipv6AddressType>Intranet</Ipv6AddressType>\\n </LoadBalancers>\\n <MaxResults>20</MaxResults>\\n <NextToken>FFmyTO70tTpLG6I3FmYAXGKPd****</NextToken>\\n <RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>\\n <TotalCount>100</TotalCount>\\n</ListLoadBalancersResponse>\",\"errorExample\":\"\"}]", "title": "查詢負載平衡" }, "ListListeners": { "summary": "查詢指定地區的監聽。", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "abilityTreeCode": "190", "abilityTreeNodes": [ "FEATUREslbM7ALO6", "FEATUREslbK3ZR0L", "FEATUREslbN5IE4S" ] }, "parameters": [ { "name": "NextToken", "in": "query", "schema": { "title": "用來標記當前開始讀取的位置,置空表示從頭開始。", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 第一次查詢和沒有下一次查詢時,均無需填寫。\n- 如果有下一次查詢,取值為上一次API調用返回的**NextToken**值。", "type": "string", "required": false, "example": "FFmyTO70tTpLG6I4FmYAXGKPd****" } }, { "name": "MaxResults", "in": "query", "schema": { "title": "本次讀取的最巨量資料記錄數量,此參數為選擇性參數,取值1-100,使用者傳入為空白時,預設為20。", "description": "本次讀取的最巨量資料記錄數量,此參數為選擇性參數。取值範圍:**1~100**。入參為空白時,預設值為**20**。", "type": "integer", "format": "int32", "required": false, "example": "50" } }, { "name": "ListenerIds", "in": "query", "style": "flat", "schema": { "title": "監聽ID列表,N最大支援20", "description": "監聽執行個體ID列表。最多支援20個監聽ID。", "type": "array", "items": { "description": "監聽執行個體ID。", "type": "string", "required": false, "example": "lsn-o4u54y73wq7b******" }, "required": false, "maxItems": 20, "minItems": 1 } }, { "name": "LoadBalancerIds", "in": "query", "style": "flat", "schema": { "title": "執行個體ID列表,N最大支援20", "description": "應用型Server Load Balancer執行個體ID。最多支援20個執行個體ID。", "type": "array", "items": { "description": "應用型Server Load Balancer執行個體ID。", "type": "string", "required": false, "example": "alb-bd6oylbckp6k9x****" }, "required": false, "maxItems": 21, "minItems": 1 } }, { "name": "ListenerProtocol", "in": "query", "schema": { "title": "監聽協議", "description": "需要過濾的監聽協議。取值:\n\n- **HTTP**:協議類型為HTTP。\n- **HTTPS**:協議類型為HTTPS。\n- **QUIC**:協議類型為QUIC。", "type": "string", "required": false, "example": "HTTP" } }, { "name": "Tag", "in": "query", "style": "flat", "schema": { "description": "標籤。", "type": "array", "items": { "description": "標籤結構。", "type": "object", "properties": { "Key": { "description": "標籤鍵。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "required": false, "example": "env" }, "Value": { "description": "標籤值。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "required": false, "example": "product" } }, "required": false }, "required": false } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": "應用型負載平衡監聽資訊。", "type": "object", "properties": { "Listeners": { "title": "監聽列表", "description": "應用型負載平衡監聽列表。", "type": "array", "items": { "description": "應用型負載平衡監聽結構。", "type": "object", "properties": { "DefaultActions": { "title": "預設動作", "description": "預設規則動作列表。", "type": "array", "items": { "description": "預設規則動作結構。", "type": "object", "properties": { "ForwardGroupConfig": { "title": "轉寄到伺服器組", "description": "轉寄規則動作對應的配置。動作類型為**ForwardGroup**時有效。", "type": "object", "properties": { "ServerGroupTuples": { "title": "伺服器組列表", "description": "轉寄目標伺服器組。", "type": "array", "items": { "description": "轉寄目標伺服器組。", "type": "object", "properties": { "ServerGroupId": { "title": "伺服器組ID", "description": "轉寄到的目的伺服器組ID。", "type": "string", "example": "sgp-i5qt20******" } } } } } }, "Type": { "title": "類型", "description": "動作類型。取值:**ForwardGroup**,表示轉寄至多個伺服器組。", "type": "string", "example": "ForwardGroup" } } } }, "GzipEnabled": { "title": "是否開啟Gzip壓縮", "description": "是否開啟Gzip壓縮,對特定檔案類型進行壓縮。取值:\n\n- **true**:是。\n- **false**:否。\n\n", "type": "boolean", "example": "false" }, "Http2Enabled": { "title": "是否開啟HTTP/2特性", "description": "是否開啟HTTP/2特性。取值:\n\n- **true**:是。\n- **false**:否。\n\n> 僅HTTPS監聽支援此參數。", "type": "boolean", "example": "false" }, "IdleTimeout": { "title": "串連空閑逾時時間", "description": "指定串連空閑逾時時間。單位:秒。取值範圍:**1~60**。\n\n如果在逾時時間內一直沒有訪問請求,負載平衡會暫時中斷當前串連,直到接收到下一次請求時重建立立新的串連。", "type": "integer", "format": "int32", "example": "3" }, "ListenerDescription": { "title": "監聽描述", "description": "自訂監聽名稱。", "type": "string", "example": "HTTP_80" }, "ListenerId": { "title": "監聽標識", "description": "監聽ID。", "type": "string", "example": "lsn-o4u34y73wq7b******" }, "ListenerPort": { "title": "監聽連接埠", "description": "應用型Server Load Balancer執行個體前端使用的連接埠。取值:**1~65535**。", "type": "integer", "format": "int32", "example": "80" }, "ListenerProtocol": { "title": "監聽協議", "description": "監聽協議。取值:\n\n- **HTTP**:協議類型為HTTP。\n- **HTTPS**:協議類型為HTTPS。\n- **QUIC**:協議類型為QUIC。", "type": "string", "example": "HTTP" }, "ListenerStatus": { "title": "監聽狀態", "description": "當前監聽的狀態,取值:\n\n- **Provisioning**:建立中。\n\n- **Running**:運行中。\n\n- **Configuring**:配置中。\n\n- **Stopped**:已停止。", "type": "string", "example": "Running" }, "LoadBalancerId": { "title": "負載平衡標識", "description": "應用型Server Load Balancer執行個體ID。", "type": "string", "example": "alb-bd6oylbckp6k9x****" }, "LogConfig": { "title": "監聽訪問日誌相關配置", "description": "日誌配置。", "type": "object", "properties": { "AccessLogRecordCustomizedHeadersEnabled": { "title": "訪問日誌是否開啟攜帶自訂Header", "description": "訪問日誌是否開啟攜帶自訂頭。取值:\n\n- **true**:是。\n- **false**:否。\n", "type": "boolean", "example": "true" }, "AccessLogTracingConfig": { "title": "訪問日誌Xtrace相關的配置", "description": "訪問日誌Xtrace相關的配置資訊。", "type": "object", "properties": { "TracingEnabled": { "title": "Xtrace功能狀態", "description": "是否開啟Xtrace功能。取值:\n\n- **true**:是。\n- **false**:否。\n\n> 只有執行個體訪問日誌開關**AccessLogEnabled**開啟時,才能設定此參數為**true**。", "type": "boolean", "example": "true" }, "TracingSample": { "title": "Xtrace功能狀態", "description": "Xtrace的採樣率。取值:**1~10000**。\n\n> **TracingEnabled**為**true**時,此值有效。", "type": "integer", "format": "int32", "example": "100" }, "TracingType": { "title": "xtrace的類型", "description": "Xtrace類型,合法取值為**Zipkin**。\n\n> **TracingEnabled**為**true**時,此值有效。", "type": "string", "example": "Zipkin" } } } } }, "QuicConfig": { "title": "HTTPS啟用QUIC時相關屬性", "description": "啟用關聯QUIC監聽時的配置資訊。", "type": "object", "properties": { "QuicListenerId": { "title": "需要關聯的QUIC監聽ID,HTTPS監聽時有效,QuicUpgradeEnabled為true時必選", "description": "需要關聯的QUIC監聽ID。**QuicUpgradeEnabled**為**true**時必選。HTTPS監聽時有效。\n\n> 原始監聽和關聯的QUIC監聽必須屬於同一個ALB執行個體,並且此QUIC監聽之前沒有被關聯過。", "type": "string", "example": "lsn-o4u54y73wq7b******" }, "QuicUpgradeEnabled": { "title": "是否開啟quic升級,HTTPS監聽時有效", "description": "是否開啟QUIC升級。取值:\n\n- **true**:是。\n- **false**:否。\n\n> 僅HTTPS監聽時有效。", "type": "boolean", "example": "true" } } }, "RequestTimeout": { "title": "請求逾時時間", "description": "指定請求逾時時間。單位:秒。取值:**1~180**。\n\n如果在逾時時間內後端伺服器一直沒有響應,負載平衡將放棄等待,給用戶端返回`HTTP 504`錯誤碼。", "type": "integer", "format": "int32", "example": "34" }, "SecurityPolicyId": { "title": "安全性原則", "description": "安全性原則。\n\n> 僅HTTPS監聽支援此參數。", "type": "string", "example": "tls_cipher_policy_1_1" }, "XForwardedForConfig": { "title": "XForward欄位相關的配置", "description": "`XForward`頭欄位配置資訊。", "type": "object", "properties": { "XForwardedForClientCertClientVerifyAlias": { "title": "自訂HEADER頭名稱,只有當XForwardedForClientCertClientVerifyEnabled的值為true的時候,此值才會生效;否則該值不會生效。HTTPS監聽有效", "description": "自訂頭欄位名稱,只有當**XForwardedForClientCertClientVerifyEnabled**的值為**true**的時候,此值才會生效;否則該值不會生效。\n\n取值限制:長度為1~40字元。支援字母a-z、數字、短劃線(-)和底線(_)。\n\n> 僅HTTPS監聽支援此參數。", "type": "string", "example": "test_client-verify-alias_123456" }, "XForwardedForClientCertClientVerifyEnabled": { "title": "是否通過X-Forwarded-Clientcert-clientverify 頭欄位擷取對訪問Server Load Balancer執行個體用戶端認證的校正結果。HTTPS監聽有效。", "description": "是否通過`X-Forwarded-Clientcert-clientverify`頭欄位擷取對訪問Server Load Balancer執行個體用戶端認證的校正結果。取值:\n\n- **true**:是。\n- **false**:否。\n\n> 僅HTTPS監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForClientCertFingerprintAlias": { "title": "自訂HEADER頭名稱,只有當XForwardedForClientCertFingerprintEnabled的值為true的時候,此值才會生效;否則該值不會生效。HTTPS監聽有效", "description": "自訂頭名稱,只有當**XForwardedForClientCertFingerprintEnabled**的值為**true**時生效。\n\n取值限制:長度為1~40字元。支援字母a-z、數字、短劃線(-)和底線(_)。\n\n> 僅HTTPS監聽支援此參數。", "type": "string", "example": "test_finger-print-alias_123456" }, "XForwardedForClientCertFingerprintEnabled": { "title": "是否通過X-Forwarded-Clientcert-fingerprint 頭欄位擷取訪問Server Load Balancer執行個體用戶端認證的指紋取值,HTTPS監聽有效。", "description": "是否通過`X-Forwarded-Clientcert-fingerprint`頭欄位擷取訪問Server Load Balancer執行個體用戶端認證的指紋取值。取值:\n\n- **true**:是。\n- **false**:否。\n\n> 僅HTTPS監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForClientCertIssuerDNAlias": { "title": "自訂HEADER頭名稱,只有當XForwardedForClientCertIssuerDNEnabled的值為‘On’的時候,此值才會生效;否則該值不會生效。HTTPS監聽有效", "description": "自訂頭名稱,只有當**XForwardedForClientCertIssuerDNEnabled**的值為**true**的時候,此值才會生效。\n\n取值限制:長度為1~40字元。支援字母a-z、數字、短劃線(-)和底線(_)。\n\n> 僅HTTPS監聽支援此參數。", "type": "string", "example": "test_issue-dn-alias_123456" }, "XForwardedForClientCertIssuerDNEnabled": { "title": "是否通過 X-Forwarded-Clientcert-issuerdn 頭欄位擷取訪問Server Load Balancer執行個體用戶端認證的發行者資訊。HTTPS監聽有效。", "description": "是否通過`X-Forwarded-Clientcert-issuerdn`頭欄位擷取訪問Server Load Balancer執行個體用戶端認證的發行者資訊。取值:\n\n- **true**:是。\n- **false**:否。\n\n> 僅HTTPS監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForClientCertSubjectDNAlias": { "title": "自訂HEADER頭名稱,只有當XForwardedForClientCertSubjectDNEnabled的值為true的時候,此值才會生效;否則該值不會生效。HTTPS監聽有效", "description": "自訂頭名稱,只有當**XForwardedForClientCertSubjectDNEnabled**的值為**true**時,此值才會生效。\n\n取值限制:長度為1~40字元。支援字母a-z、數字、短劃線(-)和底線(_)。\n\n> 僅HTTPS監聽支援此參數。", "type": "string", "example": "test_subject-dn-alias_123456" }, "XForwardedForClientCertSubjectDNEnabled": { "title": "是否通過X-Forwarded-Clientcert-subjectdn 頭欄位擷取訪問Server Load Balancer執行個體用戶端認證的所有者資訊。HTTPS監聽有效。", "description": "是否通過`X-Forwarded-Clientcert-subjectdn`頭欄位擷取訪問Server Load Balancer執行個體用戶端認證的所有者資訊。取值:\n\n- **true**:是。\n- **false**:否。\n\n> 僅HTTPS監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForClientSrcPortEnabled": { "title": "是否通過X-Forwarded-Client-Port 頭欄位擷取訪問Server Load Balancer執行個體用戶端的連接埠。HTTPS監聽有效。", "description": "是否通過`X-Forwarded-Client-Port`頭欄位擷取訪問Server Load Balancer執行個體用戶端的連接埠。取值:\n\n- **true**:是。\n- **false**:否。\n\n> HTTP和HTTPS監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForEnabled": { "title": "是否開啟通過X-Forwarded-For頭欄位擷取來訪者真實 IP", "description": "是否通過`X-Forwarded-For`頭欄位擷取來訪者真實IP。取值:\n- **true**(預設值):是。\n- **false**:否。\n\n> 1. 配置**true**,**XForwardedForProcessingMode**預設取值**append**,支援修改為**remove**。\n> 2. 配置**false**,將請求發送至後端服務之前保留`X-Forwarded-For`頭欄位,不做額外處理。\n> 3. HTTP和HTTPS監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForProcessingMode": { "description": "處理`X-Forwarded-For`頭欄位的模式。只有當**XForwardedForEnabled**為**true**時,此值才會生效。取值:\n- **append**(預設值):附加。\n- **remove**:刪除。\n\n> 1. 配置**append**,將請求發送至後端服務之前把最後一跳IP加入`X-Forwarded-For`頭欄位。\n> 2. 配置**remove**,將請求發送至後端服務之前刪除`X-Forwarded-For`標題,無論請求是否攜帶`X-Forwarded-For`頭欄位。\n> 3. HTTP和HTTPS監聽支援此參數。", "type": "string", "example": "append" }, "XForwardedForProtoEnabled": { "title": "是否通過X-Forwarded-Proto頭欄位擷取Server Load Balancer執行個體的監聽協議。", "description": "是否通過`X-Forwarded-Proto`頭欄位擷取Server Load Balancer執行個體的監聽協議。取值:\n\n- **true**:是。\n- **false**:否。\n\n> HTTP、HTTPS和QUIC監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForSLBIdEnabled": { "title": "是否通過SLB-ID頭欄位擷取Server Load Balancer執行個體ID。", "description": "是否通過`SLB-ID`頭欄位擷取Server Load Balancer執行個體ID。取值:\n\n- **true**:是。\n- **false**:否。\n\n> HTTP、HTTPS和QUIC監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForSLBPortEnabled": { "title": "是否通過X-Forwarded-Port 頭欄位擷取Server Load Balancer執行個體的監聽連接埠。HTTPS監聽有效。", "description": "是否通過`X-Forwarded-Port`頭欄位擷取Server Load Balancer執行個體的監聽連接埠。取值:\n\n- **true**:是。\n- **false**:否。\n\n> HTTP、HTTPS和QUIC監聽支援此參數。", "type": "boolean", "example": "true" }, "XForwardedForClientSourceIpsEnabled": { "description": "是否允許ALB從X-Forwarded-For頭欄位中尋找真實用戶端IP。取值:\n\n- **true**:是。\n\n- **false**:否。\n\n> HTTP、HTTPS監聽支援此參數。", "type": "boolean", "example": "false" }, "XForwardedForClientSourceIpsTrusted": { "description": "指定可信的代理IP。\n\n應用型負載平衡ALB會從後往前遍曆`X-Forwarded-For`,選取第一個不在可信IP列表中的IP作為真實的用戶端IP,該IP會被用於源IP限速。", "type": "string", "example": "10.1.1.0/24" }, "XForwardedForHostEnabled": { "description": "是否開啟通過`X-Forwarded-Host`頭欄位擷取訪問Server Load Balancer執行個體用戶端的網域名稱。取值:\n- **true**:是。\n- **false**(預設值):否。\n\n> HTTP、HTTPS和QUIC監聽支援此參數。", "type": "boolean", "example": "false" } } }, "Tags": { "description": "標籤。", "type": "array", "items": { "description": "標籤結構。", "type": "object", "properties": { "Key": { "description": "標籤鍵。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "example": "env" }, "Value": { "description": "標籤值。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "example": "product" } } } } } } }, "MaxResults": { "title": "本次請求所返回的最大記錄條數。", "description": "本次請求所返回的最大記錄條數。", "type": "integer", "format": "int32", "example": "50" }, "NextToken": { "title": "用來表示當前調用返回讀取到的位置,空代表資料已經讀取完畢。", "description": "當前調用返回讀取到的位置,設定為空白代表資料已經讀取完畢。", "type": "string", "example": "FFmyTO70tTpLG6I3FmYAXGKPd****" }, "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "365F4154-92F6-4AE4-92F8-7FF3******" }, "TotalCount": { "title": "本次請求條件下的資料總量。", "description": "本次請求條件下的資料總量。", "type": "integer", "format": "int32", "example": "1000" } } } } }, "errorCodes": { "403": [ { "errorCode": "Forbidden.LoadBalancer", "errorMessage": "Authentication is failed for %s." } ] }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"Listeners\\\": [\\n {\\n \\\"DefaultActions\\\": [\\n {\\n \\\"ForwardGroupConfig\\\": {\\n \\\"ServerGroupTuples\\\": [\\n {\\n \\\"ServerGroupId\\\": \\\"sgp-i5qt20******\\\"\\n }\\n ]\\n },\\n \\\"Type\\\": \\\"ForwardGroup\\\"\\n }\\n ],\\n \\\"GzipEnabled\\\": false,\\n \\\"Http2Enabled\\\": false,\\n \\\"IdleTimeout\\\": 3,\\n \\\"ListenerDescription\\\": \\\"HTTP_80\\\",\\n \\\"ListenerId\\\": \\\"lsn-o4u34y73wq7b******\\\",\\n \\\"ListenerPort\\\": 80,\\n \\\"ListenerProtocol\\\": \\\"HTTP\\\",\\n \\\"ListenerStatus\\\": \\\"Running\\\",\\n \\\"LoadBalancerId\\\": \\\"alb-bd6oylbckp6k9x****\\\",\\n \\\"LogConfig\\\": {\\n \\\"AccessLogRecordCustomizedHeadersEnabled\\\": true,\\n \\\"AccessLogTracingConfig\\\": {\\n \\\"TracingEnabled\\\": true,\\n \\\"TracingSample\\\": 100,\\n \\\"TracingType\\\": \\\"Zipkin\\\"\\n }\\n },\\n \\\"QuicConfig\\\": {\\n \\\"QuicListenerId\\\": \\\"lsn-o4u54y73wq7b******\\\",\\n \\\"QuicUpgradeEnabled\\\": true\\n },\\n \\\"RequestTimeout\\\": 34,\\n \\\"SecurityPolicyId\\\": \\\"tls_cipher_policy_1_1\\\",\\n \\\"XForwardedForConfig\\\": {\\n \\\"XForwardedForClientCertClientVerifyAlias\\\": \\\"test_client-verify-alias_123456\\\",\\n \\\"XForwardedForClientCertClientVerifyEnabled\\\": true,\\n \\\"XForwardedForClientCertFingerprintAlias\\\": \\\"test_finger-print-alias_123456\\\",\\n \\\"XForwardedForClientCertFingerprintEnabled\\\": true,\\n \\\"XForwardedForClientCertIssuerDNAlias\\\": \\\"test_issue-dn-alias_123456\\\",\\n \\\"XForwardedForClientCertIssuerDNEnabled\\\": true,\\n \\\"XForwardedForClientCertSubjectDNAlias\\\": \\\"test_subject-dn-alias_123456\\\",\\n \\\"XForwardedForClientCertSubjectDNEnabled\\\": true,\\n \\\"XForwardedForClientSrcPortEnabled\\\": true,\\n \\\"XForwardedForEnabled\\\": true,\\n \\\"XForwardedForProcessingMode\\\": \\\"append\\\",\\n \\\"XForwardedForProtoEnabled\\\": true,\\n \\\"XForwardedForSLBIdEnabled\\\": true,\\n \\\"XForwardedForSLBPortEnabled\\\": true,\\n \\\"XForwardedForClientSourceIpsEnabled\\\": false,\\n \\\"XForwardedForClientSourceIpsTrusted\\\": \\\"10.1.1.0/24\\\",\\n \\\"XForwardedForHostEnabled\\\": false\\n },\\n \\\"Tags\\\": [\\n {\\n \\\"Key\\\": \\\"env\\\",\\n \\\"Value\\\": \\\"product\\\"\\n }\\n ]\\n }\\n ],\\n \\\"MaxResults\\\": 50,\\n \\\"NextToken\\\": \\\"FFmyTO70tTpLG6I3FmYAXGKPd****\\\",\\n \\\"RequestId\\\": \\\"365F4154-92F6-4AE4-92F8-7FF3******\\\",\\n \\\"TotalCount\\\": 1000\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<ListListenersResponse>\\n <Listeners>\\n <DefaultActions>\\n <ForwardGroupConfig>\\n <ServerGroupTuples>\\n <ServerGroupId>rsp-cige6j****</ServerGroupId>\\n </ServerGroupTuples>\\n </ForwardGroupConfig>\\n <Type>ForwardGroup</Type>\\n </DefaultActions>\\n <GzipEnabled>false</GzipEnabled>\\n <Http2Enabled>false</Http2Enabled>\\n <IdleTimeout>3</IdleTimeout>\\n <ListenerDescription>HTTP_80</ListenerDescription>\\n <ListenerId>lsr-bp1bpn0kn908w4nbw****</ListenerId>\\n <ListenerPort>80</ListenerPort>\\n <ListenerProtocol>HTTP</ListenerProtocol>\\n <ListenerStatus>Running</ListenerStatus>\\n <LoadBalancerId>alb-bd6oylbckp6k9x****</LoadBalancerId>\\n <LogConfig>\\n <AccessLogRecordCustomizedHeadersEnabled>true</AccessLogRecordCustomizedHeadersEnabled>\\n <AccessLogTracingConfig>\\n <TracingEnabled>true</TracingEnabled>\\n <TracingSample>100</TracingSample>\\n <TracingType>Zipkin</TracingType>\\n </AccessLogTracingConfig>\\n </LogConfig>\\n <QuicConfig>\\n <QuicListenerId>lsr-bp1bpn908w4nbw****</QuicListenerId>\\n <QuicUpgradeEnabled>true</QuicUpgradeEnabled>\\n </QuicConfig>\\n <RequestTimeout>34</RequestTimeout>\\n <SecurityPolicyId>tls_cipher_policy_1_1</SecurityPolicyId>\\n <XForwardedForConfig>\\n <XForwardedForClientCertClientVerifyAlias>test_client-verify-alias_123456</XForwardedForClientCertClientVerifyAlias>\\n <XForwardedForClientCertClientVerifyEnabled>true</XForwardedForClientCertClientVerifyEnabled>\\n <XForwardedForClientCertFingerprintAlias>test_finger-print-alias_123456</XForwardedForClientCertFingerprintAlias>\\n <XForwardedForClientCertFingerprintEnabled>true</XForwardedForClientCertFingerprintEnabled>\\n <XForwardedForClientCertIssuerDNAlias>test_issue-dn-alias_123456</XForwardedForClientCertIssuerDNAlias>\\n <XForwardedForClientCertIssuerDNEnabled>true</XForwardedForClientCertIssuerDNEnabled>\\n <XForwardedForClientCertSubjectDNAlias>test_subject-dn-alias_123456</XForwardedForClientCertSubjectDNAlias>\\n <XForwardedForClientCertSubjectDNEnabled>true</XForwardedForClientCertSubjectDNEnabled>\\n <XForwardedForClientSrcPortEnabled>true</XForwardedForClientSrcPortEnabled>\\n <XForwardedForEnabled>true</XForwardedForEnabled>\\n <XForwardedForProtoEnabled>true</XForwardedForProtoEnabled>\\n <XForwardedForSLBIdEnabled>true</XForwardedForSLBIdEnabled>\\n <XForwardedForSLBPortEnabled>true</XForwardedForSLBPortEnabled>\\n <XForwardedForClientSourceIpsEnabled>false</XForwardedForClientSourceIpsEnabled>\\n <XForwardedForClientSourceIpsTrusted>10.1.1.0/24</XForwardedForClientSourceIpsTrusted>\\n </XForwardedForConfig>\\n </Listeners>\\n <MaxResults>50</MaxResults>\\n <NextToken>FFmyTO70tTpLG6I3FmYAXGKPd****</NextToken>\\n <RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>\\n <TotalCount>1000</TotalCount>\\n</ListListenersResponse>\",\"errorExample\":\"\"}]", "title": "查詢監聽" }, "ListServerGroups": { "summary": "查詢服務器組列表。", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "abilityTreeCode": "166", "abilityTreeNodes": [ "FEATUREslbVRSQEA" ] }, "parameters": [ { "name": "ServerGroupIds", "in": "query", "style": "flat", "schema": { "title": "伺服器組Id列表", "description": "伺服器組ID列表。", "type": "array", "items": { "description": "伺服器組ID,一次最多支援查詢20個伺服器組ID。", "type": "string", "required": false, "example": "sgp-atstuj3rtop****" }, "required": false, "maxItems": 20 } }, { "name": "ServerGroupNames", "in": "query", "style": "flat", "schema": { "title": "伺服器組名稱", "description": "伺服器組名稱列表,最多10個。", "type": "array", "items": { "description": "伺服器組名稱,一次最多支援查詢10個伺服器組名稱。", "type": "string", "required": false, "example": "Group3" }, "required": false, "maxItems": 10 } }, { "name": "ResourceGroupId", "in": "query", "schema": { "title": "資源群組ID", "description": "資源群組ID。", "type": "string", "required": false, "example": "rg-atstuj3rtop****" } }, { "name": "NextToken", "in": "query", "schema": { "title": "分頁查詢標識", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 第一次查詢和沒有下一次查詢時,均無需填寫。\n- 如果有下一次查詢,取值為上一次API調用返回的**NextToken**值。", "type": "string", "required": false, "example": "FFmyTO70tTpLG6I3FmYAXG****" } }, { "name": "MaxResults", "in": "query", "schema": { "title": "查詢數量", "description": "分批次查詢時每次顯示的條目數。取值範圍:**1**~**100**,預設值為**20**。", "type": "integer", "format": "int32", "required": false, "maximum": "100", "minimum": "1", "example": "20", "default": "20" } }, { "name": "VpcId", "in": "query", "schema": { "title": "VpcId", "description": "VPC執行個體ID。", "type": "string", "required": false, "example": "vpc-bp15zckdt37pq72zv****" } }, { "name": "ServerGroupType", "in": "query", "schema": { "title": "伺服器群組類型", "description": "伺服器群組類型。取值:\n\n- **Instance**:伺服器類型,包括Ecs、Eni、Eci執行個體。\n\n- **Ip**:IP地址類型。\n\n- **Fc**:Function Compute類型。\n\n- 不填則查詢所有類型。", "type": "string", "required": false, "example": "Instance" } }, { "name": "Tag", "in": "query", "style": "flat", "schema": { "title": "Tag列表", "description": "伺服器組綁定的標籤列表。一次請求中,綁定的標籤列表中最多支援10個標籤。", "type": "array", "items": { "description": "伺服器組綁定的標籤,單次支援傳入10個標籤。", "type": "object", "properties": { "Key": { "title": "標籤鍵", "description": "標籤鍵。最多支援10個標籤鍵。\n\n最多支援64個字元,不能以`aliyun`和`acs:`開頭,不能包含`http://`或者`https://`。", "type": "string", "required": false, "example": "Test" }, "Value": { "title": "標籤值", "description": "標籤值。最多支援10個標籤值。\n\n最多支援128個字元,不能以`aliyun`和`acs:`開頭,不能包含`http://`或者`https://`。\n\n", "type": "string", "required": false, "example": "Test" } }, "required": false }, "required": false, "example": "Instance" } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": " 返回資料結構體。", "type": "object", "properties": { "MaxResults": { "title": "本次查詢返回記錄數量", "description": "分批次查詢時每次顯示的條目數。", "type": "integer", "format": "int32", "example": "50" }, "NextToken": { "title": "分頁查詢標識", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 如果**NextToken**為空白表示沒有下一次查詢。\n- 如果**NextToken**有傳回值,該取值表示下一次查詢開始的令牌。", "type": "string", "example": "caeba0bbb2be03f8****" }, "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "CEF72CEB-54B6-4AE8-B225-F876******" }, "ServerGroups": { "title": "伺服器組", "description": "後端伺服器組列表。", "type": "array", "items": { "description": "後端伺服器組列表。", "type": "object", "properties": { "HealthCheckConfig": { "title": "健全狀態檢查配置", "description": "健全狀態檢查配置。", "type": "object", "properties": { "HealthCheckConnectPort": { "title": "連接埠", "description": "健全狀態檢查的後端伺服器的連接埠。取值範圍:**0**~**65535**。\n\n返回為**0**時代表使用後端伺服器的連接埠進行健全狀態檢查。", "type": "integer", "format": "int32", "example": "80" }, "HealthCheckEnabled": { "title": "是否啟用健全狀態檢查", "description": "是否啟用健全狀態檢查,取值:\n- **true**:啟用。\n- **false**:不啟用。", "type": "boolean", "example": "true" }, "HealthCheckHost": { "title": "網域名稱", "description": "健全狀態檢查網域名稱。\n\n- **使用後端伺服器的內網IP**(預設):使用後端伺服器的內網IP地址作為健全狀態檢查的網域名稱。\n\n- **指定特定網域名稱**:輸入一個網域名稱。\n\n - 長度限制為1~80個字元。\n\n - 可包含小寫字母、數字、短劃線(-)和半形句號(.)。\n\n - 至少包含一個半形句號(.),半形句號(.)不能出現在開頭或結尾。\n\n - 最右側的域標籤,只能包含字母,不能包含數字或短劃線(-)。\n\n - 短劃線(-)不能出現在開頭或結尾。\n\n> \n> 只有HealthCheckProtocol設定為HTTP、HTTPS或gRPC時,該參數生效。", "type": "string", "example": "www.example.com" }, "HealthCheckCodes": { "title": "狀態代碼", "description": "健全狀態檢查正常的狀態代碼列表。", "type": "array", "items": { "description": "健全狀態檢查正常的狀態代碼。\n\n- 當**HealthCheckProtocol**取值為**HTTP**或**HTTPS**時,**HealthCheckCodes**可以選擇**http\\_2xx**、 **http\\_3xx**、**http\\_4xx**和**http\\_5xx**。多個狀態代碼用半形逗號(,)分隔。\n\n- 當**HealthCheckProtocol**取值為**gRPC**時,**HealthCheckCodes**狀態代碼範圍:**0~99**。支援範圍輸入,最多支援20個範圍值,多個範圍值使用半形逗號(,)隔開。\n\n> **HealthCheckProtocol**為**HTTP**或**HTTPS**或**gRPC**時,該參數生效。", "type": "string", "example": "http_2xx" } }, "HealthCheckHttpVersion": { "title": "版本", "description": "健全狀態檢查HTTP協議版本。\n\n取值:**HTTP1.0**或**HTTP1.1**。\n\n> 只有**HealthCheckProtocol**設定為**HTTP**或**HTTPS**時,該參數生效。", "type": "string", "example": "HTTP1.1" }, "HealthCheckInterval": { "title": "間隔時間", "description": "健全狀態檢查的時間間隔。單位:秒。取值範圍:**1**~**50**。", "type": "integer", "format": "int32", "example": "5" }, "HealthCheckMethod": { "title": "方法", "description": "健全狀態檢查方法。取值:\n\n- **GET**:如果響應報文長度超過8K,會被截斷,但不會影響健全狀態檢查結果的判定。\n\n- **POST**:gRPC監聽健全狀態檢查預設採用POST方法。\n\n- **HEAD**:HTTP和HTTPS監聽健全狀態檢查預設採用HEAD方法。\n\n\n> 只有**HealthCheckProtocol**設定為**HTTP**或**HTTPS**或**gRPC**時,該參數生效。", "type": "string", "example": "HEAD" }, "HealthCheckPath": { "title": "uri", "description": "健全狀態檢查的轉寄規則路徑。\n\n> 只有**HealthCheckProtocol**設定為**HTTP**或**HTTPS**時,該參數生效。", "type": "string", "example": "/test/index.html" }, "HealthCheckProtocol": { "title": "協議", "description": "健全狀態檢查協議。取值:\n\n- **HTTP**:通過發送HEAD或GET請求類比瀏覽器的訪問行為來檢查伺服器應用是否健康。\n\n- **HTTPS**:通過發送HEAD或GET請求類比瀏覽器的訪問行為來檢查伺服器應用是否健康。(資料加密,相比HTTP更安全。)\n\n- **TCP**:通過發送SYN握手報文來檢測伺服器連接埠是否存活。\n\n- **gRPC**:通過發送POST或GET請求來檢查伺服器應用是否健康。", "type": "string", "example": "HTTP" }, "HealthCheckTimeout": { "title": "逾時時間", "description": "接收來自健全狀態檢查的響應需要等待的時間。如果後端伺服器在指定的時間內沒有正確響應,則判定為健全狀態檢查失敗。單位:秒。\n\n", "type": "integer", "format": "int32", "example": "3" }, "HealthyThreshold": { "title": "健康閾值", "description": "健全狀態檢查連續成功多少次後,將後端伺服器的健全狀態檢查狀態由**失敗**判定為**成功**。", "type": "integer", "format": "int32", "example": "4" }, "UnhealthyThreshold": { "title": "不健康閾值", "description": "健全狀態檢查連續失敗多少次後,將後端伺服器的健全狀態檢查狀態由**成功**判定為**失敗**。", "type": "integer", "format": "int32", "example": "4" } } }, "Protocol": { "title": "伺服器組協議", "description": "後端協議類型。取值:\n\n- **HTTP**:支援關聯HTTPS、HTTP和QUIC監聽。\n- **HTTPS**:支援關聯HTTPS監聽。\n\n- **GRPC**:關聯HTTPS和QUIC監聽。\n", "type": "string", "example": "HTTP" }, "RelatedLoadBalancerIds": { "title": "關聯的執行個體id", "description": "關聯的執行個體id", "type": "array", "items": { "description": "關聯的Server Load Balancer執行個體id", "type": "string", "example": "alb-n5qw04uq8savfe****" } }, "ResourceGroupId": { "title": "資源群組id", "description": "資源群組ID。", "type": "string", "example": "rg-atstuj3rtop****" }, "Scheduler": { "title": "調度策略", "description": "調度演算法。取值:\n\n- **Wrr**:加權輪詢,權重值越高的後端伺服器,被輪詢到的機率也越高。\n- **Wlc**:加權最小串連數,除了根據每台後端伺服器設定的權重值來進行輪詢,同時還考慮後端伺服器的實際負載(即串連數)。當權重值相同時,當前串連數越小的後端伺服器被輪詢到的機率也越高。\n- **Sch**:一致性雜湊,相同雜湊因子計算結果的請求將會調度到相同的後端伺服器。不配置UchConfig參數時,預設雜湊因子為源IP,相同源IP地址的請求會分發到同一台後端伺服器;配置了UchConfig參數時,雜湊因子為URL參數,相同URL參數的請求會分發到同一台後端伺服器。", "type": "string", "example": "Wrr" }, "ServerGroupId": { "title": "伺服器組Id", "description": "伺服器組ID。", "type": "string", "example": "sgp-cige6j****" }, "ServerGroupName": { "title": "伺服器組名稱", "description": "伺服器組名稱。", "type": "string", "example": "Group3" }, "ServerGroupStatus": { "title": "伺服器組狀態", "description": "伺服器組狀態。取值:\n- **Creating**:建立中。\n\n- **Available**:可用。\n\n- **Configuring**:變更配置中。", "type": "string", "example": "Available" }, "ServerGroupType": { "title": "伺服器群組類型", "description": "伺服器群組類型。取值:\n\n- **Instance**:伺服器類型,包括Ecs、Eni、Eci執行個體。\n\n- **Ip**:IP類型。\n\n- **Fc**:Function Compute類型。", "type": "string", "example": "Instance" }, "StickySessionConfig": { "title": "會話保持配置", "description": "會話保持配置結構體。", "type": "object", "properties": { "Cookie": { "title": "Cookie", "description": "伺服器上配置的Cookie。", "type": "string", "example": "B490B5EBF6F3CD402E515D22BCDA****" }, "CookieTimeout": { "title": "Cookie逾時時間", "description": "Cookie逾時時間。單位:秒。取值範圍:**1**~**86400**。\n\n> 當**StickySessionEnabled**為**true**且**StickySessionType**為**Insert**時,該參數生效。\n\n\n\n", "type": "integer", "format": "int32", "example": "1000" }, "StickySessionEnabled": { "title": "是否開啟會話保持", "description": "是否啟用會話保持。取值:\n\n- **true**:開啟。\n- **false**:關閉。\n", "type": "boolean", "example": "false" }, "StickySessionType": { "title": "會話保持類型", "description": "Cookie的處理方式。取值:\n\n- **Insert**:植入Cookie。\n用戶端第一次訪問時,負載平衡會在返回請求中植入Cookie(即在HTTP或HTTPS響應報文中插入SERVERID),下次用戶端攜帶此Cookie訪問,負載平衡服務會將請求定向轉寄給之前記錄到的後端伺服器上。\n- **Server**:重寫Cookie。\n負載平衡發現使用者自訂了Cookie,將會對原來的Cookie進行重寫,下次用戶端攜帶新的Cookie訪問,負載平衡服務會將請求定向轉寄給之前記錄到的後端伺服器。", "type": "string", "example": "Insert" } } }, "VpcId": { "title": "伺服器組所在VpcId", "description": "VPC執行個體ID。", "type": "string", "example": "vpc-bp15zckdt37pq72zv****" }, "Tags": { "title": "標籤列表", "description": "伺服器組綁定的標籤列表。", "type": "array", "items": { "description": "伺服器組綁定的標籤列表。", "type": "object", "properties": { "Key": { "title": "標籤鍵", "description": "標籤鍵。", "type": "string", "example": "Test" }, "Value": { "title": "標籤值", "description": "標籤值。", "type": "string", "example": "Test" } } } }, "ConfigManagedEnabled": { "title": "是否開啟組態管理", "description": "是否開啟組態管理。取值:\n- **true**:開啟。\n- **false**:關閉。", "type": "boolean", "example": "false" }, "UpstreamKeepaliveEnabled": { "title": "是否開啟後端長連結", "description": "是否開啟後端長連結。取值:\n- **true**:開啟。\n- **false**:關閉。", "type": "boolean", "example": "false" }, "Ipv6Enabled": { "title": "是否支援Ipv6", "description": "是否支援IPv6。取值:\n- **true**:支援。\n- **false**:不支援。", "type": "boolean", "example": "false" }, "ServerCount": { "title": "伺服器組內伺服器數量", "description": "伺服器組內伺服器數量。", "type": "integer", "format": "int32", "example": "1" }, "ServiceName": { "title": "伺服器名稱", "description": "服務名稱。", "type": "string", "example": "test" }, "UchConfig": { "title": "url一致性hash參數配置", "description": "url一致性hash參數配置。", "type": "object", "properties": { "Type": { "title": "參數類型", "description": "參數類型。只能填QueryString。", "type": "string", "example": "QueryString" }, "Value": { "title": "一致性hash參數值", "description": "一致性hash參數值。", "type": "string", "example": "abc" } } }, "CreateTime": { "description": "資源建立時間。", "type": "string", "example": "2022-07-02T02:49:05Z" }, "ConnectionDrainConfig": { "description": "串連優雅中斷相關配置。\n\n開啟串連優雅中斷,在移除後端伺服器或者健全狀態檢查失敗後,負載平衡使現有串連在一定時間內正常傳輸。\n>\n> - 基礎版執行個體不支援開啟串連優雅中斷,僅標準版、WAF增強版執行個體支援。\n> - 伺服器類型、IP類型伺服器組支援串連優雅中斷,Function Compute類型不支援。", "type": "object", "properties": { "ConnectionDrainEnabled": { "description": "是否開啟串連優雅中斷。\n\n- **true**:開啟\n- **false**:關閉", "type": "boolean", "example": "false" }, "ConnectionDrainTimeout": { "description": "串連優雅中斷逾時時間。", "type": "integer", "format": "int32", "example": "300" } } }, "SlowStartConfig": { "title": "慢啟動配置", "description": "慢啟動相關配置。\n\n開啟慢啟動後,將會在設定的時間段內對新添加到後端伺服器組的後端伺服器進行預熱,轉寄到該伺服器的請求數量線性增加。\n>\n> - 基礎版執行個體不支援開啟慢啟動,僅標準版、WAF增強版執行個體支援。\n> - 伺服器類型、IP類型伺服器組支援配置慢啟動,Function Compute類型不支援。\n> - 慢啟動僅在後端調度演算法是加權輪詢演算法時可開啟。", "type": "object", "properties": { "SlowStartEnabled": { "description": "是否開啟慢啟動。\n\n- **true**:開啟\n- **false**:關閉", "type": "boolean", "example": "false" }, "SlowStartDuration": { "description": "慢啟動期間。", "type": "integer", "format": "int32", "example": "30" } } }, "CrossZoneEnabled": { "description": "伺服器組是否開啟跨AZ負載平衡。取值:\n\n- **true**:開啟(預設值)\n\n- **false**:關閉", "type": "boolean", "example": "true" } } } }, "TotalCount": { "title": "總記錄數", "description": "列表條目數。", "type": "integer", "format": "int32", "example": "1000" } } } } }, "eventInfo": { "enable": false, "eventNames": [] }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"MaxResults\\\": 50,\\n \\\"NextToken\\\": \\\"caeba0bbb2be03f8****\\\",\\n \\\"RequestId\\\": \\\"CEF72CEB-54B6-4AE8-B225-F876******\\\",\\n \\\"ServerGroups\\\": [\\n {\\n \\\"HealthCheckConfig\\\": {\\n \\\"HealthCheckConnectPort\\\": 80,\\n \\\"HealthCheckEnabled\\\": true,\\n \\\"HealthCheckHost\\\": \\\"www.example.com\\\",\\n \\\"HealthCheckCodes\\\": [\\n \\\"http_2xx\\\"\\n ],\\n \\\"HealthCheckHttpVersion\\\": \\\"HTTP1.1\\\",\\n \\\"HealthCheckInterval\\\": 5,\\n \\\"HealthCheckMethod\\\": \\\"HEAD\\\",\\n \\\"HealthCheckPath\\\": \\\"/test/index.html\\\",\\n \\\"HealthCheckProtocol\\\": \\\"HTTP\\\",\\n \\\"HealthCheckTimeout\\\": 3,\\n \\\"HealthyThreshold\\\": 4,\\n \\\"UnhealthyThreshold\\\": 4\\n },\\n \\\"Protocol\\\": \\\"HTTP\\\",\\n \\\"RelatedLoadBalancerIds\\\": [\\n \\\"alb-n5qw04uq8savfe****\\\"\\n ],\\n \\\"ResourceGroupId\\\": \\\"rg-atstuj3rtop****\\\",\\n \\\"Scheduler\\\": \\\"Wrr\\\",\\n \\\"ServerGroupId\\\": \\\"sgp-cige6j****\\\",\\n \\\"ServerGroupName\\\": \\\"Group3\\\",\\n \\\"ServerGroupStatus\\\": \\\"Available\\\",\\n \\\"ServerGroupType\\\": \\\"Instance\\\",\\n \\\"StickySessionConfig\\\": {\\n \\\"Cookie\\\": \\\"B490B5EBF6F3CD402E515D22BCDA****\\\",\\n \\\"CookieTimeout\\\": 1000,\\n \\\"StickySessionEnabled\\\": false,\\n \\\"StickySessionType\\\": \\\"Insert\\\"\\n },\\n \\\"VpcId\\\": \\\"vpc-bp15zckdt37pq72zv****\\\",\\n \\\"Tags\\\": [\\n {\\n \\\"Key\\\": \\\"Test\\\",\\n \\\"Value\\\": \\\"Test\\\"\\n }\\n ],\\n \\\"ConfigManagedEnabled\\\": false,\\n \\\"UpstreamKeepaliveEnabled\\\": false,\\n \\\"Ipv6Enabled\\\": false,\\n \\\"ServerCount\\\": 1,\\n \\\"ServiceName\\\": \\\"test\\\",\\n \\\"UchConfig\\\": {\\n \\\"Type\\\": \\\"QueryString\\\",\\n \\\"Value\\\": \\\"abc\\\"\\n },\\n \\\"CreateTime\\\": \\\"2022-07-02T02:49:05Z\\\",\\n \\\"ConnectionDrainConfig\\\": {\\n \\\"ConnectionDrainEnabled\\\": false,\\n \\\"ConnectionDrainTimeout\\\": 300\\n },\\n \\\"SlowStartConfig\\\": {\\n \\\"SlowStartEnabled\\\": false,\\n \\\"SlowStartDuration\\\": 30\\n },\\n \\\"CrossZoneEnabled\\\": true\\n }\\n ],\\n \\\"TotalCount\\\": 1000\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<ListServerGroupsResponse>\\n <MaxResults>50</MaxResults>\\n <NextToken>caeba0bbb2be03f8****</NextToken>\\n <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>\\n <ServerGroups>\\n <HealthCheckConfig>\\n <HealthCheckConnectPort>80</HealthCheckConnectPort>\\n <HealthCheckEnabled>true</HealthCheckEnabled>\\n <HealthCheckHost>www.example.com</HealthCheckHost>\\n <HealthCheckCodes>http_2xx</HealthCheckCodes>\\n <HealthCheckHttpVersion>HTTP1.1</HealthCheckHttpVersion>\\n <HealthCheckInterval>5</HealthCheckInterval>\\n <HealthCheckMethod>HEAD</HealthCheckMethod>\\n <HealthCheckPath>/test/index.html</HealthCheckPath>\\n <HealthCheckProtocol>HTTP</HealthCheckProtocol>\\n <HealthCheckTimeout>3</HealthCheckTimeout>\\n <HealthyThreshold>4</HealthyThreshold>\\n <UnhealthyThreshold>4</UnhealthyThreshold>\\n </HealthCheckConfig>\\n <Protocol>HTTP</Protocol>\\n <ResourceGroupId>rg-atstuj3rtop****</ResourceGroupId>\\n <Scheduler>Wrr</Scheduler>\\n <ServerGroupId>sgp-cige6j****</ServerGroupId>\\n <ServerGroupName>Group3</ServerGroupName>\\n <ServerGroupStatus>Available</ServerGroupStatus>\\n <ServerGroupType>Instance</ServerGroupType>\\n <StickySessionConfig>\\n <Cookie>B490B5EBF6F3CD402E515D22BCDA****</Cookie>\\n <CookieTimeout>1000</CookieTimeout>\\n <StickySessionEnabled>false</StickySessionEnabled>\\n <StickySessionType>Insert</StickySessionType>\\n </StickySessionConfig>\\n <VpcId>vpc-bp15zckdt37pq72zv****</VpcId>\\n <Tags>\\n <Key>Test</Key>\\n <Value>Test</Value>\\n </Tags>\\n <ConfigManagedEnabled>false</ConfigManagedEnabled>\\n <UpstreamKeepaliveEnabled>false</UpstreamKeepaliveEnabled>\\n <Ipv6Enabled>false</Ipv6Enabled>\\n <ServerCount>1</ServerCount>\\n <ServiceName>test</ServiceName>\\n <CreateTime>2023-03-21T07:43:10Z</CreateTime>\\n </ServerGroups>\\n <TotalCount>1000</TotalCount>\\n</ListServerGroupsResponse>\",\"errorExample\":\"\"}]", "title": "查詢服務器組" }, "ListServerGroupServers": { "summary": "查詢服務器組中的伺服器。", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "riskType": "none", "chargeType": "free", "abilityTreeCode": "167", "abilityTreeNodes": [ "FEATUREslbULKWF1" ] }, "parameters": [ { "name": "NextToken", "in": "query", "schema": { "title": "分頁查詢標識", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 第一次查詢和沒有下一次查詢時,均無需填寫。\n- 如果有下一次查詢,取值為上一次API調用返回的**NextToken**值。", "type": "string", "required": false, "example": "FFmyTO70tTpLG6I3FmYAXG****" } }, { "name": "MaxResults", "in": "query", "schema": { "title": "查詢數量", "description": "本次讀取的最巨量資料記錄數量。取值範圍:**1**~**100**,入參為空白時,預設值為**20**。", "type": "integer", "format": "int32", "required": false, "maximum": "1000", "minimum": "1", "example": "50", "default": "20" } }, { "name": "ServerGroupId", "in": "query", "schema": { "title": "伺服器組id", "description": "伺服器組ID。", "type": "string", "required": false, "example": "sgp-cb25e2i2vr******" } }, { "name": "ServerIds", "in": "query", "style": "flat", "schema": { "title": "伺服器id列表", "description": "伺服器ID列表。", "type": "array", "items": { "title": "伺服器id", "description": "伺服器ID。單次調用最多支援展示40個伺服器。\n\n- 當伺服器組為**Instance**類型時,該參數為Ecs、Eni、Eci的資源Id。\n- 當伺服器組為**Ip**類型時,該參數為IP地址。\n- 當伺服器組為**Fc**時,該參數為Function Compute的ARN標識。\n\n", "type": "string", "required": false, "example": "i-bp1e0u8f10by57wl****" }, "required": false, "maxItems": 20, "minItems": 1 } }, { "name": "Tag", "in": "query", "style": "flat", "schema": { "title": "伺服器組綁定的標籤列表", "description": "伺服器組綁定的標籤列表。一次請求中,綁定的標籤列表中最多支援10個標籤。", "type": "array", "items": { "title": "伺服器組綁定的標籤", "description": "伺服器組綁定的標籤列表。一次請求中,綁定的標籤列表中最多支援10個標籤。", "type": "object", "properties": { "Key": { "title": "標籤鍵", "description": "標籤鍵。最多支援10個標籤鍵。\n\n最多支援64個字元,不能以`aliyun`和`acs:`開頭,不能包含`http://`或者`https://`。", "type": "string", "required": false, "example": "Test" }, "Value": { "title": "標籤值", "description": "標籤值。最多支援10個標籤值。\n\n最多支援128個字元,不能以`aliyun`和`acs:`開頭,不能包含`http://`或者`https://`。", "type": "string", "required": false, "example": "Test" } }, "required": false }, "required": false } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": "返回資料結構體。", "type": "object", "properties": { "MaxResults": { "title": "本次查詢返回記錄數量", "description": "本次請求所返回的最大記錄條數。", "type": "integer", "format": "int32", "example": "50" }, "NextToken": { "title": "分頁查詢標識", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 如果**NextToken**為空白表示沒有下一次查詢。\n- 如果**NextToken**有傳回值,該取值表示下一次查詢開始的令牌。", "type": "string", "example": "caeba0bbb2be03f8****" }, "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "CEF72CEB-54B6-4AE8-B225-F876FF*****" }, "Servers": { "title": "後端伺服器列表", "description": "伺服器列表。", "type": "array", "items": { "title": "後端伺服器", "description": "後端伺服器描述結構體。", "type": "object", "properties": { "Description": { "title": "描述資訊", "description": "後端伺服器描述。", "type": "string", "example": "test" }, "Port": { "title": "連接埠", "description": "後端伺服器使用的連接埠。取值範圍:**1**~**65535**。", "type": "integer", "format": "int32", "example": "80" }, "ServerId": { "title": "伺服器id", "description": "後端伺服器ID。\n\n>當**ServerType**為**Fc**時,**ServerId**為Function Compute的ARN標識。", "type": "string", "example": "i-bp1f9kdprbgy9uiu****" }, "ServerIp": { "title": "伺服器ip", "description": "指定的IP地址。", "type": "string", "example": "192.168.XX.XX" }, "ServerType": { "title": "後端伺服器類型", "description": "後端伺服器類型。", "type": "string", "example": "Ecs" }, "Status": { "title": "狀態", "description": "後端伺服器的添加狀態。取值:\n\n- **Adding**:添加中。\n- **Available**:正常可用狀態。\n- **Configuring**:配置中。\n- **Removing**:移除中。", "type": "string", "example": "Available" }, "Weight": { "title": "權重", "description": "後端伺服器的權重。權重越高的伺服器將被分配到更多的訪問請求。", "type": "integer", "format": "int32", "example": "100" }, "ServerGroupId": { "title": "伺服器組id", "description": "伺服器組ID。", "type": "string", "example": "sgp-qy042e1jabmprh****" }, "RemoteIpEnabled": { "title": "是否是遠端ip", "description": "是否開啟遠端IP。取值:\n \n- **true**:是。\n- **false**:否。", "type": "boolean", "example": "true" } } } }, "TotalCount": { "title": "總記錄數", "description": "本次請求條件下的資料總量。", "type": "integer", "format": "int32", "example": "3" } } } } }, "errorCodes": { "403": [ { "errorCode": "Forbidden.ServerGroup", "errorMessage": "Authentication has failed for ServerGroup." } ] }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"MaxResults\\\": 50,\\n \\\"NextToken\\\": \\\"caeba0bbb2be03f8****\\\",\\n \\\"RequestId\\\": \\\"CEF72CEB-54B6-4AE8-B225-F876FF*****\\\",\\n \\\"Servers\\\": [\\n {\\n \\\"Description\\\": \\\"test\\\",\\n \\\"Port\\\": 80,\\n \\\"ServerId\\\": \\\"i-bp1f9kdprbgy9uiu****\\\",\\n \\\"ServerIp\\\": \\\"192.168.XX.XX\\\",\\n \\\"ServerType\\\": \\\"Ecs\\\",\\n \\\"Status\\\": \\\"Available\\\",\\n \\\"Weight\\\": 100,\\n \\\"ServerGroupId\\\": \\\"sgp-qy042e1jabmprh****\\\",\\n \\\"RemoteIpEnabled\\\": true\\n }\\n ],\\n \\\"TotalCount\\\": 3\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<ListServerGroupServersResponse>\\n <MaxResults>50</MaxResults>\\n <NextToken>caeba0bbb2be03f8****</NextToken>\\n <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>\\n <Servers>\\n <Description>test</Description>\\n <Port>80</Port>\\n <ServerId>i-bp1f9kdprbgy9uiu****</ServerId>\\n <ServerIp>192.168.XX.XX</ServerIp>\\n <ServerType>Ecs</ServerType>\\n <Status>Available</Status>\\n <Weight>100</Weight>\\n <ServerGroupId>sgp-qy042e1jabmprh****</ServerGroupId>\\n <RemoteIpEnabled>true</RemoteIpEnabled>\\n </Servers>\\n <TotalCount>3</TotalCount>\\n</ListServerGroupServersResponse>\",\"errorExample\":\"\"}]", "title": "查詢服務器" }, "ListRules": { "summary": "查詢指定地區的轉寄規則。", "methods": [ "get", "post" ], "schemes": [ "http", "https" ], "security": [ { "AK": [] } ], "operationType": "read", "deprecated": false, "systemTags": { "operationType": "get", "riskType": "none", "chargeType": "free", "abilityTreeNodes": [ "FEATUREslbM7ALO6" ] }, "parameters": [ { "name": "NextToken", "in": "query", "schema": { "title": "用來標記當前開始讀取的位置,置空表示從頭開始。", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n\n- 第一次查詢和沒有下一次查詢時,均無需填寫。\n\n- 如果有下一次查詢,取值為上一次API調用返回的**NextToken**值。", "type": "string", "required": false, "example": "FFmyTO70tTpLG6I3FmYAXGKPd****" } }, { "name": "MaxResults", "in": "query", "schema": { "title": "本次讀取的最巨量資料記錄數量,此參數為選擇性參數,取值1-100,使用者傳入為空白時,預設為20。", "description": "本次讀取的最巨量資料記錄數。\n\n取值:**1~100**。\n\n預設值:**20**,表示使用者沒有傳入資料。\n\n> 此參數為可選。", "type": "integer", "format": "int32", "required": false, "example": "20" } }, { "name": "RuleIds", "in": "query", "style": "flat", "schema": { "title": "轉寄規則ID列表,N最大支援20", "description": "轉寄規則列表,一次最多支援查詢20個轉寄規則。", "type": "array", "items": { "description": "轉寄規則ID。", "type": "string", "required": false, "example": "rule-sada******" }, "required": false, "maxItems": 20, "minItems": 1 } }, { "name": "ListenerIds", "in": "query", "style": "flat", "schema": { "title": "監聽ID列表", "description": "監聽ID列表。一次最多支援查詢20個監聽。", "type": "array", "items": { "description": "監聽ID。", "type": "string", "required": false, "example": "lsn-i35udpz3pxsmnf****" }, "required": false, "maxItems": 20 } }, { "name": "LoadBalancerIds", "in": "query", "style": "flat", "schema": { "title": "執行個體ID列表", "description": "Server Load Balancer執行個體ID列表。一次最多支援查詢20個執行個體。", "type": "array", "items": { "description": "Server Load Balancer執行個體ID。", "type": "string", "required": false, "example": "alb-x30o38azsuj0sx****" }, "required": false, "maxItems": 20 } }, { "name": "Direction", "in": "query", "schema": { "title": "轉寄規則方向", "description": "轉寄規則的方向。取值:\n\n- **Request**(預設值):請求類型,對從用戶端發送到ALB的報文進行條件匹配並進行相應的處理。\n\n- **Response**:響應類型,對從後端伺服器組返回到ALB的報文進行條件匹配並進行相應的處理。\n\n>基礎版的ALB執行個體不支援Response類型.", "type": "string", "required": false, "example": "Request" } }, { "name": "Tag", "in": "query", "style": "flat", "schema": { "description": "標籤。", "type": "array", "items": { "description": "標籤結構。", "type": "object", "properties": { "Key": { "description": "標籤鍵。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "required": false, "example": "env" }, "Value": { "description": "標籤值。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "required": false, "example": "product" } }, "required": false }, "required": false, "maxItems": 20 } } ], "responses": { "200": { "schema": { "title": "Schema of Response", "description": "轉寄規則。", "type": "object", "properties": { "MaxResults": { "title": "本次請求所返回的最大記錄條數。", "description": "本次請求所返回的最大記錄條數。", "type": "integer", "format": "int32", "example": "50" }, "NextToken": { "title": "用來表示當前調用返回讀取到的位置,空代表資料已經讀取完畢。", "description": "是否擁有下一次查詢的令牌(Token)。取值:\n- 如果**NextToken**為空白表示沒有下一次查詢。\n- 如果**NextToken**有傳回值,該取值表示下一次查詢開始的令牌。", "type": "string", "example": "FFmyTO70tTpLG6I3FmYAXGKPd****" }, "RequestId": { "title": "Id of the request", "description": "請求ID。", "type": "string", "example": "CEF72CEB-54B6-4AE8-B225-F876F******" }, "Rules": { "title": "轉寄規則列表", "description": "轉寄規則列表。", "type": "array", "items": { "description": "轉寄規則結構。", "type": "object", "properties": { "ListenerId": { "title": "監聽ID", "description": "轉寄規則所屬監聽ID。", "type": "string", "example": "lsn-i35udpz3pxsmnf****" }, "LoadBalancerId": { "title": "執行個體ID", "description": "轉寄規則所屬Server Load Balancer執行個體ID。", "type": "string", "example": "alb-x30o38azsuj0sx****" }, "Priority": { "title": "轉寄規則優先順序", "description": "規則優先順序,取值為**1~10000**。值越小表示優先順序越高。\n\n> 同一個監聽內規則優先順序必須唯一。", "type": "integer", "format": "int32", "example": "1" }, "RuleActions": { "title": "轉寄規則動作", "description": "轉寄規則動作列表。", "type": "array", "items": { "description": "轉寄規則動作結構。", "type": "object", "properties": { "FixedResponseConfig": { "title": "返回固定內容動作配置", "description": "固定響應內容配置。", "type": "object", "properties": { "Content": { "title": "內容", "description": "返回的固定內容。最大1 KB位元組,只支援ASCII字元。", "type": "string", "example": "dssacav" }, "ContentType": { "title": "內容類型", "description": "返回固定內容的格式。\n\n取值:**text/plain**、**text/css**、**text/html**、**application/javascript**或**application/json**。", "type": "string", "example": "text/plain" }, "HttpCode": { "title": "HTTP響應碼", "description": "返回的HTTP響應碼,僅支援**HTTP_2xx**、**HTTP_4xx**、**HTTP_5xx**數字型字串,**x**為任一數字。", "type": "string", "example": "HTTP_2xx" } } }, "ForwardGroupConfig": { "title": "轉寄組動作配置", "description": "轉寄組配置。", "type": "object", "properties": { "ServerGroupTuples": { "title": "轉寄到的目的伺服器組列表", "description": "轉寄到的目的伺服器組列表。", "type": "array", "items": { "description": "轉寄到的目的伺服器組列表。", "type": "object", "properties": { "ServerGroupId": { "title": "伺服器組標識", "description": "轉寄到的目的伺服器組ID。", "type": "string", "example": "sgp-atstuj3rtoptyui****" }, "Weight": { "title": "當ServerGroupTuple.N數量大於1時,可配置每個伺服器組的權重", "description": "權重。取值範圍:**0**~**100**。", "type": "integer", "format": "int32", "example": "2" } } } }, "ServerGroupStickySession": { "title": "伺服器組間會話保持配置", "description": "伺服器組間會話保持配置", "type": "object", "properties": { "Enabled": { "title": "當ServerGroupTuple.N數量大於1時,可選是否開啟在伺服器組間的會話保持", "description": "當ServerGroupTuple.N數量大於1時,可選是否開啟在伺服器組間的會話保持", "type": "boolean" }, "Timeout": { "title": "當Enabled=True時,可以配置會話保持的逾時時間", "description": "當Enabled=True時,可以配置會話保持的逾時時間", "type": "integer", "format": "int32", "example": "100" } } } } }, "InsertHeaderConfig": { "title": "插入頭部動作配置", "description": "寫入頭欄位配置。", "type": "object", "properties": { "Key": { "title": "HTTP標題", "description": "插入的頭欄位名稱,長度為1\\~40個字元,支援大小寫字母a\\~z、數字、底線(_)和短劃線(-)。頭欄位名稱不能重複用於`InsertHeader`中。\n\n> 不允許使用者在頭欄位名稱中使用**Cookie**和**Host**。", "type": "string", "example": "key" }, "Value": { "title": "HTTP標題內容", "description": "插入的頭欄位內容。\n\n- **ValueType**取值為**SystemDefined**時取值如下:\n - **ClientSrcPort**:用戶端連接埠。\n - **ClientSrcIp**:用戶端IP地址。\n - **Protocol**:用戶端請求的協議(HTTP或HTTPS)。\n - **SLBId**:應用型Server Load Balancer執行個體ID。\n - **SLBPort**:應用型Server Load Balancer執行個體監聽連接埠。\n- **ValueType**取值為**UserDefined**時:您可自訂頭欄位內容,限制長度為1\\~128個字元,支援萬用字元星號(*)、半形問號(?)和ASCII碼值`ch >= 32 && ch < 127`範圍內的可列印字元,開頭和結尾不可為空格。\n- **ValueType**取值為**ReferenceHeader**時:您可以引用要求標頭欄位中的某一個欄位,限制長度限制為1\\~128個字元,支援小寫字母a\\~z、數字、短劃線(-)和底線(_)。", "type": "string", "example": "ClientSrcPort" }, "ValueType": { "title": "取實值型別", "description": "頭欄位內容類型。取值:\n\n- **UserDefined**:使用者指定。\n\n- **ReferenceHeader**:引用使用者要求標頭中的某一個欄位。\n\n- **SystemDefined**:系統定義。", "type": "string", "example": "SystemDefined" } } }, "Order": { "title": "優先順序", "description": "轉寄規則動作執行的順序,取值為**1~50000**,按值從小到大執行動作。值不可為空,不能重複。", "type": "integer", "format": "int32", "example": "1" }, "RedirectConfig": { "title": "重新導向動作配置", "description": "重新導向配置。", "type": "object", "properties": { "Host": { "title": "要跳轉的主機地址", "description": "要跳轉的主機地址。取值:\n- **${host}**(預設值):取此值時不支援和其他字元拼接使用。\n- 其他取值,字元集和格式限制如下:\n - 主機名稱長度為3\\~128個字元,支援小寫字母a\\~z、數字、短劃線(-)、半形句號(.)以及萬用字元星號(*)和半形問號(?)。\n - 主機名稱至少包含一個半形句號(.),且半形句號(.)不能出現在開頭或結尾。\n - 最右側的域標籤只能包含字母和萬用字元,不能包含數字或短劃線(-)。\n - 短劃線(-)不能出現在其它域標籤的開頭或結尾。\n - 萬用字元星號(*)和半形問號(?)可以出現在域標籤的任意位置。", "type": "string", "example": "www.example.com" }, "HttpCode": { "title": "跳轉方式", "description": "跳轉方式,取值為**301**、**302**、**303**、**307**或**308**。", "type": "string", "example": "301" }, "Path": { "title": "要跳轉的路徑", "description": "要跳轉的路徑。取值:\n- **${path}**(預設值):可以引用**${host}**、**${protocol}**和**${port}**,由**${host}**、**${protocol}**和**${port}**組成,每個變數最多出現一次。上述變數可以同時使用,也可以和下面羅列的可取值範圍內的字串拼接使用。\n- 其他取值,字元集和格式限制如下:\n - 長度為1~128個字元。\n - 必須以正斜線(/)開頭,支援字母、數字和特殊字元`$-_.+/&~@:`,不支援`“%#;!()[]^,” `,同時支援萬用字元星號(*)和半形問號(?)。", "type": "string", "example": "/test" }, "Port": { "title": "要跳轉的連接埠", "description": "要跳轉的連接埠。取值:\n- **${port}**(預設值):該取值不支援和其他字元同時使用。\n- 其他取值:**1~63335**。", "type": "string", "example": "10" }, "Protocol": { "title": "要跳轉的協議", "description": "要跳轉的協議。取值:\n- **${protocol}**(預設值):取該值時不支援和其他字元拼接使用。\n- **HTTP**或**HTTPS**。\n\n \n> HTTPS監聽僅支援跳轉HTTPS協議。", "type": "string", "example": "HTTP" }, "Query": { "title": "要跳轉的查詢字串", "description": "要跳轉的查詢字串。長度為1~128個字元,支援小寫字母和可見字元,不支援 `#[]{}\\|<>&`。\n", "type": "string", "example": "quert" } } }, "RemoveHeaderConfig": { "title": "去除HTTP標題", "description": "去除HTTP頭部配置。", "type": "object", "properties": { "Key": { "title": "HTTP標題", "description": "去除的頭欄位名稱,長度為1\\~40個字元,支援大小寫字母a~z、數字、底線(_)和短劃線(-)。頭欄位名稱不能重複用於RemoveHeader中。\n\n* 請求方向(Direction取值為Request):不允許將頭名稱設定為以下欄位(不區分大小寫):`slb-id`、`slb-ip`、`x-forwarded-for`、`x-forwarded-proto`、`x-forwarded-eip`、`x-forwarded-port`、`x-forwarded-client-srcport`、`connection`、`upgrade`、`content-length`、`transfer-encoding`、`keep-alive`、`te`、`host`、`cookie`、`remoteip`、`authority`。\n* 回應程式向(Direction取值為Response):回應程式向不允許將頭名稱設定為以下欄位(不區分大小寫):`connection`、`upgrade`、`content-length`、`transfer-encoding`。", "type": "string", "example": "key" } } }, "RewriteConfig": { "title": "內部重新導向動作配置", "description": "重寫配置。", "type": "object", "properties": { "Host": { "title": "主機名稱", "description": "要跳轉的主機地址。取值:\n- **${host}**(預設值):取此值時不支援和其他字元拼接使用。\n- 其他取值,字元集和格式限制如下:\n - 主機名稱長度為3\\~128個字元,支援小寫字母a\\~z、數字、短劃線(-)、半形句號(.)以及萬用字元星號(*)和半形問號(?)。\n - 主機名稱至少包含一個半形句號(.),且半形句號(.)不能出現在開頭或結尾。\n - 最右側的域標籤只能包含字母和萬用字元,不能包含數字或短劃線(-)。\n - 短劃線(-)不能出現在其它域標籤的開頭或結尾。\n - 萬用字元星號(*)和半形問號(?)可以出現在域標籤的任意位置。", "type": "string", "example": "www.example.com" }, "Path": { "title": "路徑", "description": "內部跳轉的目的路徑。長度為1~128個字元,以正斜線(/)開頭,支援字母、數字、星號(*)、半形問號(?)和`$-_.+/&~@:`,不支援`“%#;!()[]^,” `。", "type": "string", "example": "/tsdf" }, "Query": { "title": "查詢", "description": "內部跳轉的查詢字串。長度為1~128個字元,支援小寫字母和可見字元,不支援 `#[]{}\\|<>&`。\n\n", "type": "string", "example": "quedsa" } } }, "TrafficMirrorConfig": { "title": "流量鏡像Action對應的配置,type為TrafficMirror時必填且有效", "description": "流量鏡像。", "type": "object", "properties": { "TargetType": { "title": "流量鏡像的目的,可以是伺服器組", "description": "流量鏡像的目的,可以是伺服器組", "type": "string", "example": "ForwardGroupMirror" }, "MirrorGroupConfig": { "title": "TargetType為伺服器組時必選,目標伺服器組", "description": "流量鏡像至伺服器組。", "type": "object", "properties": { "ServerGroupTuples": { "description": "流量鏡像至伺服器組。", "type": "array", "items": { "type": "object", "properties": { "ServerGroupId": { "description": "伺服器組ID。", "type": "string", "example": "sgp-00mkgijak0w4qgz9****" }, "Weight": { "description": "權重。取值範圍:**0**~**100**。", "type": "integer", "format": "int32", "example": "2" } } } } } } } }, "TrafficLimitConfig": { "description": "流量限速。", "type": "object", "properties": { "QPS": { "description": "每秒請求次數。取值範圍:**1**~**100000**。", "type": "integer", "format": "int32", "example": "4" }, "PerIpQps": { "description": "單IP每秒請求次數。 取值範圍:**1 ~ 100000**。\n\n> 如果同時配置**QPS**參數,**PerIpQps**參數的取值必須小於**QPS**參數的取值。", "type": "integer", "format": "int32", "example": "80" } } }, "Type": { "title": "轉寄規則動作類型", "description": "動作類型。取值:\n\n- **ForwardGroup**:轉寄至多個虛擬伺服器組。\n\n- **Redirect**:重新導向。\n\n- **FixedResponse**:返回固定內容。\n\n- **Rewrite**:重寫。\n\n- **InsertHeader**:寫入頭欄位。\n\n- **RemoveHeaderConfig**:刪除頭欄位。\n\n- **TrafficLimitConfig**:流量限速。\n\n- **TrafficMirrorConfig**:流量鏡像。\n\n- **CorsConfig**:跨域。", "type": "string", "example": "ForwardGroup" }, "CorsConfig": { "title": "跨域", "description": "跨域。", "type": "object", "properties": { "AllowOrigin": { "title": "允許的訪問來源", "description": "允許的訪問來源。", "type": "array", "items": { "description": "允許訪問的來源。支援配置為`*`或配置為一個或多個value值。value的值不能為`*`。\n\n- 單個value值必須以`http://`或者`https://`開頭,後面加一個正確的網域名稱或者一級的泛網域名稱(例如,`*.test.abc.example.com`)。\n- 單個value值可以不加連接埠,也可以指定連接埠,連接埠範圍:**1**~**65535**。", "type": "string", "example": "http://test.com" } }, "AllowMethods": { "title": "選擇跨域訪問時允許的HTTP方法", "description": "選擇跨域訪問時允許的HTTP方法。", "type": "array", "items": { "description": "選擇跨域訪問時允許的HTTP方法。取值:\n- **GET**。\n- **POST**。\n- **PUT**。\n- **DELETE**。\n- **HEAD**。\n- **OPTIONS**。\n- **PATCH**。", "type": "string", "example": "GET" } }, "AllowHeaders": { "title": "允許跨域的Header列表", "description": "允許跨域的Header列表。", "type": "array", "items": { "description": "允許跨域的Header列表。支援配置為`*`或配置一個或多個value值,多個value值用半形逗號(,)隔開。單個value值只允許包含大小寫字母、數字,以及不在首尾的底線(_)和短劃線(-),最大長度限制為32個字元。", "type": "string", "example": "test_123" } }, "ExposeHeaders": { "title": "允許暴露的Header列表", "description": "允許暴露的Header列表。", "type": "array", "items": { "description": "允許跨域的Header列表。支援配置為`*`或配置一個或多個value值,多個value值用半形逗號(,)隔開。單個value值只允許包含大小寫字母、數字,以及不在首尾的底線(_)和短劃線(-),最大長度限制為32個字元。", "type": "string", "example": "test_123" } }, "AllowCredentials": { "title": "是否允許攜帶憑證資訊", "description": "是否允許攜帶憑證資訊。取值:\n\n- **on**:是。\n- **off**:否。", "type": "string", "example": "on" }, "MaxAge": { "title": "預檢請求在瀏覽器的最大緩衝時間", "description": "預檢請求在瀏覽器的最大緩衝時間,單位:秒。\n\n取值範圍:**-1**~**172800**。", "type": "integer", "format": "int64", "example": "1000" } } } } } }, "RuleConditions": { "title": "轉寄規則條件", "description": "轉寄規則條件列表。", "type": "array", "items": { "description": "轉寄規則條件結構。", "type": "object", "properties": { "CookieConfig": { "title": "Cookie條件配置", "description": "Cookie配置。", "type": "object", "properties": { "Values": { "title": "Cookie索引值對列表", "description": "Cookie值。", "type": "array", "items": { "description": "Cookie值。", "type": "object", "properties": { "Key": { "title": "Cookie條件鍵", "description": "Cookie鍵。長度為1~100個字元,支援小寫字母、可見字元、星號(*)和半形問號(?),不支援空格和`#[]{}\\|<>&`。", "type": "string", "example": "test" }, "Value": { "title": "Cookie條件值", "description": "Cookie值。長度為1~128個字元,支援小寫字母、可見字元、星號(*)和半形問號(?),不支援空格和`#[]{}\\|<>&`。", "type": "string", "example": "test" } } } } } }, "HeaderConfig": { "title": "HTTP標題條件配置", "description": "頭欄位配置。", "type": "object", "properties": { "Key": { "title": "HTTP標題鍵", "description": "頭欄位鍵。長度為1\\~40個字元。支援字母a\\~z、數字、短劃線(-)和底線(_)。不支援Cookie和Host。", "type": "string", "example": "Port" }, "Values": { "title": "HTTP標題值列表", "description": "頭欄位值。", "type": "array", "items": { "description": "頭欄位值。長度為1\\~128個字元。支援ASCII碼值`ch >= 32 && ch < 127`範圍內可列印字元、小寫字母、星號(*)和半形問號(?)。開頭和結尾不可為空格。", "type": "string", "example": "5006" } } } }, "HostConfig": { "title": "主機名稱條件配置", "description": "主機配置。", "type": "object", "properties": { "Values": { "title": "主機名稱列表", "description": "主機名稱。", "type": "array", "items": { "description": "主機名稱。命名規則:\n\n- 網域名稱長度為3\\~128個字元,支援小寫字母a\\~z、數字、短劃線(-)、半形句號(.)、星號(*)和半形問號(?)。\n\n- 網域名稱至少包含一個半形句號(.),且半形句號(.)不能出現在開頭或結尾。\n\n- 最右側的域標籤只能包含字母、星號(*)和半形問號(?),不能包含數字或短劃線(-)。\n\n- 短劃線(-)不能出現在其它域標籤的開頭或結尾。星號(*)和半形問號(?)可以出現在域標籤的任意位置。", "type": "string", "example": "www.example.com" } } } }, "MethodConfig": { "title": "HTTP要求方法條件配置", "description": "要求方法配置。", "type": "object", "properties": { "Values": { "title": "HTTP要求方法列表", "description": "要求方法。", "type": "array", "items": { "description": "要求方法。\n\n取值:**HEAD**、**GET**、**POST**、**OPTIONS**、**PUT**、**PATCH**或**DELETE**。", "type": "string", "example": "PUT" } } } }, "PathConfig": { "title": "路徑條件配置", "description": "轉寄路徑配置。", "type": "object", "properties": { "Values": { "title": "路徑條件列表", "description": "轉寄路徑。", "type": "array", "items": { "description": "轉寄路徑。長度為1~128個字元,以正斜線(/)開頭,支援字母、數字、星號(*)、半形問號(?)和`$-_.+/&~@:`,不支援`“%#;!()[]^,” `。", "type": "string", "example": "/test" } } } }, "QueryStringConfig": { "title": "查詢字串條件配置", "description": "查詢字串配置。", "type": "object", "properties": { "Values": { "title": "查詢字串條件索引值對列表", "description": "查詢字串。", "type": "array", "items": { "description": "查詢字串。", "type": "object", "properties": { "Key": { "title": "查詢字串條件鍵", "description": "查詢字串鍵。長度為1~100個字元,支援小寫字母、可見字元、星號(*)和半形問號(?),不支援空格和`#[]{}\\|<>&`。", "type": "string", "example": "test" }, "Value": { "title": "查詢字串條件值", "description": "查詢字串值。長度為1~128個字元,支援小寫字母、可見字元、星號(*)和半形問號(?),不支援空格和`#[]{}\\|<>&`。", "type": "string", "example": "test" } } } } } }, "SourceIpConfig": { "title": "源IP業務流量匹配", "description": "基於源IP業務流量匹配。", "type": "object", "properties": { "Values": { "title": "需要匹配的源IP列表", "description": "需要匹配的源IP列表。", "type": "array", "items": { "description": "添加一個或多個IP地址或者IP位址區段。\n\n一條轉寄規則中最多支援添加5條源IP。", "type": "string", "example": "192.168.XX.XX/32" } } } }, "ResponseStatusCodeConfig": { "title": "返回狀態代碼條件", "description": "響應狀態代碼配置。", "type": "object", "properties": { "Values": { "title": "返回狀態代碼條件列表", "description": "響應狀態代碼列表。", "type": "array", "items": { "description": "響應狀態代碼。", "type": "string", "example": "200" } } } }, "ResponseHeaderConfig": { "title": "返回HTTP標題", "description": "響應HTTP頭部配置。", "type": "object", "properties": { "Key": { "title": "返回HTTP標題鍵", "description": "響應HTTP頭部鍵。長度為1\\~40個字元。支援字母a~z、數字、短劃線(-)和底線(_)。不支援Cookie和Host。", "type": "string", "example": "key" }, "Values": { "title": "返回HTTP標題值", "description": "響應HTTP頭部值列表。", "type": "array", "items": { "description": "響應HTTP頭部值。長度為1~128個字元。", "type": "string", "example": "value" } } } }, "Type": { "title": "條件類型", "description": "轉寄規則類型。取值:\n\n- **Host**:主機。\n\n- **Path**:路徑。\n\n- **Header**:HTTP頭欄位。\n\n- **QueryString**:查詢字串。\n\n- **Method**:要求方法。\n\n- **Cookie**:Cookie。\n\n- **SourceIp**:源IP。", "type": "string", "example": "Host" } }, "required": true } }, "RuleId": { "title": "轉寄規則標識", "description": "轉寄規則ID。", "type": "string", "example": "rule-bpn0kn908w4nbw****" }, "RuleName": { "title": "轉寄規則名稱", "description": "轉寄規則名稱。 長度為2~128個英文或中文字元,必須以大小字母或中文開頭,可包含數字,半形句號(.),底線(_)和短劃線(-)。", "type": "string", "example": "rule-instance-test" }, "RuleStatus": { "title": "轉寄規則狀態", "description": "轉寄規則狀態。取值:\n\n- **Provisioning**:建立中。\n\n- **Configuring**:變更配置中。\n\n- **Available**:運行中。", "type": "string", "example": "Available" }, "Direction": { "title": "轉寄規則方向", "description": "轉寄規則的方向。取值:\n\n* Request(預設值):請求類型,對從用戶端發送到ALB的報文進行條件匹配並進行相應的處理。\n\n* Response:響應類型,對從後端伺服器組返回到ALB的報文進行條件匹配並進行相應的處理。\n\n> 基礎版的ALB執行個體不支援Response類型。", "type": "string", "example": "Request" }, "Tags": { "description": "標籤。", "type": "array", "items": { "description": "標籤結構。", "type": "object", "properties": { "Key": { "description": "標籤鍵。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "example": "env" }, "Value": { "description": "標籤值。最多支援128個字元,不能以aliyun或acs:開頭,不能包含http://或https://。", "type": "string", "example": "product" } } } } } } }, "TotalCount": { "title": "本次請求條件下的資料總量。", "description": "本次請求條件下返回的總資料記錄數。", "type": "integer", "format": "int32", "example": "1000" } } } } }, "errorCodes": { "403": [ { "errorCode": "Forbidden.LoadBalancer", "errorMessage": "Authentication is failed for %s." } ] }, "responseDemo": "[{\"type\":\"json\",\"example\":\"{\\n \\\"MaxResults\\\": 50,\\n \\\"NextToken\\\": \\\"FFmyTO70tTpLG6I3FmYAXGKPd****\\\",\\n \\\"RequestId\\\": \\\"CEF72CEB-54B6-4AE8-B225-F876F******\\\",\\n \\\"Rules\\\": [\\n {\\n \\\"ListenerId\\\": \\\"lsn-i35udpz3pxsmnf****\\\",\\n \\\"LoadBalancerId\\\": \\\"alb-x30o38azsuj0sx****\\\",\\n \\\"Priority\\\": 1,\\n \\\"RuleActions\\\": [\\n {\\n \\\"FixedResponseConfig\\\": {\\n \\\"Content\\\": \\\"dssacav\\\",\\n \\\"ContentType\\\": \\\"text/plain\\\",\\n \\\"HttpCode\\\": \\\"HTTP_2xx\\\"\\n },\\n \\\"ForwardGroupConfig\\\": {\\n \\\"ServerGroupTuples\\\": [\\n {\\n \\\"ServerGroupId\\\": \\\"sgp-atstuj3rtoptyui****\\\",\\n \\\"Weight\\\": 2\\n }\\n ],\\n \\\"ServerGroupStickySession\\\": {\\n \\\"Enabled\\\": true,\\n \\\"Timeout\\\": 100\\n }\\n },\\n \\\"InsertHeaderConfig\\\": {\\n \\\"Key\\\": \\\"key\\\",\\n \\\"Value\\\": \\\"ClientSrcPort\\\",\\n \\\"ValueType\\\": \\\"SystemDefined\\\"\\n },\\n \\\"Order\\\": 1,\\n \\\"RedirectConfig\\\": {\\n \\\"Host\\\": \\\"www.example.com\\\",\\n \\\"HttpCode\\\": \\\"301\\\",\\n \\\"Path\\\": \\\"/test\\\",\\n \\\"Port\\\": \\\"10\\\",\\n \\\"Protocol\\\": \\\"HTTP\\\",\\n \\\"Query\\\": \\\"quert\\\"\\n },\\n \\\"RemoveHeaderConfig\\\": {\\n \\\"Key\\\": \\\"key\\\"\\n },\\n \\\"RewriteConfig\\\": {\\n \\\"Host\\\": \\\"www.example.com\\\",\\n \\\"Path\\\": \\\"/tsdf\\\",\\n \\\"Query\\\": \\\"quedsa\\\"\\n },\\n \\\"TrafficMirrorConfig\\\": {\\n \\\"TargetType\\\": \\\"ForwardGroupMirror\\\",\\n \\\"MirrorGroupConfig\\\": {\\n \\\"ServerGroupTuples\\\": [\\n {\\n \\\"ServerGroupId\\\": \\\"sgp-00mkgijak0w4qgz9****\\\",\\n \\\"Weight\\\": 2\\n }\\n ]\\n }\\n },\\n \\\"TrafficLimitConfig\\\": {\\n \\\"QPS\\\": 4,\\n \\\"PerIpQps\\\": 80\\n },\\n \\\"Type\\\": \\\"ForwardGroup\\\",\\n \\\"CorsConfig\\\": {\\n \\\"AllowOrigin\\\": [\\n \\\"http://test.com\\\"\\n ],\\n \\\"AllowMethods\\\": [\\n \\\"GET\\\"\\n ],\\n \\\"AllowHeaders\\\": [\\n \\\"test_123\\\"\\n ],\\n \\\"ExposeHeaders\\\": [\\n \\\"test_123\\\"\\n ],\\n \\\"AllowCredentials\\\": \\\"on\\\",\\n \\\"MaxAge\\\": 1000\\n }\\n }\\n ],\\n \\\"RuleConditions\\\": [\\n {\\n \\\"CookieConfig\\\": {\\n \\\"Values\\\": [\\n {\\n \\\"Key\\\": \\\"test\\\",\\n \\\"Value\\\": \\\"test\\\"\\n }\\n ]\\n },\\n \\\"HeaderConfig\\\": {\\n \\\"Key\\\": \\\"Port\\\",\\n \\\"Values\\\": [\\n \\\"5006\\\"\\n ]\\n },\\n \\\"HostConfig\\\": {\\n \\\"Values\\\": [\\n \\\"www.example.com\\\"\\n ]\\n },\\n \\\"MethodConfig\\\": {\\n \\\"Values\\\": [\\n \\\"PUT\\\"\\n ]\\n },\\n \\\"PathConfig\\\": {\\n \\\"Values\\\": [\\n \\\"/test\\\"\\n ]\\n },\\n \\\"QueryStringConfig\\\": {\\n \\\"Values\\\": [\\n {\\n \\\"Key\\\": \\\"test\\\",\\n \\\"Value\\\": \\\"test\\\"\\n }\\n ]\\n },\\n \\\"SourceIpConfig\\\": {\\n \\\"Values\\\": [\\n \\\"192.168.XX.XX/32\\\"\\n ]\\n },\\n \\\"ResponseStatusCodeConfig\\\": {\\n \\\"Values\\\": [\\n \\\"200\\\"\\n ]\\n },\\n \\\"ResponseHeaderConfig\\\": {\\n \\\"Key\\\": \\\"key\\\",\\n \\\"Values\\\": [\\n \\\"value\\\"\\n ]\\n },\\n \\\"Type\\\": \\\"Host\\\"\\n }\\n ],\\n \\\"RuleId\\\": \\\"rule-bpn0kn908w4nbw****\\\",\\n \\\"RuleName\\\": \\\"rule-instance-test\\\",\\n \\\"RuleStatus\\\": \\\"Available\\\",\\n \\\"Direction\\\": \\\"Request\\\",\\n \\\"Tags\\\": [\\n {\\n \\\"Key\\\": \\\"env\\\",\\n \\\"Value\\\": \\\"product\\\"\\n }\\n ]\\n }\\n ],\\n \\\"TotalCount\\\": 1000\\n}\",\"errorExample\":\"\"},{\"type\":\"xml\",\"example\":\"<ListRulesResponse>\\n <MaxResults>50</MaxResults>\\n <NextToken>FFmyTO70tTpLG6I3FmYAXGKPd****</NextToken>\\n <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>\\n <Rules>\\n <ListenerId>lsn-i35udpz3pxsmnf****</ListenerId>\\n <LoadBalancerId>alb-x30o38azsuj0sx****</LoadBalancerId>\\n <Priority>1</Priority>\\n <RuleActions>\\n <FixedResponseConfig>\\n <Content>dssacav</Content>\\n <ContentType>text/plain</ContentType>\\n <HttpCode>HTTP_2xx</HttpCode>\\n </FixedResponseConfig>\\n <ForwardGroupConfig>\\n <ServerGroupTuples>\\n <ServerGroupId>sg-atstuj3rtoptyui****</ServerGroupId>\\n <Weight>2</Weight>\\n </ServerGroupTuples>\\n </ForwardGroupConfig>\\n <InsertHeaderConfig>\\n <Key>key</Key>\\n <Value>ClientSrcPort</Value>\\n <ValueType>SystemDefined</ValueType>\\n </InsertHeaderConfig>\\n <Order>1</Order>\\n <RedirectConfig>\\n <Host>www.example.com</Host>\\n <HttpCode>301</HttpCode>\\n <Path>/test</Path>\\n <Port>10</Port>\\n <Protocol>HTTP</Protocol>\\n <Query>quert</Query>\\n </RedirectConfig>\\n <RewriteConfig>\\n <Host>www.example.com</Host>\\n <Path>/tsdf</Path>\\n <Query>quedsa</Query>\\n </RewriteConfig>\\n <TrafficMirrorConfig>\\n <MirrorGroupConfig>\\n <ServerGroupTuples>\\n <ServerGroupId>srg-00mkgijak0w4qgz9****</ServerGroupId>\\n <Weight>2</Weight>\\n </ServerGroupTuples>\\n </MirrorGroupConfig>\\n </TrafficMirrorConfig>\\n <TrafficLimitConfig>\\n <QPS>4</QPS>\\n <PerIpQps>80</PerIpQps>\\n </TrafficLimitConfig>\\n <Type>ForwardGroup</Type>\\n <CorsConfig>\\n <AllowOrigin>http://test.com</AllowOrigin>\\n <AllowMethods>GET</AllowMethods>\\n <AllowHeaders>test_123</AllowHeaders>\\n <ExposeHeaders>test_123</ExposeHeaders>\\n <AllowCredentials>on</AllowCredentials>\\n <MaxAge>1000</MaxAge>\\n </CorsConfig>\\n </RuleActions>\\n <RuleConditions>\\n <CookieConfig>\\n <Values>\\n <Key>test</Key>\\n <Value>test</Value>\\n </Values>\\n </CookieConfig>\\n <HeaderConfig>\\n <Key>Port</Key>\\n <Values>5006</Values>\\n </HeaderConfig>\\n <HostConfig>\\n <Values>www.example.com</Values>\\n </HostConfig>\\n <MethodConfig>\\n <Values>PUT</Values>\\n </MethodConfig>\\n <PathConfig>\\n <Values>/test</Values>\\n </PathConfig>\\n <QueryStringConfig>\\n <Values>\\n <Key>test</Key>\\n <Value>test</Value>\\n </Values>\\n </QueryStringConfig>\\n <SourceIpConfig>\\n <Values>192.168.XX.XX/32</Values>\\n </SourceIpConfig>\\n <Type>Host</Type>\\n </RuleConditions>\\n <RuleId>rule-bpn0kn908w4nbw****</RuleId>\\n <RuleName>rule-instance-test</RuleName>\\n <RuleStatus>Available</RuleStatus>\\n </Rules>\\n <TotalCount>1000</TotalCount>\\n</ListRulesResponse>\",\"errorExample\":\"\"}]", "title": "查詢轉寄規則" } }, "endpoints": [ { "regionId": "cn-wulanchabu", "endpoint": "alb.cn-wulanchabu.aliyuncs.com" } ] } -
出站身分識別驗證:選擇上一步建立的AccessKey憑證。
-
Function Compute
本樣本接入一個數學計算Web函數。
添加Function Compute類型的服務前,需在Function Compute控制台建立並部署Web函數:
-
單擊创建函数,函數類型選擇Web 函数。輸入函数名称,運行環境選擇自定义运行时 > Python > Python 3.10(Debian 11),代码上传方式選擇使用示例代码,启动命令為命令模式,填入
python app.py,單擊创建。 -
在WebIDE中將範例程式碼替換為以下數學計算服務代碼,將檔案名稱改為
app.py,儲存後單擊部署代码。 -
單擊介面右側的复制 ARN,後續添加服務時需要使用。
提供數學計算功能的Web函數範例程式碼
from http.server import HTTPServer, BaseHTTPRequestHandler
import urllib
import json
class MathHandler(BaseHTTPRequestHandler):
def do_GET(self):
"""Handle GET request: /?a=10&b=5&op=add"""
params = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query)
try:
a = float(params.get('a', [0])[0])
b = float(params.get('b', [0])[0])
op = params.get('op', ['add'])[0]
# Perform calculation
if op == 'add':
result = a + b
elif op == 'sub':
result = a - b
elif op == 'mul':
result = a * b
elif op == 'div':
result = a / b
else:
raise ValueError(f"Unsupported operation: {op}")
response = {'result': result, 'message': f'{a} {op} {b} = {result}'}
self.send_response(200)
except (ValueError, ZeroDivisionError) as e:
response = {'error': str(e)}
self.send_response(400)
self.send_header('Content-type', 'application/json')
self.end_headers()
self.wfile.write(json.dumps(response).encode())
if __name__ == "__main__":
server = HTTPServer(('0.0.0.0', 9000), MathHandler)
print("Server running on http://localhost:9000")
server.serve_forever()完成準備後,返回MCP伺服器組,單擊添加MCP服務,完成以下配置後單擊確定。
-
服務名稱:輸入易於大模型理解的名稱,本文為
math-calculator,表示提供數學計算服務。 -
服務類型:選擇Function Compute。
-
Function ComputeARN:輸入已複製的函數ARN。
-
OpenAPI 配置:將以下OpenAPI設定檔粘貼或匯入。
-
出站身分識別驗證:選擇RAM角色。
上述函數對應的OpenAPI配置
{
"openapi": "3.1.0",
"info": {
"title": "Math Calculator API",
"version": "1.0.0",
"description": "Math calculator supporting addition, subtraction, multiplication, and division"
},
"paths": {
"/": {
"get": {
"summary": "Math calculation",
"description": "Perform basic mathematical operations (addition, subtraction, multiplication, division)",
"operationId": "calculate",
"parameters": [
{
"name": "op",
"in": "query",
"required": true,
"description": "Operation type: add=addition, sub=subtraction, mul=multiplication, div=division",
"schema": {
"type": "string",
"enum": ["add", "sub", "mul", "div"]
}
},
{
"name": "a",
"in": "query",
"required": true,
"description": "First operand",
"schema": {
"type": "number"
}
},
{
"name": "b",
"in": "query",
"required": true,
"description": "Second operand",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "Calculation successful",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"result": {
"type": "number",
"description": "Calculation result"
},
"message": {
"type": "string",
"description": "Calculation description"
}
}
}
}
}
}
}
}
}
}
}3.建立監聽
-
在ALB控制台,單擊目標執行個體ID進入執行個體詳情頁。在監聽頁簽單擊建立監聽。
-
在配置監聽步驟,選擇監聽協議為HTTPS,監聽通信埠填寫
443,完成後單擊下一步。 -
在配置SSL認證步驟,選擇與自訂網域名匹配的伺服器憑證,單擊下一步。
-
在選擇伺服器組步驟,依次選擇伺服器類型和伺服器組
sgp-default,完成後單擊下一步。此處選擇的伺服器組將用於監聽的預設規則,即在請求未命中其他轉寄規則時處理請求。本文的MCP請求均通過轉寄規則精確匹配,不會命中該規則。
-
在組態稽核步驟,確認配置並單擊提交。
4.配置轉寄規則
請求按優先順序數字從小到大依次匹配轉寄規則,匹配到某條規則後執行其轉寄動作,不再匹配後續規則。建立轉寄條件為路徑的轉寄規則,將MCP協議相關請求路由至MCP類型伺服器組。
-
在執行個體監聽頁簽,單擊目標監聽ID。在監聽詳情頁切換到轉寄規則頁簽。
-
單擊插入新規則,完成以下配置後單擊確定。
-
轉寄條件:選擇路徑,匹配方式選擇精確匹配,輸入
/mcp。 -
服務擴充(可選):使用模板快速建立,選擇MCP認證代理,單擊建立。輸入服務副檔名稱,選擇啟用語義搜索後單擊建立。該模板會自動添加API Key認證組件並產生憑證。
-
轉寄動作:轉寄至
sgp-mcp伺服器組。
-
-
在轉寄規則列表中單擊剛建立的服務擴充ID進入詳情頁,在頁面下方展開API Key認證組件,在憑證欄位擷取API Key,後續驗證測試時需要使用。
5.設定網域名稱解析
將自有網域名稱通過CNAME解析指向ALB執行個體的DNS名稱,用戶端通過自有網域名稱訪問ALB。
本文以阿里雲Alibaba Cloud DNS為例,對於非阿里雲註冊網域名稱,需先將網域名稱添加到雲解析控制台。
6.驗證測試
完成上述配置後,可通過以下方式驗證MCP服務是否正常運行。
MCP Inspector調試
-
安裝Node.js環境,執行以下命令啟動MCP Inspector:
npx @modelcontextprotocol/inspector -
將Transport Type切換為Streamable HTTP,在URL欄位填入ALB的MCP服務訪問地址,如
https://mcp.example.com/mcp。展開Authentication,在Custom Headers中添加一條Header,名稱為Authorization,值為Bearer <API Key憑證>(即步驟4中擷取的憑證),並開啟左側開關。單擊Connect,顯示Connected表示串連成功。 -
單擊List Tools可擷取當前掛載的所有工具列表。分別驗證各類型服務:
-
MCP伺服器類型:選擇溫度換算工具
temperature-converter::celsius_to_fahrenheit,輸入celsius為22,單擊Run Tool,可擷取轉換結果為71.6華氏度。 -
Function Compute類型:選擇數學計算工具
math-calculator::calculate,選擇op為add,a為10,b為5,單擊Run Tool,可擷取計算結果為15。 -
REST API類型:選擇ALB管理工具
alb-operator::ListLoadBalancers,單擊Run Tool,可擷取目標帳號下的ALB執行個體列表。 -
語義搜尋:選擇
x-aliyun-alb-search工具,可利用MCP代理組件內建的語義搜尋能力搜尋匹配的工具。例如輸入query為查詢負載平衡資訊,topk為2,可返回現有工具中最匹配的兩個工具,避免載入全量工具列表,節省LLM的Token消耗。
-
Agent測試
以下樣本基於LangChain構建Agent,通過MCP代理組件的語義搜尋能力動態檢索並調用工具。
-
安裝Python(3.10及以上版本)並安裝依賴:
pip install "langchain>=1.2.4" "langchain-community>=0.4.1" "langchain-mcp-adapters>=0.2.1" "langchain-openai>=1.0.1" "langgraph>=1.0.1" -
儲存以下代碼為
agent.py:# -*- coding: utf-8 -*- import asyncio import os import httpx from langchain.agents import create_agent from langchain_openai import ChatOpenAI from mcp import ClientSession from mcp.client.streamable_http import streamable_http_client from mcp.types import Tool from langchain_mcp_adapters.tools import convert_mcp_tool_to_langchain_tool async def search_alb_tools(session: ClientSession, query: str, topk: int = 3) -> list: """Search for relevant tools via MCP protocol.""" result = await session.call_tool( "x-aliyun-alb-search", {"query": query, "topk": topk} ) payload = result.structuredContent or {} allowed_fields = {"name", "title", "description", "inputSchema"} mcp_tools = [ Tool(**{k: v for k, v in t.items() if k in allowed_fields and v}) for t in payload.get("tools", []) ] return [convert_mcp_tool_to_langchain_tool(session, t) for t in mcp_tools] class AlbChatAgent: def __init__(self, session: ClientSession, llm: ChatOpenAI): self.session = session self.llm = llm async def chat(self, user_query: str) -> None: print(f"\nUser: {user_query}") tools = await search_alb_tools(self.session, user_query) system_prompt = ( "You are an expert assistant. Only use the provided ALB tools to answer questions. " "If the tools are insufficient, clearly inform the user. Be concise and professional." ) agent = create_agent( model=self.llm, tools=tools, system_prompt=system_prompt ) try: response = await agent.ainvoke( {"messages": [{"role": "user", "content": user_query}]}, ) print(f"Assistant: {response['messages'][-1].content}") except Exception as e: print(f"Error: {type(e).__name__}: {str(e)}") async def main(): mcp_url = os.getenv("MCP_URL") mcp_api_key = os.getenv("MCP_API_KEY") qwen_api_key = os.getenv("QWEN_API_KEY") if not mcp_url: raise EnvironmentError("Environment variable not set: MCP_URL") if not mcp_api_key: raise EnvironmentError("Environment variable not set: MCP_API_KEY") if not qwen_api_key: raise EnvironmentError("Environment variable not set: QWEN_API_KEY") async with httpx.AsyncClient( headers={"Authorization": f"Bearer {mcp_api_key}"}, timeout=httpx.Timeout(60, read=300), ) as http_client: async with streamable_http_client( mcp_url, http_client=http_client, ) as (reader, writer, _): async with ClientSession(reader, writer) as session: await session.initialize() llm = ChatOpenAI( model="qwen-plus", api_key=qwen_api_key, base_url="https://dashscope.aliyuncs.com/compatible-mode/v1" ) agent = AlbChatAgent(session, llm) while True: try: query = input("\n>>> ").strip() if query: await agent.chat(query) except (KeyboardInterrupt, EOFError): break if __name__ == "__main__": asyncio.run(main()) -
設定以下環境變數並運行:
-
MCP_URL:ALB執行個體的MCP服務訪問地址,本文中為https://mcp.example.com/mcp -
MCP_API_KEY:步驟4中產生的API Key憑證。
Linux/macOS
export MCP_URL=https://mcp.example.com/mcp export MCP_API_KEY=your_api_key export QWEN_API_KEY=sk-xxx python agent.pyWindows
$env:MCP_URL="https://mcp.example.com/mcp" $env:MCP_API_KEY="your_api_key" $env:QWEN_API_KEY="sk-xxx" python agent.py -
-
運行後通過自然語言輸入問題,Agent會通過
x-aliyun-alb-search檢索匹配的工具並調用。>>> 幫我換算下22攝氏度是多少華氏度 User: 幫我換算下22攝氏度是多少華氏度 Assistant: 22攝氏度等於71.6華氏度。 >>> 幫我計算下22 * 33是多少 User: 幫我計算下22 * 33是多少 Assistant: 22 × 33 = 726 >>> 幫我列舉出當前的ALB執行個體 User: 幫我列舉出當前的ALB執行個體 Assistant: 當前共有2個ALB執行個體,詳情如下: | 執行個體ID | 名稱 | 地址類型 | 狀態 | |--------|------|----------|------| | alb-xxxx1 | my-alb-1 | Internet | Active | | alb-xxxx2 | my-alb-2 | Intranet | Active |
更多資訊
計費說明
-
ALB擴充版:目前處於公測階段,使用者可免費體驗。
-
網域名稱和DNS解析費用:除了需要支付網域名稱供應商的網域名稱費用外,在阿里雲配置DNS解析需要支付公網權威解析費用。
-
認證費用:從阿里雲購買認證或將認證上傳至阿里雲,需要支付伺服器憑證費用。
-
Function Compute費用:由Function Compute收取。
-
百鍊模型費用:調用百鍊API需要支付模型費用。
ALB擴充版支援的地區
|
地區 |
地區 |
可用性區域 |
|
中國 |
華北6(烏蘭察布) |
可用性區域A、可用性區域B、可用性區域C |
|
華東1(杭州) |
可用性區域J、可用性區域K |
|
|
華北2(北京) |
可用性區域I、可用性區域K、可用性區域L |
|
|
華東2(上海) |
可用性區域B、可用性區域F |
|
|
中國香港 |
可用性區域B、可用性區域C、可用性區域D |
|
|
亞太地區 |
新加坡 |
可用性區域A、可用性區域B、可用性區域C |
|
日本(東京) |
可用性區域B、可用性區域C、可用性區域E |
|
|
馬來西亞(吉隆坡) |
可用性區域A、可用性區域B、可用性區域C |
|
|
歐美地區 |
德國(法蘭克福) |
可用性區域A、可用性區域B |
|
美國(矽谷) |
可用性區域A、可用性區域B |
|
|
中東 |
阿聯酋(杜拜) |
可用性區域A、可用性區域B |
使用建議
-
工具列表擷取策略:工具數量較少時,可直接調用
tools/list擷取完整列表;工具數量較多時,建議使用x-aliyun-alb-search語義搜尋匹配相關工具,減少Token消耗。 -
工具描述最佳化:OpenAPI配置中的工具描述直接影響語義搜尋的匹配準確率。建議用自然語言準確描述每個工具的用途,必要時可藉助LLM最佳化描述文本。
-
內網網域名稱解析:ALB擴充版通過公網DNS解析MCP伺服器位址。若MCP伺服器部署在VPC內網,需在公網DNS中將網域名稱解析到對應的私網IP,並確保ALB與該伺服器網路互連。
-
安全性:API Key應避免寫入程式碼在用戶端代碼中,推薦通過環境變數或Key Management Service管理。
常見問題
MCP伺服器連線逾時,報錯upstream connect error或connection timeout
-
確保ALB到MCP伺服器網路可達。
-
MCP 服務部署在 VPC 內:確保ALB執行個體能通過私網訪問MCP服務。同VPC內預設互連;跨VPC或跨地區情境需通過雲企業網等產品打通私網。同時確保安全性群組規則允許ALB訪問MCP服務連接埠。
-
MCP服務部署在公網:確保ALB執行個體所在交換器已經正確配置公網SNAT。
-
-
確認已在公網DNS上正確佈建網域名解析。
-
確認MCP伺服器處理序已啟動並監聽在預期連接埠。
語義搜尋未返回預期的工具
-
檢查工具描述是否足夠準確,語義搜尋依賴描述與查詢的語義相似性。
-
適當增大
topk參數的值,擴大返回的候選工具數量。
Function Compute類型的服務添加後無法調用
-
確認OpenAPI設定檔格式正確,且介面路徑和參數與函數的實際行為一致。
-
確認代碼已成功部署到Function Compute服務。