From 5b61ddf5457231ceb827ac3ed9d7a89349b98c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Hal=C3=A1sz?= Date: Wed, 2 Oct 2019 14:28:46 +0200 Subject: [PATCH] Expose the verify_credentials action for /api/providers --- app/controllers/api/providers_controller.rb | 9 +++++++++ config/api.yml | 2 ++ 2 files changed, 11 insertions(+) diff --git a/app/controllers/api/providers_controller.rb b/app/controllers/api/providers_controller.rb index 68410e6c85..20d691528a 100644 --- a/app/controllers/api/providers_controller.rb +++ b/app/controllers/api/providers_controller.rb @@ -114,6 +114,15 @@ def change_password_resource(type, id, data = {}) end end + def verify_credentials_resource(_type, _id, data = {}) + klass = fetch_provider_klass(collection_class(:providers), data) + zone_name = fetch_zone(data).name + task_id = klass.verify_credentials_task(current_user, zone_name, data) + action_result(true, 'Credentials sent for verification', :task_id => task_id) + rescue => err + action_result(false, err.to_s) + end + private def provider_options(type) diff --git a/config/api.yml b/config/api.yml index 5b22b95976..3ad6f0cd1a 100644 --- a/config/api.yml +++ b/config/api.yml @@ -2297,6 +2297,8 @@ :identifier: ems_infra_edit - :name: resume :identifier: ems_infra_edit + - :name: verify_credentials + :identifier: ems_infra_new :resource_actions: :get: - :name: read