"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.ResourceStatsApi = exports.ResourceStatsApiFactory = exports.ResourceStatsApiFp = exports.ResourceStatsApiAxiosParamCreator = 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");
/**
 * ResourceStatsApi - axios parameter creator
 * @export
 */
const ResourceStatsApiAxiosParamCreator = function (configuration) {
    return {
        /**
         * Triggers an immediate collection of resource statistics for the specified environment.
         * @summary Collect resource statistics of environment
         * @param {string} environmentName The name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        collectResourceStats: async (environmentName, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('collectResourceStats', 'environmentName', environmentName);
            const localVarPath = `/admin/v1/environments/{environmentName}/resourceStats/collect`
                .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 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,
            };
        },
        /**
         * Returns aggregated resource statistics for the specified environment within an organization.
         * @summary Get resource statistics of environment
         * @param {string} environmentName The name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getResourceStats: async (environmentName, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('getResourceStats', 'environmentName', environmentName);
            const localVarPath = `/admin/v1/environments/{environmentName}/resourceStats`
                .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 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,
            };
        },
        /**
         * Returns aggregated resource statistics for the specified node.
         * @summary Get resource statistics of instances
         * @param {string} environmentName The name of the environment
         * @param {string} nodeName The name of the node
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listInstancesResourceStats: async (environmentName, nodeName, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('listInstancesResourceStats', 'environmentName', environmentName);
            // verify required parameter 'nodeName' is not null or undefined
            (0, common_1.assertParamExists)('listInstancesResourceStats', 'nodeName', nodeName);
            const localVarPath = `/admin/v1/environments/{environmentName}/nodes/{nodeName}/instances/resourceStats`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)))
                .replace(`{${"nodeName"}}`, encodeURIComponent(String(nodeName)));
            // 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,
            };
        },
        /**
         * Returns aggregated resource statistics for the specified environment within an organization.
         * @summary Get resource statistics of nodes
         * @param {string} environmentName The name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listNodesResourceStats: async (environmentName, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('listNodesResourceStats', 'environmentName', environmentName);
            const localVarPath = `/admin/v1/environments/{environmentName}/nodes/resourceStats`
                .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 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,
            };
        },
    };
};
exports.ResourceStatsApiAxiosParamCreator = ResourceStatsApiAxiosParamCreator;
/**
 * ResourceStatsApi - functional programming interface
 * @export
 */
const ResourceStatsApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.ResourceStatsApiAxiosParamCreator)(configuration);
    return {
        /**
         * Triggers an immediate collection of resource statistics for the specified environment.
         * @summary Collect resource statistics of environment
         * @param {string} environmentName The name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async collectResourceStats(environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.collectResourceStats(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['ResourceStatsApi.collectResourceStats']) === 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);
        },
        /**
         * Returns aggregated resource statistics for the specified environment within an organization.
         * @summary Get resource statistics of environment
         * @param {string} environmentName The name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getResourceStats(environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.getResourceStats(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['ResourceStatsApi.getResourceStats']) === 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);
        },
        /**
         * Returns aggregated resource statistics for the specified node.
         * @summary Get resource statistics of instances
         * @param {string} environmentName The name of the environment
         * @param {string} nodeName The name of the node
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listInstancesResourceStats(environmentName, nodeName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listInstancesResourceStats(environmentName, nodeName, 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['ResourceStatsApi.listInstancesResourceStats']) === 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);
        },
        /**
         * Returns aggregated resource statistics for the specified environment within an organization.
         * @summary Get resource statistics of nodes
         * @param {string} environmentName The name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listNodesResourceStats(environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listNodesResourceStats(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['ResourceStatsApi.listNodesResourceStats']) === 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.ResourceStatsApiFp = ResourceStatsApiFp;
/**
 * ResourceStatsApi - factory interface
 * @export
 */
const ResourceStatsApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.ResourceStatsApiFp)(configuration);
    return {
        /**
         * Triggers an immediate collection of resource statistics for the specified environment.
         * @summary Collect resource statistics of environment
         * @param {ResourceStatsApiCollectResourceStatsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        collectResourceStats(requestParameters, options) {
            return localVarFp.collectResourceStats(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns aggregated resource statistics for the specified environment within an organization.
         * @summary Get resource statistics of environment
         * @param {ResourceStatsApiGetResourceStatsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getResourceStats(requestParameters, options) {
            return localVarFp.getResourceStats(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns aggregated resource statistics for the specified node.
         * @summary Get resource statistics of instances
         * @param {ResourceStatsApiListInstancesResourceStatsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listInstancesResourceStats(requestParameters, options) {
            return localVarFp.listInstancesResourceStats(requestParameters.environmentName, requestParameters.nodeName, options).then((request) => request(axios, basePath));
        },
        /**
         * Returns aggregated resource statistics for the specified environment within an organization.
         * @summary Get resource statistics of nodes
         * @param {ResourceStatsApiListNodesResourceStatsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listNodesResourceStats(requestParameters, options) {
            return localVarFp.listNodesResourceStats(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
    };
};
exports.ResourceStatsApiFactory = ResourceStatsApiFactory;
/**
 * ResourceStatsApi - object-oriented interface
 * @export
 * @class ResourceStatsApi
 * @extends {BaseAPI}
 */
class ResourceStatsApi extends base_1.BaseAPI {
    /**
     * Triggers an immediate collection of resource statistics for the specified environment.
     * @summary Collect resource statistics of environment
     * @param {ResourceStatsApiCollectResourceStatsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ResourceStatsApi
     */
    collectResourceStats(requestParameters, options) {
        return (0, exports.ResourceStatsApiFp)(this.configuration).collectResourceStats(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Returns aggregated resource statistics for the specified environment within an organization.
     * @summary Get resource statistics of environment
     * @param {ResourceStatsApiGetResourceStatsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ResourceStatsApi
     */
    getResourceStats(requestParameters, options) {
        return (0, exports.ResourceStatsApiFp)(this.configuration).getResourceStats(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Returns aggregated resource statistics for the specified node.
     * @summary Get resource statistics of instances
     * @param {ResourceStatsApiListInstancesResourceStatsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ResourceStatsApi
     */
    listInstancesResourceStats(requestParameters, options) {
        return (0, exports.ResourceStatsApiFp)(this.configuration).listInstancesResourceStats(requestParameters.environmentName, requestParameters.nodeName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Returns aggregated resource statistics for the specified environment within an organization.
     * @summary Get resource statistics of nodes
     * @param {ResourceStatsApiListNodesResourceStatsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ResourceStatsApi
     */
    listNodesResourceStats(requestParameters, options) {
        return (0, exports.ResourceStatsApiFp)(this.configuration).listNodesResourceStats(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.ResourceStatsApi = ResourceStatsApi;
//# sourceMappingURL=resource-stats-api.js.map