最近更新时间:2021-10-19 16:38:20
添加/移除/覆盖安全组规则,即添加IP,添加主机。
注意:添加主机即添加主机IP,从接口DescribeInstances获取PrivateIpAddress参数值
添加主机或者指定IP时,规则名称(规则备注)可不填写;若填写时SecurityGroupRuleName-SecurityGroupRuleCidr对应编号要一致,例如:SecurityGroupRule.SecurityGroupRuleCidr.1={{Cidr}}&SecurityGroupRule.SecurityGroupRuleName.1={{name}}
GET
英文名称 | 中文名称 | 类型 | 是否必须 | 备注 |
---|---|---|---|---|
Action | 调用接口名称 | String | 是 | 取固定值:ModifySecurityGroupRule |
Version | API版本号 | String | 是 | 取固定值:2020-08-25 |
SecurityGroupRuleAction | 对安全组规则列表的操作 | String | 是 | 取值范围:Attach|Delete|Cover Attach: 将传入的规则列表(SecurityGroupRuleName,SecurityGroupRuleProtocol)追加到安全组规则列表内。所有绑定了此安全组的实例都会发生变化。 Delete:从安全组中删除传入的规则列表(SecurityGroupRuleId)。所有绑定了此安全组的实例都会发生变化。 Cover:用传入的规则列表(SecurityGroupRuleName,SecurityGroupRuleProtocol)覆盖安全组规则列表。所有绑定了此安全组的实例都会发生变化。 |
SecurityGroupId | 安全组Id | String | 是 | 整型 |
SecurityGroupRule.SecurityGroupRuleId.N | 规则id列表 | Integer | 否 | 整型 |
SecurityGroupRule.SecurityGroupRuleName.N | 规则名称列表 | String | 否 | 不超过256个字节,仅支持中文、大小写字母、数字、减号和下划线 |
SecurityGroupRule.SecurityGroupRuleCidr.N | 规则协议列表 | String | 否 | 0.0.0.0/32格式 |
英文名称 | 中文名称 | 类型 | 备注 |
---|---|---|---|
RequestId | 请求ID | String | – |
Data.SecurityGroups | 安全组列表 | List | 返回安全组详细信息,详细参见安全组-查看 |
http://krds.{{region}}.api.ksyun.com/?Action=ModifySecurityGroupRule&Version=2020-08-25&SecurityGroupRuleAction=Attach&SecurityGroupId=64599&SecurityGroupRule.SecurityGroupRuleName.0=kingsoft_add&SecurityGroupRule.SecurityGroupRuleCidr.0=10.0.11.2/32
{
"Data": {
"SecurityGroups": [
{
"SecurityGroupId": "64599",
"SecurityGroupName": "KingSoft_Test4",
"SecurityGroupDescription": "金山云测试",
"SecurityGroupType": "IPV4",
"Created": "2021-09-08T12:05:25+0800",
"Instances": [
{
"DBInstanceIdentifier": "98edc4a2-80b1-4256-8daa-23f086ce04b7",
"DBInstanceName": "kingsoft_percona",
"Vip": "10.0.1.96",
"Created": "2021-09-08T12:05:26+0800",
"DBInstanceType": "HRDS"
}
],
"SecurityGroupRules": [
{
"SecurityGroupRuleId": "130259",
"SecurityGroupRuleName": "dragoncloud-wq-control-1",
"SecurityGroupRuleProtocol": "TCP/IP",
"SecurityGroupRuleCidr": "10.0.11.2/32",
"Created": "2021-09-09T17:02:11+0800"
}
]
}
]
},
"RequestId": "43105ad6-274a-4da0-97bb-1b17d65bda17"
}
http://krds.{{region}}.api.ksyun.com?Action=ModifySecurityGroupRule&SecurityGroupRuleAction=Delete&SecurityGroupId=64599&SecurityGroupRule.SecurityGroupRuleId.1=130261&SecurityGroupRule.SecurityGroupRuleId.2=130262&Version=2020-08-25
{
"Data": {
"SecurityGroups": [
{
"SecurityGroupId": "64599",
"SecurityGroupName": "KingSoft_Test4",
"SecurityGroupDescription": "金山云测试",
"SecurityGroupType": "IPV4",
"Created": "2021-09-08T12:05:25+0800",
"Instances": [
{
"DBInstanceIdentifier": "98edc4a2-80b1-4256-8daa-23f086ce04b7",
"DBInstanceName": "kingsoft_percona",
"Vip": "10.0.1.96",
"Created": "2021-09-08T12:05:26+0800",
"DBInstanceType": "HRDS"
}
],
"SecurityGroupRules": []
}
]
},
"RequestId": "c1a6bb9d-cb55-4a1c-a4ba-6c494ce0774b"
}
纯净模式