@kubernetes/client-node
Version:
NodeJS client for kubernetes
990 lines • 1.16 MB
JavaScript
"use strict";
/**
* Kubernetes
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v1.22.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoreV1Api = exports.CoreV1ApiApiKeys = void 0;
const tslib_1 = require("tslib");
const request_1 = tslib_1.__importDefault(require("request"));
const models_1 = require("../model/models");
const models_2 = require("../model/models");
const apis_1 = require("./apis");
let defaultBasePath = 'http://localhost';
// ===============================================
// This file is autogenerated - Please do not edit
// ===============================================
var CoreV1ApiApiKeys;
(function (CoreV1ApiApiKeys) {
CoreV1ApiApiKeys[CoreV1ApiApiKeys["BearerToken"] = 0] = "BearerToken";
})(CoreV1ApiApiKeys = exports.CoreV1ApiApiKeys || (exports.CoreV1ApiApiKeys = {}));
class CoreV1Api {
constructor(basePathOrUsername, password, basePath) {
this._basePath = defaultBasePath;
this._defaultHeaders = {};
this._useQuerystring = false;
this.authentications = {
'default': new models_1.VoidAuth(),
'BearerToken': new models_2.ApiKeyAuth('header', 'authorization'),
};
this.interceptors = [];
if (password) {
if (basePath) {
this.basePath = basePath;
}
}
else {
if (basePathOrUsername) {
this.basePath = basePathOrUsername;
}
}
}
set useQuerystring(value) {
this._useQuerystring = value;
}
set basePath(basePath) {
this._basePath = basePath;
}
set defaultHeaders(defaultHeaders) {
this._defaultHeaders = defaultHeaders;
}
get defaultHeaders() {
return this._defaultHeaders;
}
get basePath() {
return this._basePath;
}
setDefaultAuthentication(auth) {
this.authentications.default = auth;
}
setApiKey(key, value) {
this.authentications[CoreV1ApiApiKeys[key]].apiKey = value;
}
addInterceptor(interceptor) {
this.interceptors.push(interceptor);
}
/**
* connect DELETE requests to proxy of Pod
* @param name name of the PodProxyOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param path Path is the URL path to use for the current proxy request to pod.
*/
async connectDeleteNamespacedPodProxy(name, namespace, path, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/pods/{name}/proxy'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectDeleteNamespacedPodProxy.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectDeleteNamespacedPodProxy.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect DELETE requests to proxy of Pod
* @param name name of the PodProxyOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param path path to the resource
* @param path2 Path is the URL path to use for the current proxy request to pod.
*/
async connectDeleteNamespacedPodProxyWithPath(name, namespace, path, path2, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)))
.replace('{' + 'path' + '}', encodeURIComponent(String(path)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectDeleteNamespacedPodProxyWithPath.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectDeleteNamespacedPodProxyWithPath.');
}
// verify required parameter 'path' is not null or undefined
if (path === null || path === undefined) {
throw new Error('Required parameter path was null or undefined when calling connectDeleteNamespacedPodProxyWithPath.');
}
if (path2 !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path2, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect DELETE requests to proxy of Service
* @param name name of the ServiceProxyOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param path Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy.
*/
async connectDeleteNamespacedServiceProxy(name, namespace, path, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/services/{name}/proxy'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectDeleteNamespacedServiceProxy.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectDeleteNamespacedServiceProxy.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect DELETE requests to proxy of Service
* @param name name of the ServiceProxyOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param path path to the resource
* @param path2 Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy.
*/
async connectDeleteNamespacedServiceProxyWithPath(name, namespace, path, path2, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/services/{name}/proxy/{path}'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)))
.replace('{' + 'path' + '}', encodeURIComponent(String(path)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectDeleteNamespacedServiceProxyWithPath.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectDeleteNamespacedServiceProxyWithPath.');
}
// verify required parameter 'path' is not null or undefined
if (path === null || path === undefined) {
throw new Error('Required parameter path was null or undefined when calling connectDeleteNamespacedServiceProxyWithPath.');
}
if (path2 !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path2, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect DELETE requests to proxy of Node
* @param name name of the NodeProxyOptions
* @param path Path is the URL path to use for the current proxy request to node.
*/
async connectDeleteNodeProxy(name, path, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/nodes/{name}/proxy'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectDeleteNodeProxy.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect DELETE requests to proxy of Node
* @param name name of the NodeProxyOptions
* @param path path to the resource
* @param path2 Path is the URL path to use for the current proxy request to node.
*/
async connectDeleteNodeProxyWithPath(name, path, path2, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/nodes/{name}/proxy/{path}'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'path' + '}', encodeURIComponent(String(path)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectDeleteNodeProxyWithPath.');
}
// verify required parameter 'path' is not null or undefined
if (path === null || path === undefined) {
throw new Error('Required parameter path was null or undefined when calling connectDeleteNodeProxyWithPath.');
}
if (path2 !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path2, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'DELETE',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect GET requests to attach of Pod
* @param name name of the PodAttachOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param container The container in which to execute the command. Defaults to only container if there is only one container in the pod.
* @param stderr Stderr if true indicates that stderr is to be redirected for the attach call. Defaults to true.
* @param stdin Stdin if true, redirects the standard input stream of the pod for this call. Defaults to false.
* @param stdout Stdout if true indicates that stdout is to be redirected for the attach call. Defaults to true.
* @param tty TTY if true indicates that a tty will be allocated for the attach call. This is passed through the container runtime so the tty is allocated on the worker node by the container runtime. Defaults to false.
*/
async connectGetNamespacedPodAttach(name, namespace, container, stderr, stdin, stdout, tty, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/pods/{name}/attach'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectGetNamespacedPodAttach.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectGetNamespacedPodAttach.');
}
if (container !== undefined) {
localVarQueryParameters['container'] = models_1.ObjectSerializer.serialize(container, "string");
}
if (stderr !== undefined) {
localVarQueryParameters['stderr'] = models_1.ObjectSerializer.serialize(stderr, "boolean");
}
if (stdin !== undefined) {
localVarQueryParameters['stdin'] = models_1.ObjectSerializer.serialize(stdin, "boolean");
}
if (stdout !== undefined) {
localVarQueryParameters['stdout'] = models_1.ObjectSerializer.serialize(stdout, "boolean");
}
if (tty !== undefined) {
localVarQueryParameters['tty'] = models_1.ObjectSerializer.serialize(tty, "boolean");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect GET requests to exec of Pod
* @param name name of the PodExecOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param command Command is the remote command to execute. argv array. Not executed within a shell.
* @param container Container in which to execute the command. Defaults to only container if there is only one container in the pod.
* @param stderr Redirect the standard error stream of the pod for this call. Defaults to true.
* @param stdin Redirect the standard input stream of the pod for this call. Defaults to false.
* @param stdout Redirect the standard output stream of the pod for this call. Defaults to true.
* @param tty TTY if true indicates that a tty will be allocated for the exec call. Defaults to false.
*/
async connectGetNamespacedPodExec(name, namespace, command, container, stderr, stdin, stdout, tty, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/pods/{name}/exec'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectGetNamespacedPodExec.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectGetNamespacedPodExec.');
}
if (command !== undefined) {
localVarQueryParameters['command'] = models_1.ObjectSerializer.serialize(command, "string");
}
if (container !== undefined) {
localVarQueryParameters['container'] = models_1.ObjectSerializer.serialize(container, "string");
}
if (stderr !== undefined) {
localVarQueryParameters['stderr'] = models_1.ObjectSerializer.serialize(stderr, "boolean");
}
if (stdin !== undefined) {
localVarQueryParameters['stdin'] = models_1.ObjectSerializer.serialize(stdin, "boolean");
}
if (stdout !== undefined) {
localVarQueryParameters['stdout'] = models_1.ObjectSerializer.serialize(stdout, "boolean");
}
if (tty !== undefined) {
localVarQueryParameters['tty'] = models_1.ObjectSerializer.serialize(tty, "boolean");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect GET requests to portforward of Pod
* @param name name of the PodPortForwardOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param ports List of ports to forward Required when using WebSockets
*/
async connectGetNamespacedPodPortforward(name, namespace, ports, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/pods/{name}/portforward'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectGetNamespacedPodPortforward.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectGetNamespacedPodPortforward.');
}
if (ports !== undefined) {
localVarQueryParameters['ports'] = models_1.ObjectSerializer.serialize(ports, "number");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect GET requests to proxy of Pod
* @param name name of the PodProxyOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param path Path is the URL path to use for the current proxy request to pod.
*/
async connectGetNamespacedPodProxy(name, namespace, path, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/pods/{name}/proxy'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectGetNamespacedPodProxy.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectGetNamespacedPodProxy.');
}
if (path !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect GET requests to proxy of Pod
* @param name name of the PodProxyOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param path path to the resource
* @param path2 Path is the URL path to use for the current proxy request to pod.
*/
async connectGetNamespacedPodProxyWithPath(name, namespace, path, path2, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)))
.replace('{' + 'path' + '}', encodeURIComponent(String(path)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ['*/*'];
// give precedence to 'application/json'
if (produces.indexOf('application/json') >= 0) {
localVarHeaderParams.Accept = 'application/json';
}
else {
localVarHeaderParams.Accept = produces.join(',');
}
let localVarFormParams = {};
// verify required parameter 'name' is not null or undefined
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling connectGetNamespacedPodProxyWithPath.');
}
// verify required parameter 'namespace' is not null or undefined
if (namespace === null || namespace === undefined) {
throw new Error('Required parameter namespace was null or undefined when calling connectGetNamespacedPodProxyWithPath.');
}
// verify required parameter 'path' is not null or undefined
if (path === null || path === undefined) {
throw new Error('Required parameter path was null or undefined when calling connectGetNamespacedPodProxyWithPath.');
}
if (path2 !== undefined) {
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(path2, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: 'GET',
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BearerToken.apiKey) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BearerToken.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
body = models_1.ObjectSerializer.deserialize(body, "string");
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* connect GET requests to proxy of Service
* @param name name of the ServiceProxyOptions
* @param namespace object name and auth scope, such as for teams and projects
* @param path Path is the part of URLs that include service endpoints, suffixes, and parameters to use for the current proxy request to service. For example, the whole request URL is http://localhost/api/v1/namespaces/kube-system/services/elasticsearch-logging/_search?q=user:kimchy. Path is _search?q=user:kimchy.
*/
async connectGetNamespacedServiceProxy(name, namespace, path, options = { headers: {} }) {
const localVarPath = this.basePath + '/api/v1/namespaces/{namespace}/services/{name}/proxy'
.replace('{' + 'name' + '}', encodeURIComponent(String(name)))
.replace('{' + 'namespace' + '}', encodeURIComponent(String(namespace)));
let localVarQueryParameters = {};
l