"use strict";
/* tslint:disable */
/* eslint-disable */
/**
 * KubeBlocks Cloud API
 * KubeBlocks Cloud API is a RESTful API for managing KubeBlocks Cloud resources.  The API is organized around REST.  Our API has predictable resource-oriented URLs, accepts `JSON-encoded` request bodies, returns `JSON-encoded` responses, and uses standard HTTP response codes, authentication, and verbs.  We use standard HTTP authentication and provide API keys to identify who you are. Your API keys carry many privileges, so be sure to keep them secret! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
 *
 * 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.EnvironmentApi = exports.EnvironmentApiFactory = exports.EnvironmentApiFp = exports.EnvironmentApiAxiosParamCreator = 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");
/**
 * EnvironmentApi - axios parameter creator
 * @export
 */
const EnvironmentApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Get environment
         * @param {string} orgName name of the Org
         * @param {string} environmentName name of the Environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEnvironment: async (orgName, environmentName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('getEnvironment', 'orgName', orgName);
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('getEnvironment', 'environmentName', environmentName);
            const localVarPath = `/api/v1/organizations/{orgName}/environments/{environmentName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .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,
            };
        },
        /**
         *
         * @summary Get environment module information in an environment
         * @param {string} environmentName Environment Name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEnvironmentModuleInfo: async (environmentName, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('getEnvironmentModuleInfo', 'environmentName', environmentName);
            const localVarPath = `/api/v1/environments/{environmentName}/modules`
                .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,
            };
        },
        /**
         * List available zones of an environment
         * @summary List the availability zones where the environment\'s nodes are located
         * @param {string} orgName name of the Org
         * @param {string} environmentName name of the Environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEnvNodeZone: async (orgName, environmentName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('listEnvNodeZone', 'orgName', orgName);
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('listEnvNodeZone', 'environmentName', environmentName);
            const localVarPath = `/api/v1/organizations/{orgName}/environments/{environmentName}/availableZones`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .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,
            };
        },
        /**
         * List environments
         * @summary List environments
         * @param {string} orgName name of the Org
         * @param {string} [engine] engine name
         * @param {string} [version] version of the engine
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEnvironment: async (orgName, engine, version, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('listEnvironment', 'orgName', orgName);
            const localVarPath = `/api/v1/organizations/{orgName}/environments`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // 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 (engine !== undefined) {
                localVarQueryParameter['engine'] = engine;
            }
            if (version !== undefined) {
                localVarQueryParameter['version'] = version;
            }
            (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 environment node group
         * @param {string} environmentName name of the environment
         * @param {Array<string>} [zones] available zone for filtering node groups
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listNodeGroup: async (environmentName, zones, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('listNodeGroup', 'environmentName', environmentName);
            const localVarPath = `/api/v1/environments/{environmentName}/nodeGroups`
                .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);
            if (zones) {
                localVarQueryParameter['zones'] = zones;
            }
            (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.EnvironmentApiAxiosParamCreator = EnvironmentApiAxiosParamCreator;
/**
 * EnvironmentApi - functional programming interface
 * @export
 */
const EnvironmentApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.EnvironmentApiAxiosParamCreator)(configuration);
    return {
        /**
         *
         * @summary Get environment
         * @param {string} orgName name of the Org
         * @param {string} environmentName name of the Environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getEnvironment(orgName, environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.getEnvironment(orgName, 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['EnvironmentApi.getEnvironment']) === 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 environment module information in an environment
         * @param {string} environmentName Environment Name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getEnvironmentModuleInfo(environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.getEnvironmentModuleInfo(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['EnvironmentApi.getEnvironmentModuleInfo']) === 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 available zones of an environment
         * @summary List the availability zones where the environment\'s nodes are located
         * @param {string} orgName name of the Org
         * @param {string} environmentName name of the Environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listEnvNodeZone(orgName, environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listEnvNodeZone(orgName, 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['EnvironmentApi.listEnvNodeZone']) === 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 environments
         * @summary List environments
         * @param {string} orgName name of the Org
         * @param {string} [engine] engine name
         * @param {string} [version] version of the engine
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listEnvironment(orgName, engine, version, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listEnvironment(orgName, engine, version, 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['EnvironmentApi.listEnvironment']) === 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 environment node group
         * @param {string} environmentName name of the environment
         * @param {Array<string>} [zones] available zone for filtering node groups
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listNodeGroup(environmentName, zones, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listNodeGroup(environmentName, zones, 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['EnvironmentApi.listNodeGroup']) === 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.EnvironmentApiFp = EnvironmentApiFp;
/**
 * EnvironmentApi - factory interface
 * @export
 */
const EnvironmentApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.EnvironmentApiFp)(configuration);
    return {
        /**
         *
         * @summary Get environment
         * @param {EnvironmentApiGetEnvironmentRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEnvironment(requestParameters, options) {
            return localVarFp.getEnvironment(requestParameters.orgName, requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Get environment module information in an environment
         * @param {EnvironmentApiGetEnvironmentModuleInfoRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getEnvironmentModuleInfo(requestParameters, options) {
            return localVarFp.getEnvironmentModuleInfo(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         * List available zones of an environment
         * @summary List the availability zones where the environment\'s nodes are located
         * @param {EnvironmentApiListEnvNodeZoneRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEnvNodeZone(requestParameters, options) {
            return localVarFp.listEnvNodeZone(requestParameters.orgName, requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         * List environments
         * @summary List environments
         * @param {EnvironmentApiListEnvironmentRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listEnvironment(requestParameters, options) {
            return localVarFp.listEnvironment(requestParameters.orgName, requestParameters.engine, requestParameters.version, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary List environment node group
         * @param {EnvironmentApiListNodeGroupRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listNodeGroup(requestParameters, options) {
            return localVarFp.listNodeGroup(requestParameters.environmentName, requestParameters.zones, options).then((request) => request(axios, basePath));
        },
    };
};
exports.EnvironmentApiFactory = EnvironmentApiFactory;
/**
 * EnvironmentApi - object-oriented interface
 * @export
 * @class EnvironmentApi
 * @extends {BaseAPI}
 */
class EnvironmentApi extends base_1.BaseAPI {
    /**
     *
     * @summary Get environment
     * @param {EnvironmentApiGetEnvironmentRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EnvironmentApi
     */
    getEnvironment(requestParameters, options) {
        return (0, exports.EnvironmentApiFp)(this.configuration).getEnvironment(requestParameters.orgName, requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Get environment module information in an environment
     * @param {EnvironmentApiGetEnvironmentModuleInfoRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EnvironmentApi
     */
    getEnvironmentModuleInfo(requestParameters, options) {
        return (0, exports.EnvironmentApiFp)(this.configuration).getEnvironmentModuleInfo(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List available zones of an environment
     * @summary List the availability zones where the environment\'s nodes are located
     * @param {EnvironmentApiListEnvNodeZoneRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EnvironmentApi
     */
    listEnvNodeZone(requestParameters, options) {
        return (0, exports.EnvironmentApiFp)(this.configuration).listEnvNodeZone(requestParameters.orgName, requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List environments
     * @summary List environments
     * @param {EnvironmentApiListEnvironmentRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EnvironmentApi
     */
    listEnvironment(requestParameters, options) {
        return (0, exports.EnvironmentApiFp)(this.configuration).listEnvironment(requestParameters.orgName, requestParameters.engine, requestParameters.version, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary List environment node group
     * @param {EnvironmentApiListNodeGroupRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EnvironmentApi
     */
    listNodeGroup(requestParameters, options) {
        return (0, exports.EnvironmentApiFp)(this.configuration).listNodeGroup(requestParameters.environmentName, requestParameters.zones, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.EnvironmentApi = EnvironmentApi;
//# sourceMappingURL=environment-api.js.map