Esta é uma API de gerenciamento regras de classes do tipo pacote.
API de listagem de regras do tipo pacote para uma classe existente.
class_id
/rules/packet
Exemplo de requisição
GET /api/dbc/classes/1/rules/packet HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_packet_rules(class_id=1)
print(response.payload)
const response = sdk.dbc.getPacketRules({ classId: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"packet_rules": [
{
"id": 1,
"class_id": 1,
"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",
},
],
}
[
PacketRule(
id=1,
class_id=1,
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,
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"
}
];
API de busca de uma regra existente.
class_id
/rules/packet/id
Exemplo de requisição
GET /api/dbc/classes/1/rules/packet/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_packet_rule(class_id=1, id=1)
print(response.payload)
const response = sdk.dbc.getPacketRule({ classId: 1, id: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"class_id": 1,
"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",
}
PacketRule(
id=1,
class_id=1,
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,
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"
}
API de cadastro de uma regra.
class_id
/rules/packet
Exemplo de requisição
POST /api/dbc/classes/1/rules/packet HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"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",
"apply": false,
}
from itflex_sdk.dbc.types import CreatePacketRuleRequest
request = CreatePacketRuleRequest(
class_id=1,
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",
apply=False,
)
response = sdk.dbc.create_packet_rule(request)
print(response.payload)
const rule = sdk.dbc.types.PacketRule();
rule.classId = 1;
rule.protocol = "tcp";
rule.srcAddrType = "network";
rule.srcAddr = "192.168.1.0/24";
rule.dstAddrType = "network";
rule.dstAddr = "172.64.1.0/24";
rule.srcPortType = "single";
rule.srcPort = "8000";
rule.dstPortType = "single";
rule.dstPort = "9090";
rule.apply = false;
const response = sdk.dbc.createPacketRule(rule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"class_id": 1,
"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",
}
PacketRule(
id=1,
class_id=1,
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,
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"
}
API de edição de uma regra existente.
class_id
/rules/packet/id
Exemplo de requisição
PUT /api/dbc/classes/1/rules/packet/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"protocol": "tcp",
"src_addr_type": "network",
"src_addr": "192.168.1.0/24",
"dst_addr_type": "ip",
"dst_addr": "172.64.1.0",
"src_port_type": "single",
"src_port": "8000",
"dst_port_type": "range",
"dst_port": "9090:9095",
"apply": false,
}
from itflex_sdk.dbc.types import UpdatePacketRuleRequest
request = UpdatePacketRuleRequest(
id=1,
class_id=1,
protocol="tcp",
src_addr_type="network",
src_addr="192.168.1.0/24",
dst_addr_type="ip",
dst_addr="172.64.1.0",
src_port_type="single",
src_port="8000",
dst_port_type="range",
dst_port="9090:9095",
apply=False,
)
response = sdk.dbc.update_packet_rule(request)
print(response.payload)
const rule = {
id: 1,
classId: 1,
protocol: "tcp",
srcAddrType: "network",
srcAddr: "192.168.1.0/24",
dstAddrType: "ip",
dstAddr: "172.64.1.0",
srcPortType: "single",
srcPort: "8000",
dstPortType: "range",
dstPort: "9090:9095",
apply: false,
};
const response = sdk.dbc.updatePacketRule(rule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"class_id": 1,
"protocol": "tcp",
"src_addr_type": "network",
"src_addr": "192.168.1.0/24",
"dst_addr_type": "ip",
"dst_addr": "172.64.1.0",
"src_port_type": "single",
"src_port": "8000",
"dst_port_type": "range",
"dst_port": "9090:9095",
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
PacketRule(
id=1,
class_id=1,
protocol="tcp",
src_addr_type="network",
src_addr="192.168.1.0/24",
dst_addr_type="ip",
dst_addr="172.64.1.0",
src_port_type="single",
src_port="8000",
dst_port_type="range",
dst_port="9090:9095",
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,
protocol: "tcp",
srcAddrType: "network",
srcAddr: "192.168.1.0/24",
dstAddrType: "ip",
dstAddr: "172.64.1.0",
srcPortType: "single",
srcPort: "8000",
dstPortType: "range",
dstPort: "9090:9095",
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
API de exclusão de uma regra existente.
class_id
/rules/packet/id
Exemplo de requisição
DELETE /api/dbc/classes/1/rules/packet/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.delete_packet_rule(class_id=1, id=1)
const response = sdk.dbc.deletePacketRule({ classId: 1, id: 1 });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
Parâmetros da url
Campo | Descrição |
---|---|
id | int Idendificador da regra |
class_id | int Identificador da classe ao qual a regra pertence |
Requisição
Campo | Descrição |
---|---|
class_id | intrequerido Identificador da classe ao qual a regra pertence |
protocol | stringrequerido Protocolo de rede da regra Valores possíveis: |
src_addr_type | string Tipo do valor de endereço de origem Valores possíveis: |
src_addr | string Endereço IP ou rede de origem da regra Requerido e único se |
dst_addr_type | string Tipo do valor de endereço de destino Valores possíveis: |
dst_addr | string Endereço IP ou rede de destino da regra Requerido e único se |
src_port_type | string Tipo do valor de porta de rede de origem Valores possíveis: |
src_port | string Porta ou faixa de portas da regra Requerido e unico se As portas devem ter um valor entre Para faixa de portas, usar o seguinte formato: |
dst_port_type | string Tipo do valor de porta de rede de destino Valores possíveis: |
dst_port | string Porta ou faixa de portas da regra Requerido e único se As portas devem ter um valor entre Para faixa de portas, usar o seguinte formato: |
apply | bool Flag que indica se as informações serão provisionadas imediatamente após a criação ou edição Valor padrão: |
Resposta
Campo | Descrição |
---|---|
id | int Idendificador da regra |
class_id | int Identificador da classe ao qual a regra pertence |
protocol | string Protocolo de rede da regra |
src_addr_type | string Tipo do valor de endereço de origem |
src_addr | string Endereço IP ou rede de origem da regra |
dst_addr_type | string Tipo do valor de endereço de destino |
dst_addr | string Endereço IP ou rede de destino da regra |
src_port_type | string Tipo do valor de porta de rede de origem |
src_port | string Porta ou faixa de portas da regra |
dst_port_type | string Tipo do valor de porta de rede de destino |
dst_port | string Porta ou faixa de portas da regra |
created_at | string Data de criação
|
updated_at | string Data da última edição
|