"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * KubeBlocks Cloud Internal API
 * The Internal API is using for interaction of ApeCloud platform microservices.
 *
 * The version of the OpenAPI document: 1.0.0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SLAApi = exports.SLAApiFactory = exports.SLAApiFp = exports.SLAApiAxiosParamCreator = void 0;
const axios_1 = __importDefault(require("axios"));
// Some imports not used depending on template conditions
// @ts-ignore
const common_1 = require("../common");
// @ts-ignore
const base_1 = require("../base");
/**
 * SLAApi - axios parameter creator
 * @export
 */
const SLAApiAxiosParamCreator = function (configuration) {
    return {
        /**
         * Check SLA config in a environment
         * @summary Check SLA config in env
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        checkSLAConfigInEnv: async (environmentName, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('checkSLAConfigInEnv', 'environmentName', environmentName);
            const localVarPath = `/internal/v1/environments/{environmentName}/sla`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BasicAuth required
            // http basic authentication required
            (0, common_1.setBasicAuthToObject)(localVarRequestOptions, configuration);
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Batch create or update cluster outage record
         * @summary Batch create or update cluster outage record
         * @param {string} environmentName name of the environment
         * @param {Array<OutageRecord>} outageRecord
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createOrUpdateClusterOutages: async (environmentName, outageRecord, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('createOrUpdateClusterOutages', 'environmentName', environmentName);
            // verify required parameter 'outageRecord' is not null or undefined
            (0, common_1.assertParamExists)('createOrUpdateClusterOutages', 'outageRecord', outageRecord);
            const localVarPath = `/internal/v1/environments/{environmentName}/outages`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BasicAuth required
            // http basic authentication required
            (0, common_1.setBasicAuthToObject)(localVarRequestOptions, configuration);
            localVarHeaderParameter['Content-Type'] = 'application/json';
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(outageRecord, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * List outage record for environments
         * @summary List outage record for environments
         * @param {string} [environmentName] name of the environment, if not specified, return all environments
         * @param {string} [orgName] name of the organization
         * @param {string} [clusterID] id of the cluster
         * @param {boolean} [activeOnly] whether to return only active outage records
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEnvironmentOutageRecord: async (environmentName, orgName, clusterID, activeOnly, options = {}) => {
            const localVarPath = `/internal/v1/sla/outages`;
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BasicAuth required
            // http basic authentication required
            (0, common_1.setBasicAuthToObject)(localVarRequestOptions, configuration);
            if (environmentName !== undefined) {
                localVarQueryParameter['environmentName'] = environmentName;
            }
            if (orgName !== undefined) {
                localVarQueryParameter['orgName'] = orgName;
            }
            if (clusterID !== undefined) {
                localVarQueryParameter['clusterID'] = clusterID;
            }
            if (activeOnly !== undefined) {
                localVarQueryParameter['activeOnly'] = activeOnly;
            }
            (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
exports.SLAApiAxiosParamCreator = SLAApiAxiosParamCreator;
/**
 * SLAApi - functional programming interface
 * @export
 */
const SLAApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.SLAApiAxiosParamCreator)(configuration);
    return {
        /**
         * Check SLA config in a environment
         * @summary Check SLA config in env
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async checkSLAConfigInEnv(environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.checkSLAConfigInEnv(environmentName, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['SLAApi.checkSLAConfigInEnv']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * Batch create or update cluster outage record
         * @summary Batch create or update cluster outage record
         * @param {string} environmentName name of the environment
         * @param {Array<OutageRecord>} outageRecord
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createOrUpdateClusterOutages(environmentName, outageRecord, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createOrUpdateClusterOutages(environmentName, outageRecord, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['SLAApi.createOrUpdateClusterOutages']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * List outage record for environments
         * @summary List outage record for environments
         * @param {string} [environmentName] name of the environment, if not specified, return all environments
         * @param {string} [orgName] name of the organization
         * @param {string} [clusterID] id of the cluster
         * @param {boolean} [activeOnly] whether to return only active outage records
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listEnvironmentOutageRecord(environmentName, orgName, clusterID, activeOnly, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listEnvironmentOutageRecord(environmentName, orgName, clusterID, activeOnly, options);
            const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
            const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['SLAApi.listEnvironmentOutageRecord']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
            return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    };
};
exports.SLAApiFp = SLAApiFp;
/**
 * SLAApi - factory interface
 * @export
 */
const SLAApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.SLAApiFp)(configuration);
    return {
        /**
         * Check SLA config in a environment
         * @summary Check SLA config in env
         * @param {SLAApiCheckSLAConfigInEnvRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        checkSLAConfigInEnv(requestParameters, options) {
            return localVarFp.checkSLAConfigInEnv(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         * Batch create or update cluster outage record
         * @summary Batch create or update cluster outage record
         * @param {SLAApiCreateOrUpdateClusterOutagesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createOrUpdateClusterOutages(requestParameters, options) {
            return localVarFp.createOrUpdateClusterOutages(requestParameters.environmentName, requestParameters.outageRecord, options).then((request) => request(axios, basePath));
        },
        /**
         * List outage record for environments
         * @summary List outage record for environments
         * @param {SLAApiListEnvironmentOutageRecordRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEnvironmentOutageRecord(requestParameters = {}, options) {
            return localVarFp.listEnvironmentOutageRecord(requestParameters.environmentName, requestParameters.orgName, requestParameters.clusterID, requestParameters.activeOnly, options).then((request) => request(axios, basePath));
        },
    };
};
exports.SLAApiFactory = SLAApiFactory;
/**
 * SLAApi - object-oriented interface
 * @export
 * @class SLAApi
 * @extends {BaseAPI}
 */
class SLAApi extends base_1.BaseAPI {
    /**
     * Check SLA config in a environment
     * @summary Check SLA config in env
     * @param {SLAApiCheckSLAConfigInEnvRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof SLAApi
     */
    checkSLAConfigInEnv(requestParameters, options) {
        return (0, exports.SLAApiFp)(this.configuration).checkSLAConfigInEnv(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Batch create or update cluster outage record
     * @summary Batch create or update cluster outage record
     * @param {SLAApiCreateOrUpdateClusterOutagesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof SLAApi
     */
    createOrUpdateClusterOutages(requestParameters, options) {
        return (0, exports.SLAApiFp)(this.configuration).createOrUpdateClusterOutages(requestParameters.environmentName, requestParameters.outageRecord, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List outage record for environments
     * @summary List outage record for environments
     * @param {SLAApiListEnvironmentOutageRecordRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof SLAApi
     */
    listEnvironmentOutageRecord(requestParameters = {}, options) {
        return (0, exports.SLAApiFp)(this.configuration).listEnvironmentOutageRecord(requestParameters.environmentName, requestParameters.orgName, requestParameters.clusterID, requestParameters.activeOnly, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.SLAApi = SLAApi;
//# sourceMappingURL=slaapi.js.map