本介面用於修改指定安全性群組中的一條入方向安全性群組規則。
介面說明
指定安全性群組規則 ID 修改安全性群組規則時,您需要注意以下使用限制:
-
安全性群組規則的授權對象分為 IPv4 的 CIDR 位址區塊(或 IP 位址)、IPv6 的 CIDR 位址區塊(或 IP 位址)、安全性群組、前綴列表,您不能透過該介面修改已有安全性群組規則的授權對象類型。如原來授權對象類型為 IPv4 的 CIDR 位址區塊,您可以更改為另一個 IPv4 的 CIDR 位址區塊(或 IP 位址),但不能修改為 IPv6 的 CIDR 位址區塊(或 IP 位址)、安全性群組或前綴列表。
-
欄位不支援從非空修改為空,如果需要修改建議先增加一條新規則,再刪除當前規則。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ecs:ModifySecurityGroupRule |
update |
*All Resource
|
|
無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RegionId |
string |
是 |
目標安全性群組所屬地域 ID。您可以呼叫 DescribeRegions 查看最新的阿里雲地域列表。 |
cn-hangzhou |
| RegionId |
string |
是 |
目標安全性群組所屬地域 ID。您可以呼叫 DescribeRegions 查看最新的阿里雲地域列表。 |
cn-hangzhou |
| ClientToken |
string |
否 |
保證請求冪等性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證冪等性。 |
123e4567-e89b-12d3-a456-426655440000 |
| SecurityGroupId |
string |
是 |
安全性群組 ID。 |
sg-bp67acfmxazb4p**** |
| SecurityGroupRuleId |
string |
否 |
安全性群組規則 ID。您可以透過 DescribeSecurityGroupAttribute 查詢安全性群組規則 ID。 |
sgr-bp67acfmxa123b*** |
| Policy |
string |
否 |
存取權限。取值範圍:
預設值:accept。 |
accept |
| Priority |
string |
否 |
安全性群組規則優先順序。取值範圍:1~100。 預設值:1。 |
1 |
| IpProtocol |
string |
否 |
網路層/傳輸層協議。支援兩類賦值:
|
ALL |
| SourceCidrIp |
string |
否 |
設定存取權限的來源端 IPv4 CIDR 位址區塊。支援 CIDR 格式和 IPv4 格式的 IP 位址範圍。 預設值:無。 |
10.0.0.0/8 |
| Ipv6SourceCidrIp |
string |
否 |
設定存取權限的來源端 IPv6 CIDR 位址區塊。支援 CIDR 格式和 IPv6 格式的 IP 位址範圍。 說明
僅支援 VPC 類型的 IP 位址,且該參數與 預設值:無。 |
2001:db8:1233:1a00::*** |
| SourceGroupId |
string |
否 |
設定存取權限的來源端安全性群組 ID。至少設定一項
|
sg-bp67acfmxa123b**** |
| SourcePrefixListId |
string |
否 |
設定存取權限的來源端前綴列表 ID。您可以呼叫 DescribePrefixLists 查詢可以使用的前綴列表 ID。 當您指定了 |
pl-x1j1k5ykzqlixdcy**** |
| PortRange |
string |
否 |
目的端安全性群組開放的傳輸層協議相關的連接埠範圍。取值範圍:
|
80/80 |
| DestCidrIp |
string |
否 |
目的端 IPv4 CIDR 位址區塊。支援 CIDR 格式和 IPv4 格式的 IP 位址範圍。 預設值:無。 |
10.0.0.0/8 |
| Ipv6DestCidrIp |
string |
否 |
目的端 IPv6 CIDR 位址段。支援 CIDR 格式和 IPv6 格式的 IP 位址範圍。 說明
僅支援 VPC 類型的 IP 位址,且該參數與 預設值:無。 |
2001:db8:1234:1a00::*** |
| SourcePortRange |
string |
否 |
來源端安全性群組開放的傳輸層協議相關的連接埠範圍。取值範圍:
|
80/80 |
| SourceGroupOwnerAccount |
string |
否 |
跨帳號設定安全性群組規則時,來源端安全性群組所屬的阿里雲帳號。
|
EcsforCloud@Alibaba.com |
| SourceGroupOwnerId |
integer |
否 |
跨帳號設定安全性群組規則時,來源端安全性群組所屬的阿里雲帳號。
|
12345678910 |
| NicType |
string |
否 |
網路卡類型。 說明
根據安全性群組規則 ID 修改規則時,不支援修改該參數。如果需要修改,建議先增加一條新規則,再刪除當前規則。 |
intranet |
| Description |
string |
否 |
安全性群組規則的描述資訊。長度為 1~512 個字元。 |
This is a new security group rule. |
| PortRangeListId |
string |
否 |
連接埠列表 ID。 您可以呼叫 當您指定了 PortRange 參數時,將忽略該參數。 更多資訊,請參見安全性群組使用限制。 |
prl-2ze9743**** |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| RequestId |
string |
請求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
樣本
正常返回樣本
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | OperationDenied | The specified IpProtocol does not exist or IpProtocol and PortRange do not match. | |
| 400 | InvalidIpProtocol.Malformed | The specified parameter PortRange is not valid. | |
| 400 | InvalidSourceCidrIp.Malformed | The specified parameter SourceCidrIp is not valid. | |
| 400 | InvalidPolicy.Malformed | The specified parameter Policy is not valid. | |
| 400 | InvalidNicType.ValueNotSupported | The specified NicType does not exist. | |
| 400 | InvalidNicType.Mismatch | The specified NicType conflicts with the authorization record. | |
| 400 | InvalidSourceGroupId.Mismatch | Specified security group and source group are not in the same VPC. | |
| 400 | InvalidSourceGroup.NotFound | Specified source security group does not exist. | |
| 400 | InvalidPriority.Malformed | The parameter Priority is invalid. | |
| 400 | InvalidPriority.ValueNotSupported | The parameter Priority is invalid. | |
| 400 | InvalidSecurityGroupDiscription.Malformed | The specified security group rule description is not valid. | |
| 400 | MissingParameter.Source | One of the parameters SourceCidrIp, SourceGroupId or SourcePrefixListId must be specified. | |
| 400 | InvalidParam.PortRange | The specified parameter %s is not valid. It should be two integers less than 65535 in ?/? format. | |
| 400 | InvalidIpProtocol.ValueNotSupported | The parameter IpProtocol must be specified with case insensitive TCP, UDP, ICMP, GRE or All. | |
| 400 | InvalidParam.SourceIp | The Parameters SourceCidrIp and Ipv6SourceCidrIp in %s cannot be set at the same time. | |
| 400 | InvalidParam.DestIp | The Parameters DestCidrIp and Ipv6DestCidrIp in %s cannot be set at the same time. | |
| 400 | InvalidParam.Ipv6DestCidrIp | The specified parameter %s is not valid. | |
| 400 | InvalidParam.Ipv6SourceCidrIp | The specified parameter %s is not valid. | |
| 400 | InvalidParam.Ipv4ProtocolConflictWithIpv6Address | IPv6 address cannot be specified for IPv4-specific protocol. | |
| 400 | InvalidParam.Ipv6ProtocolConflictWithIpv4Address | IPv4 address cannot be specified for IPv6-specific protocol. | |
| 400 | InvalidParameter.Ipv6CidrIp | The specified Ipv6CidrIp is not valid. | |
| 400 | InvalidParam.DestCidrIp | The specified parameter %s is not valid. | |
| 400 | InvalidSourcePortRange.Malformed | The specified parameter SourcePortRange is not valid. | |
| 400 | InvalidSecurityGroupId.Malformed | The specified parameter SecurityGroupId is not valid. | |
| 400 | InvalidParam.SourceCidrIp | The specified param SourceCidrIp is not valid. | |
| 400 | InvalidParameter.Conflict | IPv6 and IPv4 addresses cannot exist at the same time. | |
| 400 | InvalidParam.SecurityGroupRuleId | The specified parameter SecurityGroupRuleId is not valid. | |
| 400 | InvalidOperation.ModifySgRuleEntityType | The source or destination type of the rules cannot be modified. | |
| 400 | AuthorizationLimitExceed | The limit of authorization records in the security group reaches. | |
| 400 | InvalidParam.ProtocolAndPortRangeMismatch | The specified Protocol and PortRange do not match. | |
| 400 | InvalidParam.ProtocolAndAddressFamilyMismatch | The specified Protocol and address family do not match. | |
| 400 | InvalidParam.PrefixListAddressFamilyMismatch | The address family of the prefix list does not match the rule. | |
| 400 | InvalidParam.InvalidModifyRuleRequest | The request parameters are illegal. | |
| 400 | InvalidOperation.ModifyNicType | NicType is not allowed to modify. | |
| 400 | InvalidParamter.Conflict | The specified SourceCidrIp should be different from the DestCidrIp. | |
| 400 | InvalidOperation.RuleDuplicate | %s. | |
| 400 | InvalidParam.ProtocolNotSupportPortRangeList | The specified protocol does not support the port range list. | |
| 400 | InvalidSourceOrDestGroupId.DirectionMissmatch | The specified SourceGroupId or DestGroupId does not match the direction of the rule. | |
| 400 | InvalidOperation.ModifyPortRangeType | The PortRange type is not allowed to be modified. You cannot modify a rule from using the port list to not using it, and vice versa. | |
| 400 | InvalidPortRangeListId.NotFound | The specified port range list was not found. | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | InvalidSourceGroupId.Mismatch | NicType is required or NicType expects intrnet. | |
| 403 | MissingParameter | The input parameter SourceGroupId or SourceCidrIp cannot be both blank. | |
| 403 | AuthorizationLimitExceed | The limit of authorization records in the security group reaches. | |
| 403 | InvalidParamter.Conflict | The specified SecurityGroupId should be different from the SourceGroupId. | |
| 403 | InvalidNetworkType.Mismatch | The specified SecurityGroup network type should be same with SourceGroup network type (vpc or classic). | |
| 403 | InvalidOperation.ResourceManagedByCloudProduct | %s | |
| 404 | InvalidSecurityGroupId.NotFound | The specified SecurityGroupId does not exist. | |
| 404 | InvalidSourceGroupId.NotFound | The SourceGroupId provided does not exist in our records. | |
| 404 | SecurityGroupRule.NotFound | The target security group rule not exist. | |
| 404 | InvalidPrefixListId.NotFound | The specified prefix list was not found. | |
| 404 | InvalidSecurityGroupRuleId.NotFound | The specified SecurityGroupRuleId is not exists. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。