安全组
响应对象为安全组对象:
{
"Description": "ssssss", # 安全组描述
"Id":"d8cfcbaf-f400-412a-8d89-4dc58f4aa00b", # 安全组Id
"VpcId": "f7f6fb3f-bd5c-4b4d-acb6-e2355af4f1ee", # 安全组所属网络id
"Name":"mynewname", # 安全组名字
"SecurityGroupType": "User", # 安全组类型,用户自建为User,网络自带为System
"CreateAt": "2017-12-20T03:29:14Z", # 创建时间,UTC时间
"UpdateAt": "2017-12-20T03:29:14Z" # 更新时间,UTC时间
}
1. CreateSecurityGroup
接口方法:POST
请求示例:
https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=CreateSecurityGroup
-d'{
"VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
"Name": "Test"
}'
url 参数:
参数 | 是否必选 | 说明 |
Version | 是 | API 版本号 |
Action | 是 | CreateSecurityGroup,新建 VPC 安全组 |
body 参数:
参数 | 是否必填 | 说明 |
VpcId | 必选 | vpc网络的id |
Name | 必选 | 安全组的名字 |
Description | 可选 | 安全组的描述 |
响应示例:
{
"SecurityGroup": {
"Description": "null",
"Id": "397823d7-4700-46a6-880b-46e8d108ffc6",
"VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
"Name": "Test",
"SecurityGroupType": "User",
"IsDefault": false,
"CreateAt": "2018-11-22T06:50:33Z",
"UpdateAt": "2018-11-22T06:50:33Z"
},
"RequestId": "82156c0d-463e-47bb-91da-42625d36e378"
}
常见错误:
{
"Code": "InvalidParameterValue",
"Message": "Name is invalid",
"RequestId": "f41cbec6-7521-4def-9c34-c4c5f73ba625",
"Result": ""
}
{
"Code": "InvalidParameterValue",
"Message": "Network does not exist",
"RequestId": "5a705b05-a227-4597-81de-42ed9e5014d8",
"Result": ""
}
2. DeleteSecurityGroup
接口方法:GET
请求示例:
https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=DeleteSecurityGroup&Id=397823d7-4700-46a6-880b-46e8d108ffc6
url 参数:
参数 | 是否必选 | 说明 |
Version | 是 | API 版本号 |
Action | 是 | DeleteSecurityGroup,删除指定的安全组 |
Id | 必选 | 要删除的安全组id |
响应示例:
{
"SecurityGroup": {
"Description": "null",
"Id": "397823d7-4700-46a6-880b-46e8d108ffc6",
"VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
"Name": "Test",
"SecurityGroupType": "User",
"IsDefault": false,
"CreateAt": "2018-11-22T06:50:33Z",
"UpdateAt": "2018-11-22T06:50:33Z"
},
"RequestId": "399c9ec2-0ccb-4687-9914-c4a679384bf2"
}
常见错误:
{
"Code": "InvalidParameterValue",
"Message": "Security group is not found",
"RequestId": "53300393-12a8-4f7b-849b-52fd3106351c",
"Result": ""
}
3. GetSecurityGroup
接口方法:GET
请求示例:
https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=GetSecurityGroup&Id=cd2290b8-989c-491f-baee-4ee392b32eaf
url 参数:
参数 | 是否必选 | 说明 |
Version | 是 | API 版本号 |
Action | 是 | GetSecurityGroup,获取安全组详情 |
Id | 必选 | 要获取的安全组id |
响应示例:
{
"SecurityGroup": {
"Description": "default",
"Id": "cd2290b8-989c-491f-baee-4ee392b32eaf",
"VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
"Name": "default",
"SecurityGroupType": "System",
"IsDefault": true,
"CreateAt": "2018-08-02T02:27:05Z",
"UpdateAt": "2018-08-02T02:27:05Z"
},
"RequestId": "40189c86-a98d-415e-8216-e22115becabf"
}
常见错误:
{
"Code": "MissingParameter",
"Message": "Empty necessary param",
"RequestId": "4823e65e-62c5-4a19-84fc-6d01e05ea1b0",
"Result": "Required String parameter 'Id' is not present"
}
{
"Code": "InvalidParameterValue",
"Message": "Security group is not found",
"RequestId": "a72aba56-41d2-4778-aa11-ecace5312c5c",
"Result": ""
}
4. ListSecurityGroup
接口方法:GET
请求示例:
https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=ListSecurityGroup&VpcId=a007fc18-2b71-4aa7-b50f-c1becbdf1e7a
url 参数:
参数 | 是否必选 | 说明 |
Version | 是 | API 版本号 |
Action | 是 | ListSecurityGroup,安全组列表 |
VpcId | 必选 | 要获取哪个网络里的安全组列表 |
Limit | 可选 | 返回个数,不填默认20 |
Offset | 可选 | 总偏移量,不填默认0 |
KeyWord | 可选 | 搜索参数,可选,匹配范围为:name,description,securityGroupId |
响应示例:
{
"Count": 1,
"Offset": 0,
"RequestId": "0a497498-13d4-4d04-b6bc-0a99774f15a3",
"SecurityGroups": [
{
"Description": "default",
"Id": "cd2290b8-989c-491f-baee-4ee392b32eaf",
"VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
"Name": "default",
"SecurityGroupType": "System",
"IsDefault": true,
"CreateAt": "2018-08-02T02:27:05Z",
"UpdateAt": "2018-08-02T02:27:05Z"
}
],
"Limit": 20
}
常见错误:
网络不存在
{
"Code": "InvalidParameterValue",
"Message": "Network does not exist",
"RequestId": "5c1badfd-93e9-414a-9a14-ff46bce627f6",
"Result": ""
}
缺少必须参数
{
"Code": "MissingParameter",
"Message": "Empty necessary param",
"RequestId": "02a3fdbf-1225-48bd-8896-a35b772db717",
"Result": "Required String parameter 'VpcId' is not present"
}
参数类型不对
{
"Code": "InvalidParameterValue",
"Message": "Request parameter error",
"RequestId": "2c4e4b70-fbd0-4e11-8cad-88ee50531c6e",
"Result": "Failed to convert value of type 'java.lang.String' to required type 'long'; nested exception is java.lang.NumberFormatException: For input string: \"aaa\""
}
旧版VPC不允许该操作
{
"Code": "InvalidParameterValue",
"Message": "Network is classic and can not be operated",
"RequestId": "af564b98-645e-4f4d-9e73-c60ffc581700",
"Result": ""
}
Keyword不可以和Name,FuzzySearch共同请求
{
"Code": "InvalidParameterValue",
"Message": "Keyword and name and fuzzysearch can not coexist",
"RequestId": "af564b98-645e-4f4d-9e73-c60ffc581700",
"Result": ""
}
5. UpdateSecurityGroup
接口方法:POST
请求示例:
https://open.cn-east-1.163yun.com/vpc?Version=2017-11-30&Action=UpdateSecurityGroup
-d'{
"Id": "4ef4db49-8a61-4f1a-8390-cd39f87ef6ee",
"Name": "ChangeByAPI"
}'
url 参数
参数 | 是否必选 | 说明 |
Version | 是 | API 版本号 |
Action | 是 | UpdateSecurityGroup,修改安全组设置 |
body 参数:
参数 | 是否必填 | 说明 |
Id | 必选 | 安全组的id |
Name | 可选 | 安全组更新的名字 |
Description | 可选 | 安全组更新的描述 |
响应示例:
{
"SecurityGroup": {
"Description": "null",
"Id": "4ef4db49-8a61-4f1a-8390-cd39f87ef6ee",
"VpcId": "a007fc18-2b71-4aa7-b50f-c1becbdf1e7a",
"Name": "ChangeByAPI",
"SecurityGroupType": "User",
"IsDefault": false,
"CreateAt": "2018-11-22T06:57:57Z",
"UpdateAt": "2018-11-22T07:01:09Z"
},
"RequestId": "1158c197-b46c-4504-a436-77c6dfede9b1"
}
常见错误:
名字重复时
{
"Code": "InvalidParameterValue",
"Message": "Name is invalid",
"RequestId": "cca8d0a4-c192-42cd-9030-4675436404ac",
"Result": ""
}