閱讀395 返回首頁    go 魔獸


授權出方向安全組權限__安全組相關接口_API 參考_雲服務器 ECS-阿裏雲

描述

設定安全組Out方向的訪問權限。

  • 可支持的授權策略為:accept(接受訪問),drop(拒絕訪問)。
  • 可支持不同的網絡類型,如NicType可選擇internetintranet,分別表示公網或內網。
  • 單個安全組的授權規則最多為100條。
  • 安全組的優先級根據創建的時間降序排序匹配。
  • 組和組之間的授權隻能在內網,即NicType隻能選擇intranet
  • 規則優先級可選範圍為1-100,默認值為1,即最高優先級。數字越大,代表優先級越低。
  • 相同優先級的授權規則,授權策略為drop的規則優先。
  • 安全組規則由兩組可選參數中的一組組成:DestGroupOwnerAccountDestGroupIdIpProtocolPortRangeNicTypePolicy或者DestCidrIpIpProtocolPortRangeNicTypePolicy。如匹配的規則已存在將會報錯。

支持兩種授權方式: 1、開放對同一region內其他安全組(允許跨用戶授權)的訪問權限;2、開放對指定某IP地址範圍(CIDR格式)的訪問權限

請求參數

名稱 類型 是否必須 描述
Action String 係統規定參數,取值:AuthorizeSecurityGroupEgress
SecurityGroupId String 源安全組編碼
RegionId String 源安全組所屬Region ID
IpProtocol String IP協議,取值:tcp | udp | icmp | gre | all;
all表示同時支持四種協議
PortRange String IP協議相關的端口號範圍
  • 協議為tcp、udp時默認端口號,取值範圍為1~65535;例如“1/200”意思是端口號範圍為1~200,若輸入值為:“200/1”接口調用將報錯。
  • 協議為icmp時端口號範圍值為-1/-1;
  • gre協議時端口號範圍值為-1/-1;
  • 協議為all時端口號範圍值為-1/-1
DestGroupId String 同一Region內的目標安全組Id,DestGroupId或者DestCidrIp參數必須設置一項,如果兩項都設置,則默認對DestCidrIp授權。如果指定了該字段且沒有指定DestCidrIp,則NicType隻能選擇intranet
DestGroupOwnerAccount String 跨用戶安全組授權時,目標安全組所屬用戶阿裏雲賬號。該參數可選,如果該參數及DestGroupOwnerId均未設置,則默認為同一賬戶安全組間授權。DestCidrIp如果已經被設置,則該參數無效。
DestGroupOwnerId String 跨用戶安全組授權時,目標安全組所屬用戶阿裏雲賬號ID。該參數可選,如果該參數及DestGroupOwnerAccount均未設置,則默認為同一賬戶安全組間授權。DestCidrIp如果已經被設置,則該參數無效。
DestCidrIp String 目標IP地址範圍,必須采用CIDR格式來指定IP地址範圍,默認值為0.0.0.0/0(表示不受限製),其他支持的格式如10.159.6.18/12。僅支持IPV4。
Policy String 授權策略,參數值可為:accept(接受訪問), drop (拒絕訪問)
默認值為:accept
Priority String 授權策略優先級,參數值可為:1-100
默認值為:1
NicType String 網絡類型,取值:
  • internet
  • intranet;
默認值為internet
當對安全組進行相互授權時(即指定了DestGroupId且沒有指定DestCidrIp),必須指定NicType為intranet

返回參數

全是公共返回參數,詳見公共返回參數

錯誤碼

錯誤代碼 描述 Http 狀態碼 語義
InvalidRegionId.NotFound The RegionId provided does not exist in our records. 404 指定的RegionId不存在
MissingParameter The input parameter “RegionId” that is mandatory for processing this request is not supplied. 400 RegionId參數未指定
InvalidSecurityGroupId.NotFound The SecurityGroupId provided does not exist in our records. 404 指定的SecurityGroupId不存在
MissingParameter The input parameter “SecurityGroupId” that is mandatory for processing this request is not supplied. 400 SecurityGroupId參數未指定
OperationDenied The specified IpProtocol does not exist or IpProtocol and PortRange do not match. 400 IP協議不存在或者IP協議和端口不匹配
MissingParameter The input parameter “IpProtocol” that is mandatory for processing this request is not supplied. 400 IpProtocol參數未指定
InvalidIpProtocol.Malformed The specified parameter “PortRange” is not valid. 400 IpProtocol參數格式不正確
InvalidPriority.Malformed The specified parameter “Priority” is not valid. 400 Priority參數格式不正確
MissingParameter The input parameter “PortRange” that is mandatory for processing this request is not supplied. 400 PortRange參數未指定
InvalidDestGroupId.Mismatch NicType is required or NicType expects intrnet. 403 需要明確NicType參數或者NicType必須為intranet
InvalidDestCidrIp.Malformed The specified parameter “DestCidrIp” is not valid. 400 DestCidrIp參數格式不正確
MissingParameter The input parameter “DestGroupId” or “DestCidrIp” cannot be both blank. 403 DestGroupId或者DestCidrIp參數未指定
InvalidPolicy.Malformed The specified parameter “Policy” is not valid. 400 Policy參數格式不正確
InvalidNicType.ValueNotSupported The specified NicType does not exist. 400 NicType指定的值不支持
AuthorizationLimitExceed The limit of Authorization in one security group reachs. 403 安全組授權規則數達到上限
InvalidParamter.Conflict The specified SecurityGroupId should be different from the DestGroupId. 403 SecurityGroupId和DestGroupId為同一個安全組
InvalidDestGroupId.Mismatch DestGroupOwnerUserAccount is required. 403 指定的其他用戶的DestGroup但是沒有指定DestGroupOwnerUserAccount
InvalidDestGroupId.Mismatch Specified security group and destination group are not in the same VPC. 403 指定的安全組和目標安全組不屬於同一個vpc
InvalidDestGroupOwnerUserAccount.Mismatch The specified DestGroupId is not belong to the DestGroupOwnerUserAccount 403 指定的DestGroup不屬於DestGroupOwnerUserAccount指定的用戶
InvalidDestGroupId.NotFound The DestGroupId provided does not exist in our records. 404 指定的DestGroup未找到

示例

請求示例

  • 配置對其他安全組的訪問權限
  1. https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroupEgress
  2. &SecurityGroupId=sg-94n63e80l
  3. &IpProtocol=all
  4. &DestGroupId=sg-94oi1r1bp
  5. &PortRange=1/65535
  6. &<公共請求參數>
  • 授權對指定的IP地址範圍的訪問權限
  1. https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroupEgress
  2. &SecurityGroupId=sg-94n63e80l
  3. &IpProtocol=all
  4. &DestCidrIp=10.0.0.0/8
  5. &PortRange=1/65535
  6. &<公共請求參數>

返回示例

XML格式

  1. <AuthorizeSecurityGroupEgressResponse>
  2. <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
  3. </AuthorizeSecurityGroupEgressResponse>

JSON格式

  1. {
  2. "RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
  3. }

最後更新:2016-11-23 17:16:02

  上一篇:go 撤銷安全組規則__安全組相關接口_API 參考_雲服務器 ECS-阿裏雲
  下一篇:go 撤銷出方向安全組規則__安全組相關接口_API 參考_雲服務器 ECS-阿裏雲