class Multiwoven::Integrations::Destination::Sftp::Client

def check_connection(connection_config)

def check_connection(connection_config)
  connection_config = connection_config.with_indifferent_access
  with_sftp_client(connection_config) do |sftp|
    stream = SecureRandom.uuid
    test_path = "#{connection_config[:destination_path]}/#{stream}"
    test_file_operations(sftp, test_path)
    return success_status
  end
rescue StandardError => e
  handle_exception(e, {
                     context: "SFTP:CHECK_CONNECTION:EXCEPTION",
                     type: "error"
                   })
  failure_status(e)
end