"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.DamengApi = exports.DamengApiFactory = exports.DamengApiFp = exports.DamengApiAxiosParamCreator = 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");
/**
 * DamengApi - axios parameter creator
 * @export
 */
const DamengApiAxiosParamCreator = function (configuration) {
    return {
        /**
         * Create tablespace for a Dameng cluster.
         * @summary Create damengdb tablespace
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {DmTablespace} [dmTablespace]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createTablespace: async (orgName, clusterName, dmTablespace, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('createTablespace', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('createTablespace', 'clusterName', clusterName);
            const localVarPath = `/admin/v1/data/damengdb/organizations/{orgName}/clusters/{clusterName}/tablespaces`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)));
            // 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)(dmTablespace, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Delete tablespace for a Dameng cluster.
         * @summary Delete damengdb tablespace
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {string} tablespaceName Tablespace name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteTablespace: async (orgName, clusterName, tablespaceName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('deleteTablespace', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('deleteTablespace', 'clusterName', clusterName);
            // verify required parameter 'tablespaceName' is not null or undefined
            (0, common_1.assertParamExists)('deleteTablespace', 'tablespaceName', tablespaceName);
            const localVarPath = `/admin/v1/data/damengdb/organizations/{orgName}/clusters/{clusterName}/tablespaces/{tablespaceName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)))
                .replace(`{${"tablespaceName"}}`, encodeURIComponent(String(tablespaceName)));
            // 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 Dameng tablespace info
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {string} tablespaceName Tablespace name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTablespace: async (orgName, clusterName, tablespaceName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('getTablespace', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('getTablespace', 'clusterName', clusterName);
            // verify required parameter 'tablespaceName' is not null or undefined
            (0, common_1.assertParamExists)('getTablespace', 'tablespaceName', tablespaceName);
            const localVarPath = `/admin/v1/data/damengdb/organizations/{orgName}/clusters/{clusterName}/tablespaces/{tablespaceName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)))
                .replace(`{${"tablespaceName"}}`, encodeURIComponent(String(tablespaceName)));
            // 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 tablespaces for a Dameng cluster.
         * @summary List damengdb tablespaces
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listTablespaces: async (orgName, clusterName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('listTablespaces', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('listTablespaces', 'clusterName', clusterName);
            const localVarPath = `/admin/v1/data/damengdb/organizations/{orgName}/clusters/{clusterName}/tablespaces`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)));
            // 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,
            };
        },
        /**
         * Update tablespace for a Dameng cluster.
         * @summary Update damengdb tablespace
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {string} tablespaceName Tablespace name
         * @param {DmTablespace} [dmTablespace]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateTablespace: async (orgName, clusterName, tablespaceName, dmTablespace, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('updateTablespace', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('updateTablespace', 'clusterName', clusterName);
            // verify required parameter 'tablespaceName' is not null or undefined
            (0, common_1.assertParamExists)('updateTablespace', 'tablespaceName', tablespaceName);
            const localVarPath = `/admin/v1/data/damengdb/organizations/{orgName}/clusters/{clusterName}/tablespaces/{tablespaceName}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)))
                .replace(`{${"tablespaceName"}}`, encodeURIComponent(String(tablespaceName)));
            // 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)(dmTablespace, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
exports.DamengApiAxiosParamCreator = DamengApiAxiosParamCreator;
/**
 * DamengApi - functional programming interface
 * @export
 */
const DamengApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.DamengApiAxiosParamCreator)(configuration);
    return {
        /**
         * Create tablespace for a Dameng cluster.
         * @summary Create damengdb tablespace
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {DmTablespace} [dmTablespace]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createTablespace(orgName, clusterName, dmTablespace, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createTablespace(orgName, clusterName, dmTablespace, 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['DamengApi.createTablespace']) === 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);
        },
        /**
         * Delete tablespace for a Dameng cluster.
         * @summary Delete damengdb tablespace
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {string} tablespaceName Tablespace name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteTablespace(orgName, clusterName, tablespaceName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteTablespace(orgName, clusterName, tablespaceName, 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['DamengApi.deleteTablespace']) === 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 Dameng tablespace info
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {string} tablespaceName Tablespace name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getTablespace(orgName, clusterName, tablespaceName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.getTablespace(orgName, clusterName, tablespaceName, 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['DamengApi.getTablespace']) === 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 tablespaces for a Dameng cluster.
         * @summary List damengdb tablespaces
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listTablespaces(orgName, clusterName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listTablespaces(orgName, clusterName, 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['DamengApi.listTablespaces']) === 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);
        },
        /**
         * Update tablespace for a Dameng cluster.
         * @summary Update damengdb tablespace
         * @param {string} orgName Organization name
         * @param {string} clusterName Cluster name
         * @param {string} tablespaceName Tablespace name
         * @param {DmTablespace} [dmTablespace]
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateTablespace(orgName, clusterName, tablespaceName, dmTablespace, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateTablespace(orgName, clusterName, tablespaceName, dmTablespace, 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['DamengApi.updateTablespace']) === 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.DamengApiFp = DamengApiFp;
/**
 * DamengApi - factory interface
 * @export
 */
const DamengApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.DamengApiFp)(configuration);
    return {
        /**
         * Create tablespace for a Dameng cluster.
         * @summary Create damengdb tablespace
         * @param {DamengApiCreateTablespaceRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createTablespace(requestParameters, options) {
            return localVarFp.createTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.dmTablespace, options).then((request) => request(axios, basePath));
        },
        /**
         * Delete tablespace for a Dameng cluster.
         * @summary Delete damengdb tablespace
         * @param {DamengApiDeleteTablespaceRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteTablespace(requestParameters, options) {
            return localVarFp.deleteTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.tablespaceName, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary Get Dameng tablespace info
         * @param {DamengApiGetTablespaceRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getTablespace(requestParameters, options) {
            return localVarFp.getTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.tablespaceName, options).then((request) => request(axios, basePath));
        },
        /**
         * List tablespaces for a Dameng cluster.
         * @summary List damengdb tablespaces
         * @param {DamengApiListTablespacesRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listTablespaces(requestParameters, options) {
            return localVarFp.listTablespaces(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
        /**
         * Update tablespace for a Dameng cluster.
         * @summary Update damengdb tablespace
         * @param {DamengApiUpdateTablespaceRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateTablespace(requestParameters, options) {
            return localVarFp.updateTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.tablespaceName, requestParameters.dmTablespace, options).then((request) => request(axios, basePath));
        },
    };
};
exports.DamengApiFactory = DamengApiFactory;
/**
 * DamengApi - object-oriented interface
 * @export
 * @class DamengApi
 * @extends {BaseAPI}
 */
class DamengApi extends base_1.BaseAPI {
    /**
     * Create tablespace for a Dameng cluster.
     * @summary Create damengdb tablespace
     * @param {DamengApiCreateTablespaceRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DamengApi
     */
    createTablespace(requestParameters, options) {
        return (0, exports.DamengApiFp)(this.configuration).createTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.dmTablespace, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Delete tablespace for a Dameng cluster.
     * @summary Delete damengdb tablespace
     * @param {DamengApiDeleteTablespaceRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DamengApi
     */
    deleteTablespace(requestParameters, options) {
        return (0, exports.DamengApiFp)(this.configuration).deleteTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.tablespaceName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary Get Dameng tablespace info
     * @param {DamengApiGetTablespaceRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DamengApi
     */
    getTablespace(requestParameters, options) {
        return (0, exports.DamengApiFp)(this.configuration).getTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.tablespaceName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List tablespaces for a Dameng cluster.
     * @summary List damengdb tablespaces
     * @param {DamengApiListTablespacesRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DamengApi
     */
    listTablespaces(requestParameters, options) {
        return (0, exports.DamengApiFp)(this.configuration).listTablespaces(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Update tablespace for a Dameng cluster.
     * @summary Update damengdb tablespace
     * @param {DamengApiUpdateTablespaceRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof DamengApi
     */
    updateTablespace(requestParameters, options) {
        return (0, exports.DamengApiFp)(this.configuration).updateTablespace(requestParameters.orgName, requestParameters.clusterName, requestParameters.tablespaceName, requestParameters.dmTablespace, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.DamengApi = DamengApi;
//# sourceMappingURL=dameng-api.js.map