"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * Admin API
 * The Admin API is used to manage the ApeCloud platform.
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: support@apecloud.com
 *
 * 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.AlertRuleApi = exports.AlertRuleApiFactory = exports.AlertRuleApiFp = exports.AlertRuleApiAxiosParamCreator = 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");
/**
 * AlertRuleApi - axios parameter creator
 * @export
 */
const AlertRuleApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Create alert rule
         * @param {AlertRule} body
         * @param {boolean} [disabled] disabled status
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertRule: async (body, disabled, options = {}) => {
            // verify required parameter 'body' is not null or undefined
            (0, common_1.assertParamExists)('createAlertRule', 'body', body);
            const localVarPath = `/admin/v1/alerts/rules`;
            // 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 BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            if (disabled !== undefined) {
                localVarQueryParameter['disabled'] = disabled;
            }
            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)(body, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         *
         * @summary Delete alert rule
         * @param {string} alertName name of the alert rule
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertRule: async (alertName, options = {}) => {
            // verify required parameter 'alertName' is not null or undefined
            (0, common_1.assertParamExists)('deleteAlertRule', 'alertName', alertName);
            const localVarPath = `/admin/v1/alerts/rules/{alertName}`
                .replace(`{${"alertName"}}`, encodeURIComponent(String(alertName)));
            // 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: 'DELETE' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", 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,
            };
        },
        /**
         *
         * @summary Get alert rule
         * @param {string} alertName name of the alert rule
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertRule: async (alertName, options = {}) => {
            // verify required parameter 'alertName' is not null or undefined
            (0, common_1.assertParamExists)('getAlertRule', 'alertName', alertName);
            const localVarPath = `/admin/v1/alerts/rules/{alertName}`
                .replace(`{${"alertName"}}`, encodeURIComponent(String(alertName)));
            // 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 BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", 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,
            };
        },
        /**
         *
         * @summary List alert rules
         * @param {boolean} [disabled] disabled status
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertRules: async (disabled, options = {}) => {
            const localVarPath = `/admin/v1/alerts/rules`;
            // 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 BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", configuration);
            if (disabled !== undefined) {
                localVarQueryParameter['disabled'] = disabled;
            }
            (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,
            };
        },
        /**
         * Restores the alert rule configuration for a specific organization to the system default settings.
         * @summary Restore organization\'s alert rule configuration to defaults
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        restoreOrgAlertRuleToDefault: async (options = {}) => {
            const localVarPath = `/admin/v1/alerts/rules/reset`;
            // 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 BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", 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,
            };
        },
        /**
         *
         * @param {AlertRule} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertRule: async (body, options = {}) => {
            // verify required parameter 'body' is not null or undefined
            (0, common_1.assertParamExists)('updateAlertRule', 'body', body);
            const localVarPath = `/admin/v1/alerts/rules`;
            // 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: 'PATCH' }, baseOptions), options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};
            // authentication BearerToken required
            // http bearer authentication required
            await (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration);
            // authentication DigestAuth required
            await (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "Authorization", 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)(body, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
exports.AlertRuleApiAxiosParamCreator = AlertRuleApiAxiosParamCreator;
/**
 * AlertRuleApi - functional programming interface
 * @export
 */
const AlertRuleApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.AlertRuleApiAxiosParamCreator)(configuration);
    return {
        /**
         *
         * @summary Create alert rule
         * @param {AlertRule} body
         * @param {boolean} [disabled] disabled status
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createAlertRule(body, disabled, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createAlertRule(body, disabled, 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['AlertRuleApi.createAlertRule']) === 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);
        },
        /**
         *
         * @summary Delete alert rule
         * @param {string} alertName name of the alert rule
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteAlertRule(alertName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteAlertRule(alertName, 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['AlertRuleApi.deleteAlertRule']) === 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);
        },
        /**
         *
         * @summary Get alert rule
         * @param {string} alertName name of the alert rule
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAlertRule(alertName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.getAlertRule(alertName, 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['AlertRuleApi.getAlertRule']) === 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);
        },
        /**
         *
         * @summary List alert rules
         * @param {boolean} [disabled] disabled status
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listAlertRules(disabled, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listAlertRules(disabled, 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['AlertRuleApi.listAlertRules']) === 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);
        },
        /**
         * Restores the alert rule configuration for a specific organization to the system default settings.
         * @summary Restore organization\'s alert rule configuration to defaults
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async restoreOrgAlertRuleToDefault(options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.restoreOrgAlertRuleToDefault(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['AlertRuleApi.restoreOrgAlertRuleToDefault']) === 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);
        },
        /**
         *
         * @param {AlertRule} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateAlertRule(body, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateAlertRule(body, 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['AlertRuleApi.updateAlertRule']) === 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.AlertRuleApiFp = AlertRuleApiFp;
/**
 * AlertRuleApi - factory interface
 * @export
 */
const AlertRuleApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.AlertRuleApiFp)(configuration);
    return {
        /**
         *
         * @summary Create alert rule
         * @param {AlertRuleApiCreateAlertRuleRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAlertRule(requestParameters, options) {
            return localVarFp.createAlertRule(requestParameters.body, requestParameters.disabled, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Delete alert rule
         * @param {AlertRuleApiDeleteAlertRuleRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAlertRule(requestParameters, options) {
            return localVarFp.deleteAlertRule(requestParameters.alertName, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Get alert rule
         * @param {AlertRuleApiGetAlertRuleRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAlertRule(requestParameters, options) {
            return localVarFp.getAlertRule(requestParameters.alertName, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary List alert rules
         * @param {AlertRuleApiListAlertRulesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAlertRules(requestParameters = {}, options) {
            return localVarFp.listAlertRules(requestParameters.disabled, options).then((request) => request(axios, basePath));
        },
        /**
         * Restores the alert rule configuration for a specific organization to the system default settings.
         * @summary Restore organization\'s alert rule configuration to defaults
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        restoreOrgAlertRuleToDefault(options) {
            return localVarFp.restoreOrgAlertRuleToDefault(options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @param {AlertRuleApiUpdateAlertRuleRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAlertRule(requestParameters, options) {
            return localVarFp.updateAlertRule(requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};
exports.AlertRuleApiFactory = AlertRuleApiFactory;
/**
 * AlertRuleApi - object-oriented interface
 * @export
 * @class AlertRuleApi
 * @extends {BaseAPI}
 */
class AlertRuleApi extends base_1.BaseAPI {
    /**
     *
     * @summary Create alert rule
     * @param {AlertRuleApiCreateAlertRuleRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertRuleApi
     */
    createAlertRule(requestParameters, options) {
        return (0, exports.AlertRuleApiFp)(this.configuration).createAlertRule(requestParameters.body, requestParameters.disabled, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Delete alert rule
     * @param {AlertRuleApiDeleteAlertRuleRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertRuleApi
     */
    deleteAlertRule(requestParameters, options) {
        return (0, exports.AlertRuleApiFp)(this.configuration).deleteAlertRule(requestParameters.alertName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Get alert rule
     * @param {AlertRuleApiGetAlertRuleRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertRuleApi
     */
    getAlertRule(requestParameters, options) {
        return (0, exports.AlertRuleApiFp)(this.configuration).getAlertRule(requestParameters.alertName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary List alert rules
     * @param {AlertRuleApiListAlertRulesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertRuleApi
     */
    listAlertRules(requestParameters = {}, options) {
        return (0, exports.AlertRuleApiFp)(this.configuration).listAlertRules(requestParameters.disabled, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Restores the alert rule configuration for a specific organization to the system default settings.
     * @summary Restore organization\'s alert rule configuration to defaults
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertRuleApi
     */
    restoreOrgAlertRuleToDefault(options) {
        return (0, exports.AlertRuleApiFp)(this.configuration).restoreOrgAlertRuleToDefault(options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @param {AlertRuleApiUpdateAlertRuleRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof AlertRuleApi
     */
    updateAlertRule(requestParameters, options) {
        return (0, exports.AlertRuleApiFp)(this.configuration).updateAlertRule(requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.AlertRuleApi = AlertRuleApi;
//# sourceMappingURL=alert-rule-api.js.map