"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.LogsApi = exports.LogsApiApiKeys = void 0; const tslib_1 = require("tslib"); const request_1 = tslib_1.__importDefault(require("request")); /* tslint:disable:no-unused-locals */ 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 LogsApiApiKeys; (function (LogsApiApiKeys) { LogsApiApiKeys[LogsApiApiKeys["BearerToken"] = 0] = "BearerToken"; })(LogsApiApiKeys = exports.LogsApiApiKeys || (exports.LogsApiApiKeys = {})); class LogsApi { 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[LogsApiApiKeys[key]].apiKey = value; } addInterceptor(interceptor) { this.interceptors.push(interceptor); } /** * * @param logpath path to the log */ async logFileHandler(logpath, options = { headers: {} }) { const localVarPath = this.basePath + '/logs/{logpath}' .replace('{' + 'logpath' + '}', encodeURIComponent(String(logpath))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); let localVarFormParams = {}; // verify required parameter 'logpath' is not null or undefined if (logpath === null || logpath === undefined) { throw new Error('Required parameter logpath was null or undefined when calling logFileHandler.'); } 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 { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); } /** * */ async logFileListHandler(options = { headers: {} }) { const localVarPath = this.basePath + '/logs/'; let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); let localVarFormParams = {}; 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 { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); } } exports.LogsApi = LogsApi; //# sourceMappingURL=logsApi.js.map