Esta é uma API de gerenciamento regras de classes do tipo IP.
API de listagem de regras do tipo IP para uma classe existente.
class_id
/rules/ip
Exemplo de requisição
GET /api/dbc/classes/1/rules/ip HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_ip_rules(class_id=1)
print(response.payload)
const response = sdk.dbc.getIpRules({ classId: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"ip_rules": [
{
"id": 1,
"class_id": 1,
"addr_type": "network",
"addr": "192.168.1.0/24",
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
},
],
}
[
IpRule(
id=1,
class_id=1,
addr_type="network",
addr="192.168.1.0/24",
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,
addrType: "network",
addr: "192.168.1.0/24",
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
];
API de busca de uma regra existente.
class_id
/rules/ip/id
Exemplo de requisição
GET /api/dbc/classes/1/rules/ip/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_ip_rule(class_id=1, id=1)
print(response.payload)
const response = sdk.dbc.getIpRule({ 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,
"addr_type": "network",
"addr": "192.168.1.0/24",
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
IpRule(
id=1,
class_id=1,
addr_type="network",
addr="192.168.1.0/24",
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,
addrType: "network",
addr: "192.168.1.0/24",
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
API de cadastro de uma regra.
class_id
/rules/ip
Exemplo de requisição
POST /api/dbc/classes/1/rules/ip HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"addr_type": "network",
"addr": "192.168.1.0/24",
"apply": false,
}
from itflex_sdk.dbc.types import CreateIpRuleRequest
request = CreateIpRuleRequest(
class_id=1,
addr_type="network",
addr="192.168.1.0/24",
apply=False,
)
response = sdk.dbc.create_ip_rule(request)
print(response.payload)
const rule = sdk.dbc.types.IpRule();
rule.classId = 1;
rule.addrType = "network";
rule.addr = "192.168.1.0/24";
rule.apply = false;
const response = sdk.dbc.createIpRule(rule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"class_id": 1,
"addr_type": "network",
"addr": "192.168.1.0/24",
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
IpRule(
id=1,
class_id=1,
addr_type="network",
addr="192.168.1.0/24",
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,
addrType: "network",
addr: "192.168.1.0/24",
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/ip/id
Exemplo de requisição
PUT /api/dbc/classes/1/rules/ip/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"addr_type": "network",
"addr": "192.168.50.0/24",
"apply": false,
}
from itflex_sdk.dbc.types import UpdateIpRuleRequest
request = UpdateIpRuleRequest(
id=1,
class_id=1,
addr_type="network",
addr="192.168.50.0/24",
apply=False,
)
response = sdk.dbc.update_ip_rule(request)
print(response.payload)
const rule = {
id: 1,
classId: 1,
addrType: "network",
addr: "192.168.50.0/24",
apply: false,
};
const response = sdk.dbc.updateIpRule(rule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"class_id": 1,
"addr_type": "network",
"addr": "192.168.50.0/24",
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
IpRule(
id=1,
class_id=1,
addr_type="network",
addr="192.168.50.0/24",
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,
addrType: "network",
addr: "192.168.50.0/24",
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/ip/id
Exemplo de requisição
DELETE /api/dbc/classes/1/rules/ip/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.delete_ip_rule(class_id=1, id=1)
const response = sdk.dbc.deleteIpRule({ 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 |
addr_type | stringrequired Tipo do valor de endereço Valores possíveis: |
addr | stringrequired único Endereço IP ou rede da regra Endereço deve ser único dentro da classe. Dependendo do valor do campo |
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 |
addr_type | string Tipo do valor de endereço |
addr | string Endereço IP ou rede da regra |
created_at | string Data de criação
|
updated_at | string Data da última edição
|