Skip to content

Commit

Permalink
Merge pull request #682 from skateman/api-provider-validation
Browse files Browse the repository at this point in the history
Expose the verify_credentials action for /api/providers
  • Loading branch information
lpichler committed Oct 4, 2019
2 parents 4230a44 + 5b61ddf commit 8e85a28
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/controllers/api/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions config/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e85a28

Please sign in to comment.