public string GetUrl(ConsoleUrlOptions options) { // append guacamole params to url if (this.ConsoleConnectionInfo != null && !string.IsNullOrEmpty(this.Url)) { // guacamole expects the last part of the url to be a base64 encoded string combining the // connection id, connection type (c for connection, g for group), and provider name // separated by null characters var connectionId = Convert.ToBase64String( Encoding.Default.GetBytes( $"{this.Id}{Convert.ToChar(0x0)}c{Convert.ToChar(0x0)}{options.Guacamole.ProviderName}")); var guacamoleUrlFragment = $"/#/client/{connectionId}"; return($"{this.Url}{guacamoleUrlFragment}"); } if (!string.IsNullOrEmpty(this.Url)) { return(this.Url); } return($"{options.Vsphere.Url}/vm/{this.Id}/console"); }
public ConsoleUrlResolver(ConsoleUrlOptions consoleUrlOptions) { _consoleUrlOptions = consoleUrlOptions; }