Add API-Endpoint and definition for update_domain

Enables updating/synchronizing domains in background
to avoid front end timing out when updating too many domains
This commit is contained in:
Benjamin Wind 2019-04-29 14:29:50 +02:00
parent f95adf3ea3
commit 1acd246110
2 changed files with 23 additions and 0 deletions

View File

@ -509,3 +509,12 @@ def api_get_zones(server_id):
else: else:
domain_obj_list = Domain.query.all() domain_obj_list = Domain.query.all()
return json.dumps(domain_schema.dump(domain_obj_list)), 200 return json.dumps(domain_schema.dump(domain_obj_list)), 200
#endpoint to snychronize Domains in background
@csrf.exempt
@api_blueprint.route('/sync_domains', methods=['GET'])
@apikey_auth
def sync_domains():
domain = Domain()
domain.update()
return 'Finished synchronization in background', 200

View File

@ -42,6 +42,20 @@ paths:
items: items:
$ref: '#/definitions/Server' $ref: '#/definitions/Server'
'/sync_domains':
get:
security:
- APIKeyHeader: []
summary: Sync PDNS with PDNSAdmin
operationId: synchronizeDomains
tags:
- pdnsadmin_zones
responses:
'200':
description: Synchronize PDNS Domains with PDNSAdmin
'403':
description: Wrong authentication
'/servers/{server_id}': '/servers/{server_id}':
get: get:
security: security: