Esta é uma API de gerenciamento políticas do DBC.
API de listagem de políticas do DBC.
Exemplo de requisição
GET /api/dbc/policies HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_policies()
print(response.payload)
const response = sdk.dbc.getPolicies();
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"policies": [
{
"id": 1,
"name": "policy01",
"classes": [
{
"id": "default",
"name": "Default",
"order": 1,
"priority_type": "pfifo",
"priority": 0,
"rate": 50,
"ceil": 100,
},
{
"id": "1",
"name": "class01",
"order": 2,
"priority_type": "pfifo",
"priority": 1,
"rate": 50,
"ceil": 100,
},
],
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
},
]
}
[
Policy(
id=1,
name="policy01",
classes=[
Class(
id="default",
name="Default",
order=1,
priority_type="pfifo",
priority=0,
rate=50,
ceil=100,
),
Class(
id="1",
name="class01",
order=2,
priority_type="pfifo",
priority=1,
rate=50,
ceil=100,
),
],
created_at=DateTime(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00'))
)
]
[
{
id: 1,
name: "policy01",
classes: [
{
id: "default",
name: "Default",
order: 1,
priorityType: "pfifo",
priority: 0,
rate: 50,
ceil: 100
},
{
id: "1",
name: "class01",
order: 2,
priorityType: "pfifo",
priority: 1,
rate: 50,
ceil: 100
}
],
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
];
API de busca de uma política existente.
id
Exemplo de requisição
GET /api/dbc/policies/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_policy(id=1)
print(response.payload)
const response = sdk.dbc.getPolicy({ id: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "policy01",
"classes": [
{
"id": "1",
"name": "class01",
"order": 2,
"priority_type": "pfifo",
"priority": 1,
"rate": 100,
"ceil": 100,
},
],
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00"
}
Policy(
id=1,
name="policy01",
classes=[
Class(
id="1",
name="class01",
order=2,
priority_type="pfifo",
priority=1,
rate=100,
ceil=100,
),
],
created_at=DateTime(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
name: "policy01",
classes: [
{
id: "1",
name: "class01",
order: 2,
priorityType: "pfifo",
priority: 1,
rate: 100,
ceil: 100
}
],
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
API de busca completa da política do DBC contendo a listagem de classes e regras.
id
/full
Exemplo de requisição
GET /api/dbc/policies/1/full HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.get_full_policy(id=1)
print(response.payload)
const response = sdk.dbc.getFullPolicy({ id: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "policy01",
"classes": [
{
"id": "1",
"name": "class01",
"order": 2,
"priority_type": "pfifo",
"priority": 1,
"rate": 100,
"ceil": 100,
"rules": [
{
"id": 1,
"type": "ip",
"addr_type": "network",
"addr": "192.168.1.0/24",
"protocol": null,
"port_type": null,
"port": null,
"protocol": 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,
},
],
},
],
"createdAt": "2017-10-05T15:20:02.000Z",
"updatedAt": "2017-11-05T15:20:02.000Z"
}
Policy(
id=1,
name="policy01",
classes=[
Class(
id="1",
name="class01",
order=2,
priority_type="pfifo",
priority=1,
rate=100,
ceil=100,
rules=[
Rule(
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, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
name: "policy01",
classes: [
{
id: "1",
name: "class01",
order: 2,
priorityType: "pfifo",
priority: 1,
rate: 100,
ceil: 100,
rules: [
{
id: 1,
type: "ip",
addrType: "network",
addr: "192.168.1.0/24",
protocol: null,
portType: null,
port: null,
protocol: null,
srcAddr_type: null,
srcAddr: null,
dstAddr_type: 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"
}
API de cadastro de uma politica.
Exemplo de requisição
POST /api/dbc/policies HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"name": "policy01",
"apply": false,
}
from itflex_sdk.dbc.types import CreatePolicyRequest
request = CreatePolicyRequest(
name="policy01",
apply=False,
)
response = sdk.dbc.create_policy(request)
print(response.payload)
const policy = sdk.dbc.types.Policy();
policy.name = "policy01";
policy.apply = false;
const response = sdk.dbc.createPolicy(policy);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "policy01",
"classes": [],
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
Policy(
id=1,
name="policy01",
classes=[],
created_at=DateTime(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTIme(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
name: "policy01",
classes: [],
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
API de edição de uma política existente.
id
Exemplo de requisição
PUT /api/dbc/policies/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"name": "policy01_updated",
"apply": false,
}
from itflex_sdk.dbc.types import UpdatePolicyRequest
request = UpdatePolicyRequest(
id=1,
name="policy01_updated",
apply=False,
)
response = sdk.dbc.update_policy(request)
print(response.payload)
const policy = {
id: 1,
name: "policy01_updated",
apply: false,
};
const response = sdk.dbc.updatePolicy(policy);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "policy01_updated",
"classes": [],
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
Policy(
id=1,
name="policy01_updated",
classes=[],
created_at=DateTime(2017, 10, 5, 15, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2017, 11, 5, 15, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
name: "policy01_updated",
classes: [],
createdAt: "2017-10-05T15:20:02.000Z",
updatedAt: "2017-11-05T15:20:02.000Z"
}
API de exclusão de uma política existente.
id
Exemplo de requisição
DELETE /api/dbc/policies/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dbc.delete_policy(id=1)
const response = sdk.dbc.deletePolicy({ 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 política |
Requisição
Políticas associadas com conexões não podem ser apagadas
Campo | Descrição |
---|---|
id | int Idendificador da política |
name | stringrequired único Nome da política |
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 política |
name | string Nome da política |
classes | Array<Class> Lista de classes da política. A descrição dos campos do objeto |
created_at | string Data de criação
|
updated_at | string Data da última edição
|