"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.RelationApi = exports.RelationApiFactory = exports.RelationApiFp = exports.RelationApiAxiosParamCreator = 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");
/**
 * RelationApi - axios parameter creator
 * @export
 */
const RelationApiAxiosParamCreator = function (configuration) {
    return {
        /**
         *
         * @summary create a relation between the clusters in the organization
         * @param {string} orgName
         * @param {string} clusterName
         * @param {string} target
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRelation: async (orgName, clusterName, target, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('createRelation', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('createRelation', 'clusterName', clusterName);
            // verify required parameter 'target' is not null or undefined
            (0, common_1.assertParamExists)('createRelation', 'target', target);
            const localVarPath = `/admin/v1/organizations/{orgName}/clusters/{clusterName}/relations`
                .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);
            if (target !== undefined) {
                localVarQueryParameter['target'] = target;
            }
            (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 delete a existed relation between the clusters in the organization
         * @param {string} orgName
         * @param {string} clusterName
         * @param {string} target
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRelation: async (orgName, clusterName, target, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('deleteRelation', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('deleteRelation', 'clusterName', clusterName);
            // verify required parameter 'target' is not null or undefined
            (0, common_1.assertParamExists)('deleteRelation', 'target', target);
            const localVarPath = `/admin/v1/organizations/{orgName}/clusters/{clusterName}/relation/{target}`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)))
                .replace(`{${"clusterName"}}`, encodeURIComponent(String(clusterName)))
                .replace(`{${"target"}}`, encodeURIComponent(String(target)));
            // 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 the available clusters for the organization to create the a relation
         * @param {string} orgName
         * @param {string} clusterName
         * @param {string} targetType
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAvailableClustersForRelation: async (orgName, clusterName, targetType, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('listAvailableClustersForRelation', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('listAvailableClustersForRelation', 'clusterName', clusterName);
            // verify required parameter 'targetType' is not null or undefined
            (0, common_1.assertParamExists)('listAvailableClustersForRelation', 'targetType', targetType);
            const localVarPath = `/admin/v1/organizations/{orgName}/cluster/{clusterName}/available-relations`
                .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);
            if (targetType !== undefined) {
                localVarQueryParameter['targetType'] = targetType;
            }
            (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 the clusters that have built a relation to the specified cluster
         * @param {string} orgName
         * @param {string} clusterName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRelatedClusters: async (orgName, clusterName, options = {}) => {
            // verify required parameter 'orgName' is not null or undefined
            (0, common_1.assertParamExists)('listRelatedClusters', 'orgName', orgName);
            // verify required parameter 'clusterName' is not null or undefined
            (0, common_1.assertParamExists)('listRelatedClusters', 'clusterName', clusterName);
            const localVarPath = `/admin/v1/organizations/{orgName}/clusters/{clusterName}/relations`
                .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,
            };
        },
    };
};
exports.RelationApiAxiosParamCreator = RelationApiAxiosParamCreator;
/**
 * RelationApi - functional programming interface
 * @export
 */
const RelationApiFp = function (configuration) {
    const localVarAxiosParamCreator = (0, exports.RelationApiAxiosParamCreator)(configuration);
    return {
        /**
         *
         * @summary create a relation between the clusters in the organization
         * @param {string} orgName
         * @param {string} clusterName
         * @param {string} target
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createRelation(orgName, clusterName, target, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.createRelation(orgName, clusterName, target, 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['RelationApi.createRelation']) === 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 a existed relation between the clusters in the organization
         * @param {string} orgName
         * @param {string} clusterName
         * @param {string} target
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteRelation(orgName, clusterName, target, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRelation(orgName, clusterName, target, 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['RelationApi.deleteRelation']) === 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 the available clusters for the organization to create the a relation
         * @param {string} orgName
         * @param {string} clusterName
         * @param {string} targetType
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listAvailableClustersForRelation(orgName, clusterName, targetType, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listAvailableClustersForRelation(orgName, clusterName, targetType, 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['RelationApi.listAvailableClustersForRelation']) === 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 the clusters that have built a relation to the specified cluster
         * @param {string} orgName
         * @param {string} clusterName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listRelatedClusters(orgName, clusterName, options) {
            var _a, _b, _c;
            const localVarAxiosArgs = await localVarAxiosParamCreator.listRelatedClusters(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['RelationApi.listRelatedClusters']) === 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.RelationApiFp = RelationApiFp;
/**
 * RelationApi - factory interface
 * @export
 */
const RelationApiFactory = function (configuration, basePath, axios) {
    const localVarFp = (0, exports.RelationApiFp)(configuration);
    return {
        /**
         *
         * @summary create a relation between the clusters in the organization
         * @param {RelationApiCreateRelationRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createRelation(requestParameters, options) {
            return localVarFp.createRelation(requestParameters.orgName, requestParameters.clusterName, requestParameters.target, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary delete a existed relation between the clusters in the organization
         * @param {RelationApiDeleteRelationRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRelation(requestParameters, options) {
            return localVarFp.deleteRelation(requestParameters.orgName, requestParameters.clusterName, requestParameters.target, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary list the available clusters for the organization to create the a relation
         * @param {RelationApiListAvailableClustersForRelationRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listAvailableClustersForRelation(requestParameters, options) {
            return localVarFp.listAvailableClustersForRelation(requestParameters.orgName, requestParameters.clusterName, requestParameters.targetType, options).then((request) => request(axios, basePath));
        },
        /**
         *
         * @summary list the clusters that have built a relation to the specified cluster
         * @param {RelationApiListRelatedClustersRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRelatedClusters(requestParameters, options) {
            return localVarFp.listRelatedClusters(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
    };
};
exports.RelationApiFactory = RelationApiFactory;
/**
 * RelationApi - object-oriented interface
 * @export
 * @class RelationApi
 * @extends {BaseAPI}
 */
class RelationApi extends base_1.BaseAPI {
    /**
     *
     * @summary create a relation between the clusters in the organization
     * @param {RelationApiCreateRelationRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RelationApi
     */
    createRelation(requestParameters, options) {
        return (0, exports.RelationApiFp)(this.configuration).createRelation(requestParameters.orgName, requestParameters.clusterName, requestParameters.target, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary delete a existed relation between the clusters in the organization
     * @param {RelationApiDeleteRelationRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RelationApi
     */
    deleteRelation(requestParameters, options) {
        return (0, exports.RelationApiFp)(this.configuration).deleteRelation(requestParameters.orgName, requestParameters.clusterName, requestParameters.target, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary list the available clusters for the organization to create the a relation
     * @param {RelationApiListAvailableClustersForRelationRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RelationApi
     */
    listAvailableClustersForRelation(requestParameters, options) {
        return (0, exports.RelationApiFp)(this.configuration).listAvailableClustersForRelation(requestParameters.orgName, requestParameters.clusterName, requestParameters.targetType, options).then((request) => request(this.axios, this.basePath));
    }
    /**
     *
     * @summary list the clusters that have built a relation to the specified cluster
     * @param {RelationApiListRelatedClustersRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RelationApi
     */
    listRelatedClusters(requestParameters, options) {
        return (0, exports.RelationApiFp)(this.configuration).listRelatedClusters(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }
}
exports.RelationApi = RelationApi;
//# sourceMappingURL=relation-api.js.map