"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.ProviderApi = exports.ProviderApiFactory = exports.ProviderApiFp = exports.ProviderApiAxiosParamCreator = 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");
/**
 * ProviderApi - axios parameter creator
 * @export
 */
const ProviderApiAxiosParamCreator = function (configuration) {
    return {
        /**
         * Create a cloud provider
         * @summary Create a cloud provider
         * @param {ProviderCreate} providerCreate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createCloudProvider: async (providerCreate, options = {}) => {
            // verify required parameter 'providerCreate' is not null or undefined
            (0, common_1.assertParamExists)('createCloudProvider', 'providerCreate', providerCreate);
            const localVarPath = `/admin/v1/providers`;
            // 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)(providerCreate, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Delete a cloud provider
         * @summary Delete a cloud provider
         * @param {string} providerName Name of the cloud provider
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteCloudProvider: async (providerName, options = {}) => {
            // verify required parameter 'providerName' is not null or undefined
            (0, common_1.assertParamExists)('deleteCloudProvider', 'providerName', providerName);
            const localVarPath = `/admin/v1/providers/{providerName}`
                .replace(`{${"providerName"}}`, encodeURIComponent(String(providerName)));
            // 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,
            };
        },
        /**
         * Get cloud provider
         * @summary Get cloud provider
         * @param {string} providerName Name of the cloud provider
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getCloudProvider: async (providerName, options = {}) => {
            // verify required parameter 'providerName' is not null or undefined
            (0, common_1.assertParamExists)('getCloudProvider', 'providerName', providerName);
            const localVarPath = `/admin/v1/providers/{providerName}`
                .replace(`{${"providerName"}}`, encodeURIComponent(String(providerName)));
            // 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 cloud providers
         * @summary List cloud providers
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listCloudProviders: async (options = {}) => {
            const localVarPath = `/admin/v1/providers`;
            // 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 a cloud provider
         * @summary Update a cloud provider
         * @param {string} providerName Name of the cloud provider
         * @param {ProviderUpdate} providerUpdate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateCloudProvider: async (providerName, providerUpdate, options = {}) => {
            // verify required parameter 'providerName' is not null or undefined
            (0, common_1.assertParamExists)('updateCloudProvider', 'providerName', providerName);
            // verify required parameter 'providerUpdate' is not null or undefined
            (0, common_1.assertParamExists)('updateCloudProvider', 'providerUpdate', providerUpdate);
            const localVarPath = `/admin/v1/providers/{providerName}`
                .replace(`{${"providerName"}}`, encodeURIComponent(String(providerName)));
            // 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)(providerUpdate, localVarRequestOptions, configuration);
            return {
                url: (0, common_1.toPathString)(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    };
};
exports.ProviderApiAxiosParamCreator = ProviderApiAxiosParamCreator;
/**
 * ProviderApi - functional programming interface
 * @export
 */
const ProviderApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.ProviderApiAxiosParamCreator)(configuration);
    return {
        /**
         * Create a cloud provider
         * @summary Create a cloud provider
         * @param {ProviderCreate} providerCreate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createCloudProvider(providerCreate, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createCloudProvider(providerCreate, 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['ProviderApi.createCloudProvider']) === 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 a cloud provider
         * @summary Delete a cloud provider
         * @param {string} providerName Name of the cloud provider
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteCloudProvider(providerName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteCloudProvider(providerName, 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['ProviderApi.deleteCloudProvider']) === 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);
        },
        /**
         * Get cloud provider
         * @summary Get cloud provider
         * @param {string} providerName Name of the cloud provider
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getCloudProvider(providerName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.getCloudProvider(providerName, 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['ProviderApi.getCloudProvider']) === 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 cloud providers
         * @summary List cloud providers
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listCloudProviders(options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listCloudProviders(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['ProviderApi.listCloudProviders']) === 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 a cloud provider
         * @summary Update a cloud provider
         * @param {string} providerName Name of the cloud provider
         * @param {ProviderUpdate} providerUpdate
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateCloudProvider(providerName, providerUpdate, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateCloudProvider(providerName, providerUpdate, 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['ProviderApi.updateCloudProvider']) === 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.ProviderApiFp = ProviderApiFp;
/**
 * ProviderApi - factory interface
 * @export
 */
const ProviderApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.ProviderApiFp)(configuration);
    return {
        /**
         * Create a cloud provider
         * @summary Create a cloud provider
         * @param {ProviderApiCreateCloudProviderRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createCloudProvider(requestParameters, options) {
            return localVarFp.createCloudProvider(requestParameters.providerCreate, options).then((request) => request(axios, basePath));
        },
        /**
         * Delete a cloud provider
         * @summary Delete a cloud provider
         * @param {ProviderApiDeleteCloudProviderRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteCloudProvider(requestParameters, options) {
            return localVarFp.deleteCloudProvider(requestParameters.providerName, options).then((request) => request(axios, basePath));
        },
        /**
         * Get cloud provider
         * @summary Get cloud provider
         * @param {ProviderApiGetCloudProviderRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getCloudProvider(requestParameters, options) {
            return localVarFp.getCloudProvider(requestParameters.providerName, options).then((request) => request(axios, basePath));
        },
        /**
         * List cloud providers
         * @summary List cloud providers
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listCloudProviders(options) {
            return localVarFp.listCloudProviders(options).then((request) => request(axios, basePath));
        },
        /**
         * Update a cloud provider
         * @summary Update a cloud provider
         * @param {ProviderApiUpdateCloudProviderRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateCloudProvider(requestParameters, options) {
            return localVarFp.updateCloudProvider(requestParameters.providerName, requestParameters.providerUpdate, options).then((request) => request(axios, basePath));
        },
    };
};
exports.ProviderApiFactory = ProviderApiFactory;
/**
 * ProviderApi - object-oriented interface
 * @export
 * @class ProviderApi
 * @extends {BaseAPI}
 */
class ProviderApi extends base_1.BaseAPI {
    /**
     * Create a cloud provider
     * @summary Create a cloud provider
     * @param {ProviderApiCreateCloudProviderRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ProviderApi
     */
    createCloudProvider(requestParameters, options) {
        return (0, exports.ProviderApiFp)(this.configuration).createCloudProvider(requestParameters.providerCreate, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Delete a cloud provider
     * @summary Delete a cloud provider
     * @param {ProviderApiDeleteCloudProviderRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ProviderApi
     */
    deleteCloudProvider(requestParameters, options) {
        return (0, exports.ProviderApiFp)(this.configuration).deleteCloudProvider(requestParameters.providerName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Get cloud provider
     * @summary Get cloud provider
     * @param {ProviderApiGetCloudProviderRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ProviderApi
     */
    getCloudProvider(requestParameters, options) {
        return (0, exports.ProviderApiFp)(this.configuration).getCloudProvider(requestParameters.providerName, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * List cloud providers
     * @summary List cloud providers
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ProviderApi
     */
    listCloudProviders(options) {
        return (0, exports.ProviderApiFp)(this.configuration).listCloudProviders(options).then((request) => request(this.axios, this.basePath));
    }
    /**
     * Update a cloud provider
     * @summary Update a cloud provider
     * @param {ProviderApiUpdateCloudProviderRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ProviderApi
     */
    updateCloudProvider(requestParameters, options) {
        return (0, exports.ProviderApiFp)(this.configuration).updateCloudProvider(requestParameters.providerName, requestParameters.providerUpdate, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.ProviderApi = ProviderApi;
//# sourceMappingURL=provider-api.js.map