Esta é uma API de gerenciamento da configurações do serviço DNS.
API de busca configuração do DNS.
Exemplo de requisição
GET /api/dns/resolver/service HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dns_resolver.get_service_config()
print(response.payload)
const response = await sdk.dns.getServiceConfig();
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"listen_addresses": [
{
"address": "127.0.0.1",
"port": 53
}
],
"allow_from": [
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
],
"max_cache_ttl": 86400,
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
ServiceConfig(
listen_addresses=[
ListenAddress(
address="127.0.0.1",
port=53
)
],
allow_from=[
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
],
max_cache_ttl=86400,
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'))
)
{
listenAddresses: [
{
address: "127.0.0.1",
port: 53
}
],
allowFrom: [
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
],
maxCacheTtl: 86400,
createdAt: "2017-10-05T12:20:02.932000+00:00",
updatedAt: "2017-11-05T12:20:02.932000+00:00"
}
API de edição da configuração do serviço DNS.
Exemplo de requisição
PUT /api/dns/resolver/service HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
{
"apply": true,
"listen_addresses": [
{
"address": "127.0.0.1",
"port": 53
}
],
"allow_from": [
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
],
"max_cache_ttl": 86400
}
from itflex_sdk.dns_resolver.types import UpdateServiceConfigRequest
request = UpdateServiceConfigRequest(
apply=True,
listen_addresses=[
ListenAddress(
address="127.0.0.1",
port=53
),
],
allow_from=[
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
],
max_cache_ttl=86400,
)
response = sdk.dns_resolver.update_service_config(request)
print(response.payload)
const response = await sdk.dns.updateServiceConfig({
apply: true,
listenAddresses: [
{
address: "127.0.0.1",
port: 53
}
],
allowFrom: ["127.0.0.0/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
maxCacheTtl: 86400
});
console.log(response.payload);
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
{
"listen_addresses": [
{
"address": "127.0.0.1",
"port": 53
}
],
"allow_from": [
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
],
"max_cache_ttl": 86400,
"created_at": "2017-10-05T12:20:02.932000+00:00",
"updated_at": "2017-11-05T12:20:02.932000+00:00",
}
ServiceConfig(
listen_addresses=[
ListenAddress(
address="127.0.0.1",
port=53
),
],
allow_from=[
"127.0.0.0/8",
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
],
max_cache_ttl=86400,
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'))
)
{
listenAddresses: [
{
address: "127.0.0.1",
port: 53
}
],
allowFrom: ["127.0.0.0/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"],
maxCacheTtl: 86400,
createdAt: "2017-10-05T12:20:02.932000+00:00",
updatedAt: "2017-11-05T12:20:02.932000+00:00"
}
API para aplicar as configurações do serviço DNS
Exemplo de requisição
POST /api/dns/resolver/service/apply HTTP/1.1
Host: api.exemplo.com
Accept: application/json
Authorization: Bearer <Access-Token>
response = sdk.dns_resolver.apply()
const response = await sdk.dns.apply()
Exemplo de resposta
HTTP/1.1 200 OK
Content-Type: application/json
Requisição
Campo | Descrição |
---|---|
apply | bool Flag para aplicar o provisionamento das configurações do serviço de DNS Padrão: |
listen_addresses | arrayrequired Lista de endereços de escuta do serviço Padrão: |
allow_from | arrayrequired Lista de redes permitidas para consulta
Padrão: |
max_cache_ttl | intrequired Tempo máximo de cache das resoluções do endereço Padrão: |
Resposta
Campo | Descrição |
---|---|
listen_addresses | array Lista de endereços de escuta do serviço |
allow_from | array Lista de redes permitidas para consulta |
max_cache_ttl | int Tempo máximo de cache das resoluções do endereço |
created_at | string Data de criação
|
updated_at | string Data da última edição
|