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


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 { ClusterVulns } from '../models';
// @ts-ignore
import type { MarkVulnsAsIgnored } from '../models';
// @ts-ignore
import type { VulnList } from '../models';
/**
 * VulnApi - axios parameter creator
 * @export
 */
export const VulnApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary List vulnerabilities which affected the cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listClusterVulns: async (orgName: string, clusterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('listClusterVulns', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('listClusterVulns', 'clusterName', clusterName)
            const localVarPath = `/admin/v1/organizations/{orgName}/clusters/{clusterName}/vulns`
                .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 vulnerabilities
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listVulns: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/vulns`;
            // 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 Mark vulnerabilities as ignored
         * @param {MarkVulnsAsIgnored} [markVulnsAsIgnored] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        markVulnsAsIgnored: async (markVulnsAsIgnored?: MarkVulnsAsIgnored, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/admin/v1/vulns`;
            // 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: 'PATCH', ...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)


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Upload vulnerabilities
         * @param {File} file the data file, zip or other format
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        uploadVulns: async (file: File, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'file' is not null or undefined
            assertParamExists('uploadVulns', 'file', file)
            const localVarPath = `/admin/v1/vulns`;
            // 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: 'PUT', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;
            const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();

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

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


            if (file !== undefined) { 
                localVarFormParams.append('file', file as any);
            }
    
    
            localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = localVarFormParams;

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

/**
 * VulnApi - functional programming interface
 * @export
 */
export const VulnApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = VulnApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary List vulnerabilities which affected the cluster
         * @param {string} orgName name of the Org
         * @param {string} clusterName name of the cluster
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listClusterVulns(orgName: string, clusterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ClusterVulns>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listClusterVulns(orgName, clusterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VulnApi.listClusterVulns']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary List vulnerabilities
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async listVulns(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<VulnList>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.listVulns(options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VulnApi.listVulns']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Mark vulnerabilities as ignored
         * @param {MarkVulnsAsIgnored} [markVulnsAsIgnored] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async markVulnsAsIgnored(markVulnsAsIgnored?: MarkVulnsAsIgnored, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.markVulnsAsIgnored(markVulnsAsIgnored, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VulnApi.markVulnsAsIgnored']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Upload vulnerabilities
         * @param {File} file the data file, zip or other format
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async uploadVulns(file: File, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.uploadVulns(file, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['VulnApi.uploadVulns']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * VulnApi - factory interface
 * @export
 */
export const VulnApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = VulnApiFp(configuration)
    return {
        /**
         * 
         * @summary List vulnerabilities which affected the cluster
         * @param {VulnApiListClusterVulnsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listClusterVulns(requestParameters: VulnApiListClusterVulnsRequest, options?: RawAxiosRequestConfig): AxiosPromise<ClusterVulns> {
            return localVarFp.listClusterVulns(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary List vulnerabilities
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        listVulns(options?: RawAxiosRequestConfig): AxiosPromise<VulnList> {
            return localVarFp.listVulns(options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Mark vulnerabilities as ignored
         * @param {VulnApiMarkVulnsAsIgnoredRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        markVulnsAsIgnored(requestParameters: VulnApiMarkVulnsAsIgnoredRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.markVulnsAsIgnored(requestParameters.markVulnsAsIgnored, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Upload vulnerabilities
         * @param {VulnApiUploadVulnsRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        uploadVulns(requestParameters: VulnApiUploadVulnsRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.uploadVulns(requestParameters.file, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * VulnApi - interface
 * @export
 * @interface VulnApi
 */
export interface VulnApiInterface {
    /**
     * 
     * @summary List vulnerabilities which affected the cluster
     * @param {VulnApiListClusterVulnsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApiInterface
     */
    listClusterVulns(requestParameters: VulnApiListClusterVulnsRequest, options?: RawAxiosRequestConfig): AxiosPromise<ClusterVulns>;

    /**
     * 
     * @summary List vulnerabilities
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApiInterface
     */
    listVulns(options?: RawAxiosRequestConfig): AxiosPromise<VulnList>;

    /**
     * 
     * @summary Mark vulnerabilities as ignored
     * @param {VulnApiMarkVulnsAsIgnoredRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApiInterface
     */
    markVulnsAsIgnored(requestParameters?: VulnApiMarkVulnsAsIgnoredRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary Upload vulnerabilities
     * @param {VulnApiUploadVulnsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApiInterface
     */
    uploadVulns(requestParameters: VulnApiUploadVulnsRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

}

/**
 * Request parameters for listClusterVulns operation in VulnApi.
 * @export
 * @interface VulnApiListClusterVulnsRequest
 */
export interface VulnApiListClusterVulnsRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof VulnApiListClusterVulns
     */
    readonly orgName: string

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

/**
 * Request parameters for markVulnsAsIgnored operation in VulnApi.
 * @export
 * @interface VulnApiMarkVulnsAsIgnoredRequest
 */
export interface VulnApiMarkVulnsAsIgnoredRequest {
    /**
     * 
     * @type {MarkVulnsAsIgnored}
     * @memberof VulnApiMarkVulnsAsIgnored
     */
    readonly markVulnsAsIgnored?: MarkVulnsAsIgnored
}

/**
 * Request parameters for uploadVulns operation in VulnApi.
 * @export
 * @interface VulnApiUploadVulnsRequest
 */
export interface VulnApiUploadVulnsRequest {
    /**
     * the data file, zip or other format
     * @type {File}
     * @memberof VulnApiUploadVulns
     */
    readonly file: File
}

/**
 * VulnApi - object-oriented interface
 * @export
 * @class VulnApi
 * @extends {BaseAPI}
 */
export class VulnApi extends BaseAPI implements VulnApiInterface {
    /**
     * 
     * @summary List vulnerabilities which affected the cluster
     * @param {VulnApiListClusterVulnsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApi
     */
    public listClusterVulns(requestParameters: VulnApiListClusterVulnsRequest, options?: RawAxiosRequestConfig) {
        return VulnApiFp(this.configuration).listClusterVulns(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary List vulnerabilities
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApi
     */
    public listVulns(options?: RawAxiosRequestConfig) {
        return VulnApiFp(this.configuration).listVulns(options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Mark vulnerabilities as ignored
     * @param {VulnApiMarkVulnsAsIgnoredRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApi
     */
    public markVulnsAsIgnored(requestParameters: VulnApiMarkVulnsAsIgnoredRequest = {}, options?: RawAxiosRequestConfig) {
        return VulnApiFp(this.configuration).markVulnsAsIgnored(requestParameters.markVulnsAsIgnored, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Upload vulnerabilities
     * @param {VulnApiUploadVulnsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof VulnApi
     */
    public uploadVulns(requestParameters: VulnApiUploadVulnsRequest, options?: RawAxiosRequestConfig) {
        return VulnApiFp(this.configuration).uploadVulns(requestParameters.file, options).then((request) => request(this.axios, this.basePath));
    }
}

