Esta é uma API de listagem de regras de classes do DBC.
API de listagem de regras de uma classe existente.
class_id
/rules
Exemplo de requisição
GET /api/dbc/classes/1/rules HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_rules(class_id=1)
print(response.payload)
const response = sdk.dbc.getRules({ classId: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"rules": [
{
"id": 1,
"class_id": 1,
"type": "ip",
"addr_type": "network",
"addr": "192.168.1.0/24",
"protocol": null,
"port_type": null,
"port": null,
"src_addr_type": null,
"src_addr": null,
"dst_addr_type": null,
"dst_addr": null,
"src_port_type": null,
"src_port": null,
"dst_port_type": null,
"dst_port": null,
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
},
{
"id": 2,
"class_id": 1,
"type": "port",
"addr_type": null,
"addr": null,
"protocol": "tcp",
"port_type": "single",
"port": "8000",
"src_addr_type": null,
"src_addr": null,
"dst_addr_type": null,
"dst_addr": null,
"src_port_type": null,
"src_port": null,
"dst_port_type": null,
"dst_port": null,
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
},
{
"id": 1,
"class_id": 1,
"type": "packet",
"addr_type": null,
"addr": null,
"port_type": null,
"port": null,
"protocol": "tcp",
"src_addr_type": "network",
"src_addr": "192.168.1.0/24",
"dst_addr_type": "network",
"dst_addr": "172.64.1.0/24",
"src_port_type": "single",
"src_port": "8000",
"dst_port_type": "single",
"dst_port": "9090",
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
},
],
}
[
Rule(
id=1,
class_id=1,
type="ip",
addr_type="network",
addr="192.168.1.0/24",
protocol=None,
port_type=None,
port=None,
protocol=None,
src_addr_type=None,
src_addr=None,
dst_addr_type=None,
dst_addr=None,
src_port_type=None,
src_port=None,
dst_port_type=None,
dst_port=None,
created_at=DateTime(2017, 10, 5, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2017, 10, 5, 12, 20, 2, tzinfo=Timezone('+00:00')),
),
Rule(
id=2,
class_id=1,
type="port",
addr_type=None,
addr=None,
protocol="tcp",
port_type="single",
port="8000",
src_addr_type=None,
src_addr=None,
dst_addr_type=None,
dst_addr=None,
src_port_type=None,
src_port=None,
dst_port_type=None,
dst_port=None,
created_at=DateTime(2017, 10, 5, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2017, 10, 5, 12, 20, 2, tzinfo=Timezone('+00:00')),
),
Rule(
id=1,
class_id=1,
addr_type=None,
addr=None,
port_type=None,
port=None,
packet="packet",
protocol="tcp",
src_addr_type="network",
src_addr="192.168.1.0/24",
dst_addr_type="network",
dst_addr="172.64.1.0/24",
src_port_type="single",
src_port="8000",
dst_port_type="single",
dst_port="9090",
created_at=DateTime(2017, 10, 5, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2017, 10, 5, 12, 20, 2, tzinfo=Timezone('+00:00')),
),
]
[
{
id: 1,
classId: 1,
type: "ip",
addrType: "network",
addr: "192.168.1.0/24",
protocol: null,
portType: null,
port: null,
srcAddrType: null,
srcAddr: null,
dstAddrType: null,
dstAddr: null,
srcPortType: null,
srcPort: null,
dstPortType: null,
dstPort: null,
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
},
{
id: 1,
classId: 1,
type: "port",
addrType: null,
addr: null,
protocol: "tcp",
portType: "single",
port: "8000",
srcAddrType: null,
srcAddr: null,
dstAddrType: null,
dstAddr: null,
srcPortType: null,
srcPort: null,
dstPortType: null,
dstPort: null,
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
},
{
id: 1,
classId: 1,
type: "packet",
addrType: null,
addr: null,
portType: null,
port: null,
protocol: "tcp",
srcAddrType: "network",
srcAddr: "192.168.1.0/24",
dstAddrType: "network",
dstAddr: "172.64.1.0/24",
srcPortType: "single",
srcPort: "8000",
dstPortType: "single",
dstPort: "9090",
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
];
Parâmetros da url
Campo | Descrição |
---|---|
class_id | int Identificador da classe ao qual a regra pertence |
Requisição
Campo | Descrição |
---|---|
class_id | int Identificador da classe ao qual a regra pertence |
Resposta
Campo | Descrição |
---|---|
id | int Idendificador da regra |
class_id | int Identificador da classe ao qual a regra pertence |
addr_type | string Tipo do valor de endereço |
addr | string Endereço IP ou rede da regra |
protocol | string Protocolo de rede da regra |
port_type | string Tipo do valor de porta de rede |
port | string Porta ou faixa de portas da regra |
port_type | string Tipo do valor de porta de rede |
port | string Porta ou faixa de portas da regra |
created_at | string Data de criação
|
updated_at | string Data da última edição
|