Esta é uma API de configuração do host do domínio DNS que será atualizado pelo serviço de SDWAN quando houver uma alteração de status de uma tabela dentro de uma política de roteamento.
API de listagem de hosts
dns_zone_id
/hosts
Exemplo de requisição
GET /api/sdwan/dns/zones/1/hosts HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.sdwan.get_dns_hosts(dns_zone_id=1)
print(response.payload)
const response = sdk.sdwan.getDnsHosts({dnsZoneId: 1});
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"dns_hosts": [
{
"id": 1,
"dns_zone_id": 1,
"enabled": true,
"hostname": "git.foo.com.br",
"ttl": null,
"policy_routing_id": 1,
"priorities": [[1, 2], [3]],
"routing_table_addresses": [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
],
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
},
{
"id": 2,
"dns_zone_id": 2,
"enabled": true,
"hostname": "git.bar.com.br",
"ttl": 380,
"policy_routing_id": 2,
"priorities": [[3], [4]],
"routing_table_addresses": [
{"id": 3, "addr": "200.200.200.1"},
{"id": 4, "addr": "189.189.189.2"},
],
"created_at": "2018-12-13T14:15:02.932000+00:00",
"updated_at": "2018-12-13T14:15:02.932000+00:00"
}
]
}
[
DnsHost(
id=1,
dns_zone_id=1,
enabled=True,
hostname="git.foo.com.br",
ttl=None,
policy_routing_id=1,
priorities=[[1, 2], [3]],
routing_table_addresses=[
RoutingTableAddress(id=1, addr="200.200.198.1"),
RoutingTableAddress(id=2, addr="200.172.208.45"),
RoutingTableAddress(id=3, addr=None),
],
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
),
DnsHost(
id=2,
dns_zone_id=2,
enabled=True,
hostname="git.bar.com.br",
ttl=380,
policy_routing_id=2,
priorities=[[3], [4]],
routing_table_addresses=[
RoutingTableAddress(id=3, addr="200.200.200.1"),
RoutingTableAddress(id=4, addr="189.189.189.2"),
],
created_at=DateTime(2018, 12, 13, 14, 15, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 14, 15, 2, tzinfo=Timezone('+00:00'))
)
]
[
{
id: 1,
dnsZoneId: 1,
enabled: true,
hostname: "git.foo.com.br",
ttl: null,
policyRoutingId: 1,
priorities: [[1, 2], [3]],
routingTableAddresses: [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
],
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
},
{
id: 2,
dnsZoneId: 2,
enabled: true,
hostname: "git.bar.com.br",
ttl: 380,
policyRoutingId: 2,
priorities: [[1], [2]],
routingTableAddresses: [
{"id": 3, "addr": "200.200.200.1"},
{"id": 4, "addr": "189.189.189.2"},
],
createdAt: "2018-12-13T14:15:02.000Z",
updatedAt: "2018-12-13T14:15:02.000Z"
}
];
API de consulta de um host
dns_zone_id
/hosts/id
Exemplo de requisição
GET /api/sdwan/dns/zones/1/hosts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.sdwan.get_dns_host(id=1, dns_zone_id=1)
print(response.payload)
const response = sdk.sdwan.getDnsHost({ id: 1, dnsZoneId: 1 });
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"dns_zone_id": 1,
"enabled": true,
"hostname": "git.foo.com.br",
"ttl": null,
"policy_routing_id": 1,
"priorities": [[1, 2], [3]],
"routing_table_addresses": [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
],
"created_at": "2018-12-13T12:20:02.932000+00:00",
"updated_at": "2018-12-13T12:20:02.932000+00:00"
}
DnsHost(
id=1,
dns_zone_id=1,
enabled=True,
hostname="git.foo.com.br",
ttl=None,
policy_routing_id=1,
priorities=[[1, 2], [3]],
routing_table_addresses=[
RoutingTableAddress(id=1, addr="200.200.198.1"),
RoutingTableAddress(id=2, addr="200.172.208.45"),
RoutingTableAddress(id=3, addr=None),
],
created_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 13, 12, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
dnsZoneId: 1,
enabled: true,
hostname: "git.foo.com.br",
ttl: null,
policyRoutingId: 1,
priorities: [[1, 2], [3]],
routingTableAddresses: [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
],
createdAt: "2018-12-13T12:20:02.000Z",
updatedAt: "2018-12-13T12:20:02.000Z"
}
API de criação de host
dns_zone_id
/hosts
Exemplo de requisição
POST /api/sdwan/dns/zones/1/hosts HTTP/1.1
Host: api.exemplo.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enabled": true,
"hostname": "git.foo.com.br",
"ttl": null,
"policy_routing_id": 1,
"priorities": [[1, 2], [3]],
"routing_table_addresses": [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
],
}
from itflex_sdk.sdwan.types import CreateDnsHostRequest, RoutingTableAddress
request = CreateDnsHostRequest(
dns_zone_id=1,
enabled=True,
hostname="git.foo.com.br",
ttl=None,
policy_routing_id=1,
priorities=[[1, 2], [3]],
routing_table_addresses=[
RoutingTableAddress(id=1, addr="200.200.198.1"),
RoutingTableAddress(id=2, addr="200.172.208.45"),
RoutingTableAddress(id=3, addr=None),
],
)
response = sdk.sdwan.create_dns_host(request)
print(response.payload)
const dnsHost = sdk.sdwan.types.DnsHost();
dnsHost.dnsZoneId = 1;
dnsHost.enabled = true;
dnsHost.hostname = "git.foo.com.br";
dnsHost.ttl = null;
dnsHost.policyRoutingId = 1;
dnsHost.priorities = [[1, 2], [3]];
dnsHost.routingTableAddresses = [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
];
const response = sdk.sdwan.createDnsHost(dnsHost);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"dns_zone_id": 1,
"enabled": true,
"hostname": "git.foo.com.br",
"ttl": null,
"policy_routing_id": 1,
"priorities": [[1, 2], [3]],
"routing_table_addresses": [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
],
"created_at": "2018-12-14T09:20:02.932000+00:00",
"updated_at": "2018-12-14T09:20:02.932000+00:00"
}
DnsHost(
id=1,
dns_zone_id=1,
enabled=True,
hostname="git.foo.com.br",
ttl=None,
policy_routing_id=1,
priorities=[[1, 2], [3]],
routing_table_addresses=[
RoutingTableAddress(id=1, addr="200.200.198.1"),
RoutingTableAddress(id=2, addr="200.172.208.45"),
RoutingTableAddress(id=3, addr=None),
],
created_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00'))
)
{
id: 1,
dnsZoneId: 1,
enabled: true,
hostname: "git.foo.com.br",
ttl: null,
policyRoutingId: 1,
priorities: [[1, 2], [3]],
routingTableAddresses: [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
],
createdAt: "2018-12-14T09:20:02.000Z",
updatedAt: "2018-12-14T09:20:02.000Z"
}
API de edição de um host
dns_zone_id
/hosts/id
Exemplo de requisição
PUT /api/sdwan/dns/zones/1/hosts/1 HTTP/1.1
Host: api.exemplo.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer <Access-Token>
{
"enabled": true,
"hostname": "git.foo.com.br",
"ttl": 350,
"policy_routing_id": 1,
"priorities": [[1, 2], [3], [4]],
"routing_table_addresses": [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
{"id": 4, "addr": "192.168.36.9"},
],
}
from itflex_sdk.sdwan.types import RoutingTableAddress, UpdateDnsHostRequest
request = UpdateDnsHostRequest(
id=1,
dns_zone_id=1,
enabled=True,
hostname="git.foo.com.br",
ttl=350,
policy_routing_id=1,
priorities=[[1, 2], [3], [4]],
routing_table_addresses=[
RoutingTableAddress(id=1, addr="200.200.198.1"),
RoutingTableAddress(id=2, addr="200.172.208.45"),
RoutingTableAddress(id=3, addr=None),
RoutingTableAddress(id=4, addr="192.168.36.9"),
],
)
response = sdk.sdwan.update_dns_host(request)
print(response.payload)
const dnsHost = {
dnsZoneId: 1,
enabled: true,
hostname: "git.foo.com.br",
ttl: 350,
policyRoutingId: 1,
priorities: [[1, 2], [3], [4]],
routingTableAddresses: [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
{"id": 4, "addr": "192.168.36.9"},
],
};
const response = sdk.sdwan.updateDnsHost(routingRule);
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"dns_zone_id": 1,
"enabled": true,
"hostname": "git.foo.com.br",
"ttl": 350,
"policy_routing_id": 1,
"priorities": [[1, 2], [3], [4]],
"routing_table_addresses": [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
{"id": 4, "addr": "192.168.36.9"},
],
"created_at": "2018-12-14T09:20:02.932000+00:00",
"updated_at": "2018-12-14T10:30:02.932000+00:00"
}
DnsHost(
id=1,
dns_zone_id=1,
enabled=True,
hostname="git.foo.com.br",
ttl=350,
policy_routing_id=1,
priorities=[[1, 2], [3], [4]],
routing_table_addresses=[
RoutingTableAddress(id=1, addr="200.200.198.1"),
RoutingTableAddress(id=2, addr="200.172.208.45"),
RoutingTableAddress(id=3, addr=None),
RoutingTableAddress(id=4, addr="192.168.36.9"),
],
created_at=DateTime(2018, 12, 14, 9, 20, 2, tzinfo=Timezone('+00:00')),
updated_at=DateTime(2018, 12, 14, 10, 30, 2, tzinfo=Timezone('+00:00'))
)
{
dnsZoneId: 1,
enabled: true,
hostname: "git.foo.com.br",
ttl: 350,
policyRoutingId: 1,
priorities: [[1, 2], [3], [4]],
routingTableAddresses: [
{"id": 1, "addr": "200.200.198.1"},
{"id": 2, "addr": "200.172.208.45"},
{"id": 3, "addr": null},
{"id": 4, "addr": "192.168.36.9"},
],
createdAt: "2018-12-14T09:20:02.000Z",
updatedAt: "2018-12-14T10:30:02.000Z"
}
API de exclusão de um host
dns_zone_id
/hosts/id
Exemplo de requisição
DELETE /api/sdwan/dns/zones/1/hosts/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.sdwan.delete_dns_host(id=1, dns_zone_id=1)
const response = sdk.sdwan.deleteDnsHost({ id: 1, dnsZoneId: 1 });
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
Parâmetros da url
Campo | Descrição |
---|---|
id | int Identificador do host |
Requisição
Campo | Descrição |
---|---|
id | int Identificador do host. |
dns_zone_id | intrequerido Identificador da zona do host. |
enabled | boolrequerido Flag que indica se a configuração de host está habilitada. |
hostname | stringrequerido único Endereço do hostname que será atualizado. Deve ser um subendereço da zona do campo |
ttl | int Tempo de expiração, em segundos, do apontamento DNS. Quando não for preenchido, usa o tempo configurado para a zona. Valor padrão: Valor mínimo: Valor máximo: |
policy_routing_id | intrequerido Política de roteamento a ser utilizada para o tráfego desta regra. |
priorities | array<array<int>>requerido Prioridades do apontamento DNS. O primeiro nível do array é a prioridade, o segundo nível são os identificadores das tabelas de roteamento que serão usadas na prioridade. Podem ser colocados mais de uma tabela por nível. Exemplo: a tabela
Neste exemplo, a prioridade é que o apontamento seja balanceado entre as tabelas
|
routing_table_addresses | array<object>requerido Mapeamento de endereços de todas as tabelas de roteamento presentes no campo |
routing_table_addresses[].id | intrequerido Identificador da tabela de roteamento que será configurado o endereço de apontamento para o host. |
routing_table_addresses[].addr | string Endereço IP de apontamento da tabela de roteamento para o host. |
Resposta
Campo | Descrição |
---|---|
id | int Identificador do host. |
dns_zone_id | int Identificador da zona do host. |
enabled | bool Flag que indica se a configuração de host está habilitada. |
hostname | string Endereço do hostname que será atualizado. |
ttl | int Tempo de expiração, em segundos, do apontamento DNS. |
policy_routing_id | int Política de roteamento a ser utilizada para o tráfego desta regra. |
priorities | array<array<int>> Prioridades do apontamento DNS. |
routing_table_addresses | array<object> Mapeamento de endereços para todas as tabelas de roteamento presentes no campo |
routing_table_addresses[].id | int Identificador da tabela de roteamento que será configurado o endereço de apontamento para o host. |
routing_table_addresses[].addr | string Endereço IP de apontamento da tabela de roteamento para o host. |
created_at | string Data de criação
|
updated_at | string Data da última edição
|