查询安全组列表
更新时间:2024-11-19
接口描述
该接口用于查询用户的所有安全组信息列表。
请求结构
Plain Text
1GET /v1/securityGroup?pageNo={pageNo}&pageSize={pageSize}&keywordType={keywordType}&keyword={keyword} HTTP/1.1
2 Host: bec.baidubce.com
3 Authorization: authorization string
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
pageNo | Integer | 否 | Query参数 | 页号,缺省值为1 |
pageSize | Integer | 否 | Query参数 | 每页安全组个数,取值范围为1~100,缺省值为100 |
keywordType | String | 否 | Query参数 | 查询的关键字类型,取值为sgName、sgId、instanceId 分别表示安全组名称、安全组ID、实例ID |
keyword | String | 否 | Query参数 | 查询的关键字值 |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数名称 | 类型 | 描述 |
---|---|---|
orderBy | String | 排序字段 |
order | String | 排序顺序,缺省为createTime |
pageNo | Integer | 页码 |
pageSize | Integer | 每页结果数 |
totalCount | Integer | 结果总数 |
result | List<SecurityGroup> | 安全组信息,由SecurityGroup组成的集合 |
请求示例
Plain Text
1GET /v1/securityGroup?pageNo=1&pageSize=10&orderBy=createTime HTTP/1.1
2Host: bec.baidubce.com
3ContentType: application/json
4Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2021-08-11T04:17:29Z/3600/host/uuid
返回示例
Plain Text
1HTTP/1.1 200 OK
2x-bce-request-id: 1214cca7-4ad5-451d-9215-71cb844c0a50
3Date: Wed, 03 Dec 2021 06:42:19 GMT
4Content-Type: application/json;charset=UTF-8
5Server: BWS
6{
7"result": [
8 {
9 "id": "sg-m1pxebfd",
10 "name": "test",
11 "desc": "",
12 "rules": [
13 {
14 "securityGroupRuleId": "sgr-m1pxebfd-a5cbuah8",
15 "direction": "egress",
16 "protocol": "all",
17 "portRange": "1-65535",
18 "remark": "全部协议",
19 "etherType": "IPv4",
20 "destIp": "0.0.0.0/0"
21 },
22 {
23 "securityGroupRuleId": "sgr-m1pxebfd-xl7y8zt8",
24 "direction": "ingress",
25 "protocol": "tcp",
26 "portRange": "53",
27 "remark": "DNS服务",
28 "etherType": "IPv4",
29 "sourceIp": "0.0.0.0/0"
30 },
31 {
32 "securityGroupRuleId": "sgr-m1pxebfd-vtlzdbkd",
33 "direction": "egress",
34 "protocol": "icmp",
35 "remark": "PING请求_IPv4",
36 "etherType": "IPv4",
37 "destIp": "0.0.0.0/0"
38 }
39 ],
40 "createdTime": "2021-10-15T06:28:38Z"
41 },
42 {
43 "id": "sg-8vuk2xqw",
44 "name": "test",
45 "rules": [
46 {
47 "securityGroupRuleId": "sgr-8vuk2xqw-vve4ue6m",
48 "direction": "egress",
49 "protocol": "all",
50 "portRange": "1-65535",
51 "remark": "全部协议",
52 "etherType": "IPv4",
53 "destIp": "0.0.0.0/0"
54 }
55 ],
56 "createdTime": "2021-10-15T06:28:38Z"
57 }
58],
59"orderBy": "createTime",
60"order": "desc",
61"pageNo": 1,
62"pageSize": 100,
63"totalCount": 2
64}
Model对象定义
SecurityGroup
参数名称 | 类型 | 描述 |
---|---|---|
id | String | 安全组ID |
name | String | 安全组名称 |
desc | String | 安全组描述 |
createdTime | String | 安全组创建时间 |
rules | List<SecurityGroupRule> | 安全组规则 |
SecurityGroupRule
参数名称 | 类型 | 描述 |
---|---|---|
direction | String | 入站/出站,取值ingress或egress。 |
etherType | String | 网络类型,取值IPv4。暂不支持IPv6 |
portRange | String | 端口范围,单个端口,或者为1-65535格式的端口范围 |
protocol | String | 协议类型,tcp、udp或icmp,值为空时默认为所有协议 |
sourceIp | String | 源IP地址。当direction为ingress时适用 |
destIp | String | 目的IP地址。当direction为egress时适用 |
remark | String | 备注 |