Encaminhamento de Zonas

Esta é uma API para cadastro de Encaminhamento de Zonas.

Listar Encaminhamento de Zonas Paginadas

API de listagem de encaminhamento de zonas paginadas. Ver documentação de paginação.

GET /api/dns/resolver/forwards
GET /api/dns/resolver/forwards?cursor=0&size=15

Exemplo de requisição

GET /api/dns/resolver/forwards HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.dns_resolver.types import GetForwardZonesPageRequest

request = GetForwardZonesPageRequest(cursor=0, size=15)
pages = sdk.dns_resolver.get_forward_zones_pages(request)

response = pages.next()
print(response.payload)
const pages = sdk.dns.getFowardZonesPages();
const response = pages.next();
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "cursor": {"current": 0, "next": null, "previous": null},
  "forward_zones": [
    {
      "id": 1,
      "domain": "testing.lan",
      "addresses": [
        {
          "address": "192.168.10.10",
          "port": 53
        }
      ],
    }
  ],
}
[
  ForwardZone(
    id=1,
    domain="testing.lan",
    addresses=[
      Address(
        address="192.168.10.10",
        port=53
      ),
    ],
    created_at=DateTime(2018, 11, 26, 10, 16, 39, tzinfo=Timezone('+00:00')),
    updated_at=DateTime(2018, 11, 26, 10, 16, 39, tzinfo=Timezone('+00:00'))
  ),
]
[
  {
    id: 1,
    domain: "testing.lan",
    addresses: [
      {
        address: "192.168.10.10",
        port: 53
      }
    ],
    createdAt: "2017-10-05T12:20:02.932000+00:00",
    updatedAt: "2017-11-05T12:20:02.932000+00:00"
  }
];

Buscar um Encaminhamento de Zona

API de busca de um encaminhamento de zona.

GET /api/dns/resolver/forwards/id

Exemplo de requisição

GET /api/dns/resovler/forwards/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.dns_resolver.types import GetForwardZoneRequest

request = GetForwardRequest(id=1)

response = sdk.dns_resolver.get_forward_zone(request)
print(response.payload)
const pages = await sdk.dns.getForwardZone({ id: 1 });
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "domain": "testing.lan",
  "addresses": [
    {
      "address": "192.168.10.10",
      "port": 53
    }
  ],
  "created_at": "2017-10-05T12:20:02.932000+00:00",
  "updated_at": "2017-11-05T12:20:02.932000+00:00",
}
ForwardZone(
  id=1,
  domain="testing.lan",
  addresses=[
    Address(
      address="192.168.10.10",
      port=53
    ),
  ]
  created_at=DateTime(2018, 11, 26, 10, 16, 39, tzinfo=Timezone('+00:00')),
  updated_at=DateTime(2018, 11, 26, 10, 16, 39, tzinfo=Timezone('+00:00'))
)

{
  id: 1,
  domain: "testing.lan",
  addresses: [
    {
      address: "192.168.10.10",
      port: 53
    }
  ],
  createdAt: "2017-10-05T12:20:02.932000+00:00",
  updatedAt: "2017-11-05T12:20:02.932000+00:00"
}

Criar um Encaminhamento de Zona

API para criação de um encaminhamento de zona

POST /api/dns/resolver/forwards

Exemplo de requisição

POST /api/dns/resolver/forwards/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "apply": true,
  "domain": "testing.lan",
  "addresses": [
    {
      "address": "192.168.10.10",
      "port": 53
    },
  ]
}
from itflex_sdk.dns_resolver.types import CreateForwardZoneRequest

request = CreateForwardZoneRequest(
  apply=True,
  domain="testing.lan",
  addresses=[
    Address(
      address="192.168.10.10",
      port=53
    ),
  ]
)

response = sdk.dns_resolver.create_forward_zone(request)
print(response.payload)
const response = await sdk.dns.createForwardZone({
  apply: true,
  domain: "testing.lan",
  addresses: [
    {
      address: "192.168.10.10",
      port: 53
    }
  ]
});
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "domain": "testing.lan",
  "addresses": [
    {
      "address": "192.168.10.10",
      "port": 53
    }
  ],
  "created_at": "2017-10-05T12:20:02.932000+00:00",
  "updated_at": "2017-11-05T12:20:02.932000+00:00",
}
ForwardZone(
  id=1,
  domain="testing.lan",
  addresses=[
    Address(
      address="192.168.10.10",
      port=53
    ),
  ]
  created_at=DateTime(2018, 11, 26, 10, 16, 39, tzinfo=Timezone('+00:00')),
  updated_at=DateTime(2018, 11, 26, 10, 16, 39, tzinfo=Timezone('+00:00'))
)
{
  id: 1,
  domain: "testing.lan",
  addresses: [
    {
      address: "192.168.10.10",
      port: 53
    }
  ],
  createdAt: "2017-10-05T12:20:02.932000+00:00",
  updatedAt: "2017-11-05T12:20:02.932000+00:00"
}

Editar um Encaminhamento de Zona

API de edição da encaminhamento de zona.

PUT /api/dns/resolver/forwards/id

Exemplo de requisição

PUT /api/dns/resolver/forwards/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>

{
  "apply": true,
  "domain": "updatedomain.lan",
  "addresses": [
    {
      "address": "192.168.10.10",
      "port": 53
    },
    {
      "address": "192.168.10.12",
      "port": 53
    },
  ]
}
from itflex_sdk.dns_resolver.types import UpdateForwardZoneRequest

request = UpdateForwardZoneRequest(
  apply=True,
  domain="updatedomain.lan",
  addresses=[
    Address(
      address="192.168.10.10",
      port=53
    ),
    Address(
      address="192.168.10.12",
      port=53
    ),
  ]
)

response = sdk.dns_resolver.update_forward_zone(request)
print(response.payload)
const response = await sdk.dns.updateForwardZone({
  id: 1,
  apply: true,
  domain: "updatedomain.lan",
  addresses: [
    {
      address: "192.168.10.10",
      port: 53
    },
    {
      address: "192.168.10.12",
      port: 53
    }
  ]
});
console.log(response.payload);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json

{
  "id": 1,
  "domain": "updatedomain.lan",
  "addresses": [
    {
      "address": "192.168.10.10",
      "port": 53
    },
    {
      "address": "192.168.10.12",
      "port": 53
    }
  ],
  "created_at": "2017-10-05T12:20:02.932000+00:00",
  "updated_at": "2017-11-05T12:20:02.932000+00:00",
}
ForwardZone(
  id=1,
  domain="updatedomain.lan",
  addresses=[
    Address(
      address="192.168.10.10",
      port=53
    ),
    Address(
      address="192.168.10.12",
      port=53
    ),
  ],
  created_at=DateTime(2018, 11, 26, 10, 16, 39, tzinfo=Timezone('+00:00')),
  updated_at=DateTime(2018, 11, 28, 10, 16, 39, tzinfo=Timezone('+00:00'))
)
{
  id: 1,
  domain: "updatedomain.lan",
  addresses: [
    {
      address: "192.168.10.10",
      port: 53
    },
    {
      address: "192.168.10.12",
      port: 53
    }
  ],
  createdAt: "2017-10-05T12:20:02.932000+00:00",
  updatedAt: "2017-11-05T12:20:02.932000+00:00"
}

Deletar um Encaminhamento de Zona

API de deleção de um encaminhamento de zona.

DELETE /api/dns/resolver/forwards/id

Exemplo de requisição

DELETE /api/dns/resolver/forwards/1 HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
from itflex_sdk.dns_resolver.types import DeleteForwardZoneRequest

request = DeleteForwardZoneRequest(id=1)

response = sdk.dns_resolver.delete_forward_zone(request)
print(response.success)
const response = await sdk.dns.deleteForwardZone({ id: 1 });
console.log(response.success);

Exemplo de resposta

HTTP/1.1 200 OK
Content-Type: application/json
True
true

Formato dos dados

Parâmetros da url

Campo Descrição
id int

Idendificador do encaminhamento de zonas

Requisição

Campo Descrição
apply bool

Flag para aplicar o provisionamento do encaminhamento de zonas do serviço de DNS

Padrão: False

domain stringrequired único

Nome do domínio

addresses arrayrequired

Lista de endereços de encaminhamento
addresses.ip: IP do endereço
addresses.port: porta do endereço

Não devem existir endereços duplicados nesta lista. Os dados duplicados podem ser removidos no tratamento dos dados na API.

Resposta

Campo Descrição
domain string

Nome do domínio

addresses array

Lista de endereços de encaminhamento
addresses.ip: IP do endereço
addresses.port: porta do endereço

created_at string

Data de criação

Formato: ISO-8601

updated_at string

Data da última edição

Formato: ISO-8601