"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.VipPoolApi = exports.VipPoolApiFactory = exports.VipPoolApiFp = exports.VipPoolApiAxiosParamCreator = 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");
/**
 * VipPoolApi - axios parameter creator
 * @export
 */
const VipPoolApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary Create environment VIP Pool
         * @param {string} environmentName name of the environment
         * @param {VipPoolCreate} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createVIPPool: async (environmentName, body, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('createVIPPool', 'environmentName', environmentName);
            // verify required parameter 'body' is not null or undefined
            (0, common_1.assertParamExists)('createVIPPool', 'body', body);
            const localVarPath = `/admin/v1/environments/{environmentName}/loadbalancer/vipPool`
                .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);
            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 environment VIP Pool
         * @param {string} environmentName name of the environment
         * @param {string} poolID id of the VIP Pool
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteVIPPool: async (environmentName, poolID, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('deleteVIPPool', 'environmentName', environmentName);
            // verify required parameter 'poolID' is not null or undefined
            (0, common_1.assertParamExists)('deleteVIPPool', 'poolID', poolID);
            const localVarPath = `/admin/v1/environments/{environmentName}/loadbalancer/vipPool/{poolID}`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)))
                .replace(`{${"poolID"}}`, encodeURIComponent(String(poolID)));
            // 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 List environment VIP Pools
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listVIPPool: async (environmentName, options = {}) => {
            // verify required parameter 'environmentName' is not null or undefined
            (0, common_1.assertParamExists)('listVIPPool', 'environmentName', environmentName);
            const localVarPath = `/admin/v1/environments/{environmentName}/loadbalancer/vipPool`
                .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.VipPoolApiAxiosParamCreator = VipPoolApiAxiosParamCreator;
/**
 * VipPoolApi - functional programming interface
 * @export
 */
const VipPoolApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.VipPoolApiAxiosParamCreator)(configuration);
    return {
        /**
         *
         * @summary Create environment VIP Pool
         * @param {string} environmentName name of the environment
         * @param {VipPoolCreate} body
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createVIPPool(environmentName, body, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createVIPPool(environmentName, 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['VipPoolApi.createVIPPool']) === 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 environment VIP Pool
         * @param {string} environmentName name of the environment
         * @param {string} poolID id of the VIP Pool
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteVIPPool(environmentName, poolID, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteVIPPool(environmentName, poolID, 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['VipPoolApi.deleteVIPPool']) === 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 VIP Pools
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listVIPPool(environmentName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listVIPPool(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['VipPoolApi.listVIPPool']) === 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.VipPoolApiFp = VipPoolApiFp;
/**
 * VipPoolApi - factory interface
 * @export
 */
const VipPoolApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.VipPoolApiFp)(configuration);
    return {
        /**
         *
         * @summary Create environment VIP Pool
         * @param {VipPoolApiCreateVIPPoolRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createVIPPool(requestParameters, options) {
            return localVarFp.createVIPPool(requestParameters.environmentName, requestParameters.body, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Delete environment VIP Pool
         * @param {VipPoolApiDeleteVIPPoolRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteVIPPool(requestParameters, options) {
            return localVarFp.deleteVIPPool(requestParameters.environmentName, requestParameters.poolID, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary List environment VIP Pools
         * @param {VipPoolApiListVIPPoolRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listVIPPool(requestParameters, options) {
            return localVarFp.listVIPPool(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
    };
};
exports.VipPoolApiFactory = VipPoolApiFactory;
/**
 * VipPoolApi - object-oriented interface
 * @export
 * @class VipPoolApi
 * @extends {BaseAPI}
 */
class VipPoolApi extends base_1.BaseAPI {
    /**
     *
     * @summary Create environment VIP Pool
     * @param {VipPoolApiCreateVIPPoolRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VipPoolApi
     */
    createVIPPool(requestParameters, options) {
        return (0, exports.VipPoolApiFp)(this.configuration).createVIPPool(requestParameters.environmentName, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Delete environment VIP Pool
     * @param {VipPoolApiDeleteVIPPoolRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VipPoolApi
     */
    deleteVIPPool(requestParameters, options) {
        return (0, exports.VipPoolApiFp)(this.configuration).deleteVIPPool(requestParameters.environmentName, requestParameters.poolID, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary List environment VIP Pools
     * @param {VipPoolApiListVIPPoolRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VipPoolApi
     */
    listVIPPool(requestParameters, options) {
        return (0, exports.VipPoolApiFp)(this.configuration).listVIPPool(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.VipPoolApi = VipPoolApi;
//# sourceMappingURL=vip-pool-api.js.map