GUACAMOLE-221: Provide REST API endpoint for retrieving the underlying protocol of a tunnel.

This commit is contained in:
Michael Jumper
2020-11-24 00:44:07 -08:00
parent 5ad3389a23
commit 1b18c51c74
2 changed files with 72 additions and 0 deletions

View File

@@ -79,6 +79,36 @@ angular.module('rest').factory('tunnelService', ['$injector',
};
/**
* Makes a request to the REST API to retrieve the underlying protocol of
* the connection associated with a particular tunnel, returning a promise
* that provides a @link{Protocol} object if successful.
*
* @param {String} tunnel
* The UUID of the tunnel associated with the Guacamole connection
* whose underlying protocol is being retrieved.
*
* @returns {Promise.<Protocol>}
* A promise which will resolve with a @link{Protocol} object upon
* success.
*/
service.getProtocol = function getProtocol(tunnel) {
// Build HTTP parameters set
var httpParameters = {
token : authenticationService.getCurrentToken()
};
// Retrieve the protocol details of the specified tunnel
return requestService({
method : 'GET',
url : 'api/session/tunnels/' + encodeURIComponent(tunnel)
+ '/protocol',
params : httpParameters
});
};
/**
* Retrieves the set of sharing profiles that the current user can use to
* share the active connection of the given tunnel.