/* 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.
 */


import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { APIErrorResponse } from '../models';
// @ts-ignore
import type { Cluster } from '../models';
// @ts-ignore
import type { RecycleBinCluster } from '../models';
// @ts-ignore
import type { RecycleBinClusterList } from '../models';
/**
 * RecycleBinClusterApi - axios parameter creator
 * @export
 */
export const RecycleBinClusterApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Delete cluster from the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {boolean} isDeleteBackup whether to delete the backup of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRecycleBinCluster: async (orgName: string, clusterName: string, isDeleteBackup: boolean, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('deleteRecycleBinCluster', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('deleteRecycleBinCluster', 'clusterName', clusterName)
            // verify required parameter 'isDeleteBackup' is not null or undefined
            assertParamExists('deleteRecycleBinCluster', 'isDeleteBackup', isDeleteBackup)
            const localVarPath = `/api/v1/organizations/{orgName}/recycleBin/clusters/{clusterName}`
                .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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)

            if (isDeleteBackup !== undefined) {
                localVarQueryParameter['isDeleteBackup'] = isDeleteBackup;
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get cluster in the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getRecycleBinCluster: async (orgName: string, clusterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('getRecycleBinCluster', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('getRecycleBinCluster', 'clusterName', clusterName)
            const localVarPath = `/api/v1/organizations/{orgName}/recycleBin/clusters/{clusterName}`
                .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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary List clusters in the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRecycleBinCluster: async (orgName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listRecycleBinCluster', 'orgName', orgName)
            const localVarPath = `/api/v1/organizations/{orgName}/recycleBin/clusters`
                .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName)));
            // use dummy base URL string because the URL constructor only accepts absolute URLs.
            const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Restore cluster from the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        restoreRecycleBinCluster: async (orgName: string, clusterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('restoreRecycleBinCluster', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('restoreRecycleBinCluster', 'clusterName', clusterName)
            const localVarPath = `/api/v1/organizations/{orgName}/recycleBin/clusters/{clusterName}/restore`
                .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, DUMMY_BASE_URL);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }

            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication BearerToken required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            // authentication DigestAuth required
            await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration)


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * RecycleBinClusterApi - functional programming interface
 * @export
 */
export const RecycleBinClusterApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = RecycleBinClusterApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Delete cluster from the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {boolean} isDeleteBackup whether to delete the backup of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteRecycleBinCluster(orgName: string, clusterName: string, isDeleteBackup: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteRecycleBinCluster(orgName, clusterName, isDeleteBackup, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RecycleBinClusterApi.deleteRecycleBinCluster']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get cluster in the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getRecycleBinCluster(orgName: string, clusterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RecycleBinCluster>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getRecycleBinCluster(orgName, clusterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RecycleBinClusterApi.getRecycleBinCluster']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List clusters in the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listRecycleBinCluster(orgName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RecycleBinClusterList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listRecycleBinCluster(orgName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RecycleBinClusterApi.listRecycleBinCluster']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Restore cluster from the Recycle Bin of the Org
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async restoreRecycleBinCluster(orgName: string, clusterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Cluster>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.restoreRecycleBinCluster(orgName, clusterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['RecycleBinClusterApi.restoreRecycleBinCluster']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * RecycleBinClusterApi - factory interface
 * @export
 */
export const RecycleBinClusterApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = RecycleBinClusterApiFp(configuration)
    return {
        /**
         * 
         * @summary Delete cluster from the Recycle Bin of the Org
         * @param {RecycleBinClusterApiDeleteRecycleBinClusterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteRecycleBinCluster(requestParameters: RecycleBinClusterApiDeleteRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteRecycleBinCluster(requestParameters.orgName, requestParameters.clusterName, requestParameters.isDeleteBackup, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get cluster in the Recycle Bin of the Org
         * @param {RecycleBinClusterApiGetRecycleBinClusterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getRecycleBinCluster(requestParameters: RecycleBinClusterApiGetRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<RecycleBinCluster> {
            return localVarFp.getRecycleBinCluster(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List clusters in the Recycle Bin of the Org
         * @param {RecycleBinClusterApiListRecycleBinClusterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listRecycleBinCluster(requestParameters: RecycleBinClusterApiListRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<RecycleBinClusterList> {
            return localVarFp.listRecycleBinCluster(requestParameters.orgName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Restore cluster from the Recycle Bin of the Org
         * @param {RecycleBinClusterApiRestoreRecycleBinClusterRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        restoreRecycleBinCluster(requestParameters: RecycleBinClusterApiRestoreRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<Cluster> {
            return localVarFp.restoreRecycleBinCluster(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * RecycleBinClusterApi - interface
 * @export
 * @interface RecycleBinClusterApi
 */
export interface RecycleBinClusterApiInterface {
    /**
     * 
     * @summary Delete cluster from the Recycle Bin of the Org
     * @param {RecycleBinClusterApiDeleteRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApiInterface
     */
    deleteRecycleBinCluster(requestParameters: RecycleBinClusterApiDeleteRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary Get cluster in the Recycle Bin of the Org
     * @param {RecycleBinClusterApiGetRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApiInterface
     */
    getRecycleBinCluster(requestParameters: RecycleBinClusterApiGetRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<RecycleBinCluster>;

    /**
     * 
     * @summary List clusters in the Recycle Bin of the Org
     * @param {RecycleBinClusterApiListRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApiInterface
     */
    listRecycleBinCluster(requestParameters: RecycleBinClusterApiListRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<RecycleBinClusterList>;

    /**
     * 
     * @summary Restore cluster from the Recycle Bin of the Org
     * @param {RecycleBinClusterApiRestoreRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApiInterface
     */
    restoreRecycleBinCluster(requestParameters: RecycleBinClusterApiRestoreRecycleBinClusterRequest, options?: RawAxiosRequestConfig): AxiosPromise<Cluster>;

}

/**
 * Request parameters for deleteRecycleBinCluster operation in RecycleBinClusterApi.
 * @export
 * @interface RecycleBinClusterApiDeleteRecycleBinClusterRequest
 */
export interface RecycleBinClusterApiDeleteRecycleBinClusterRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RecycleBinClusterApiDeleteRecycleBinCluster
     */
    readonly orgName: string

    /**
     * name of the cluster
     * @type {string}
     * @memberof RecycleBinClusterApiDeleteRecycleBinCluster
     */
    readonly clusterName: string

    /**
     * whether to delete the backup of the cluster
     * @type {boolean}
     * @memberof RecycleBinClusterApiDeleteRecycleBinCluster
     */
    readonly isDeleteBackup: boolean
}

/**
 * Request parameters for getRecycleBinCluster operation in RecycleBinClusterApi.
 * @export
 * @interface RecycleBinClusterApiGetRecycleBinClusterRequest
 */
export interface RecycleBinClusterApiGetRecycleBinClusterRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RecycleBinClusterApiGetRecycleBinCluster
     */
    readonly orgName: string

    /**
     * name of the cluster
     * @type {string}
     * @memberof RecycleBinClusterApiGetRecycleBinCluster
     */
    readonly clusterName: string
}

/**
 * Request parameters for listRecycleBinCluster operation in RecycleBinClusterApi.
 * @export
 * @interface RecycleBinClusterApiListRecycleBinClusterRequest
 */
export interface RecycleBinClusterApiListRecycleBinClusterRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RecycleBinClusterApiListRecycleBinCluster
     */
    readonly orgName: string
}

/**
 * Request parameters for restoreRecycleBinCluster operation in RecycleBinClusterApi.
 * @export
 * @interface RecycleBinClusterApiRestoreRecycleBinClusterRequest
 */
export interface RecycleBinClusterApiRestoreRecycleBinClusterRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof RecycleBinClusterApiRestoreRecycleBinCluster
     */
    readonly orgName: string

    /**
     * name of the cluster
     * @type {string}
     * @memberof RecycleBinClusterApiRestoreRecycleBinCluster
     */
    readonly clusterName: string
}

/**
 * RecycleBinClusterApi - object-oriented interface
 * @export
 * @class RecycleBinClusterApi
 * @extends {BaseAPI}
 */
export class RecycleBinClusterApi extends BaseAPI implements RecycleBinClusterApiInterface {
    /**
     * 
     * @summary Delete cluster from the Recycle Bin of the Org
     * @param {RecycleBinClusterApiDeleteRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApi
     */
    public deleteRecycleBinCluster(requestParameters: RecycleBinClusterApiDeleteRecycleBinClusterRequest, options?: RawAxiosRequestConfig) {
        return RecycleBinClusterApiFp(this.configuration).deleteRecycleBinCluster(requestParameters.orgName, requestParameters.clusterName, requestParameters.isDeleteBackup, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get cluster in the Recycle Bin of the Org
     * @param {RecycleBinClusterApiGetRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApi
     */
    public getRecycleBinCluster(requestParameters: RecycleBinClusterApiGetRecycleBinClusterRequest, options?: RawAxiosRequestConfig) {
        return RecycleBinClusterApiFp(this.configuration).getRecycleBinCluster(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List clusters in the Recycle Bin of the Org
     * @param {RecycleBinClusterApiListRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApi
     */
    public listRecycleBinCluster(requestParameters: RecycleBinClusterApiListRecycleBinClusterRequest, options?: RawAxiosRequestConfig) {
        return RecycleBinClusterApiFp(this.configuration).listRecycleBinCluster(requestParameters.orgName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Restore cluster from the Recycle Bin of the Org
     * @param {RecycleBinClusterApiRestoreRecycleBinClusterRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof RecycleBinClusterApi
     */
    public restoreRecycleBinCluster(requestParameters: RecycleBinClusterApiRestoreRecycleBinClusterRequest, options?: RawAxiosRequestConfig) {
        return RecycleBinClusterApiFp(this.configuration).restoreRecycleBinCluster(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }
}

