Files
k8s-set-context/node_modules/@kubernetes/client-node/dist/proto-client.js
github-actions[bot] 52d71d28bd Add node modules and compiled JavaScript from main (#54)
Co-authored-by: Oliver King <oking3@uncc.edu>
2022-06-29 15:41:55 -04:00

35 lines
1.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProtoClient = void 0;
const http = require("http");
const url = require("url");
class ProtoClient {
async get(msgType, requestPath) {
const server = this.config.getCurrentCluster().server;
const u = new url.URL(server);
const options = {
path: requestPath,
hostname: u.hostname,
protocol: u.protocol,
};
await this.config.applytoHTTPSOptions(options);
const req = http.request(options);
const result = await new Promise((resolve, reject) => {
let data = '';
req.on('data', (chunk) => {
data = data + chunk;
});
req.on('end', () => {
const obj = msgType.deserializeBinary(data);
resolve(obj);
});
req.on('error', (err) => {
reject(err);
});
});
req.end();
return result;
}
}
exports.ProtoClient = ProtoClient;
//# sourceMappingURL=proto-client.js.map