From 1acd24611071068e625b3ffbf5c209771e2c5545 Mon Sep 17 00:00:00 2001 From: Benjamin Wind Date: Mon, 29 Apr 2019 14:29:50 +0200 Subject: [PATCH] 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 --- app/blueprints/api.py | 9 +++++++++ app/swagger-spec.yaml | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/blueprints/api.py b/app/blueprints/api.py index 0f1c6a8..6439d84 100644 --- a/app/blueprints/api.py +++ b/app/blueprints/api.py @@ -509,3 +509,12 @@ def api_get_zones(server_id): else: domain_obj_list = Domain.query.all() 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 diff --git a/app/swagger-spec.yaml b/app/swagger-spec.yaml index db579aa..fc0283f 100644 --- a/app/swagger-spec.yaml +++ b/app/swagger-spec.yaml @@ -42,6 +42,20 @@ paths: items: $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}': get: security: