UNPKG

@microsoft/dev-tunnels-ssh

Version:
48 lines 2 kB
"use strict"; // // Copyright (c) Microsoft Corporation. All rights reserved. // Object.defineProperty(exports, "__esModule", { value: true }); exports.SshChannelOpeningEventArgs = void 0; const connectionMessages_1 = require("../messages/connectionMessages"); const vscode_jsonrpc_1 = require("vscode-jsonrpc"); class SshChannelOpeningEventArgs { constructor(request, channel, isRemoteRequest, cancellation) { this.request = request; this.channel = channel; this.isRemoteRequest = isRemoteRequest; /** * Specifies a reason that the channel could not be opened. * * The handler of this event can optionally block the channel by setting * a failure reason. If the event is not handled or the reason remains * `none` then the channel is allowed to open. */ this.failureReason = connectionMessages_1.SshChannelOpenFailureReason.none; /** * Optional message to go along with a failure reason. */ this.failureDescription = null; if (!request) throw new TypeError('A channel open message is required.'); if (!channel) throw new TypeError('A channel is required.'); this.cancellationValue = cancellation !== null && cancellation !== void 0 ? cancellation : vscode_jsonrpc_1.CancellationToken.None; } /** * Gets a token that is cancelled if the session ends before the request handler * completes. */ get cancellation() { return this.cancellationValue; } /* @internal */ set cancellation(value) { this.cancellationValue = value; } toString() { return `${this.channel.toString()}${this.failureReason ? ' ' + connectionMessages_1.SshChannelOpenFailureReason[this.failureReason] : ''}`; } } exports.SshChannelOpeningEventArgs = SshChannelOpeningEventArgs; //# sourceMappingURL=sshChannelOpeningEventArgs.js.map