-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathOpenSessionCommand.ts
40 lines (35 loc) · 1.37 KB
/
OpenSessionCommand.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Status, SessionHandle } from "../Types";
import BaseCommand from "./BaseCommand";
/**
* For auth mechanism GSSAPI the host and service should be provided when session is opened.
*/
type SessionConfiguration = {
krb_host?: string,
krb_service?: string,
[key: string]: any,
};
/**
* @param client_protocol One of the values TCLIService_types.TProtocolVersion. May be different depends on version of Hive you use.
* For instance, for Hive lower that 3.x it is better to use HIVE_CLI_SERVICE_PROTOCOL_V8.
* @param username if authorization is used you should define username and password
* @param password
* @param configuration in case of GSSAPI you should define configuration
*/
export type OpenSessionRequest = {
client_protocol: number,
username?: string,
password?: string,
configuration?: SessionConfiguration,
};
export type OpenSessionResponse = {
status: Status,
serverProtocolVersion: number,
sessionHandle: SessionHandle,
configuration?: SessionConfiguration,
};
export default class OpenSessionCommand extends BaseCommand {
execute(openSessionRequest: OpenSessionRequest): Promise<OpenSessionResponse> {
const request = new this.TCLIService_types.TOpenSessionReq(openSessionRequest);
return this.executeCommand<OpenSessionResponse>(request, this.client.OpenSession);
}
}