/* 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 { LoadBalancer } from '../models';
/**
 * LoadBalancerApi - axios parameter creator
 * @export
 */
export const LoadBalancerApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Check if the load balancer is available
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        checkLoadBalancer: async (environmentName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'environmentName' is not null or undefined
            assertParamExists('checkLoadBalancer', 'environmentName', environmentName)
            const localVarPath = `/admin/v1/environments/{environmentName}/loadbalancer/check`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)));
            // 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,
            };
        },
        /**
         * 
         * @summary Get the load balancer info in the environment
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getLoadBalancer: async (environmentName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'environmentName' is not null or undefined
            assertParamExists('getLoadBalancer', 'environmentName', environmentName)
            const localVarPath = `/admin/v1/environments/{environmentName}/loadbalancer`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)));
            // 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,
            };
        },
    }
};

/**
 * LoadBalancerApi - functional programming interface
 * @export
 */
export const LoadBalancerApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = LoadBalancerApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Check if the load balancer is available
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async checkLoadBalancer(environmentName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.checkLoadBalancer(environmentName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['LoadBalancerApi.checkLoadBalancer']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Get the load balancer info in the environment
         * @param {string} environmentName name of the environment
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getLoadBalancer(environmentName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<LoadBalancer>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getLoadBalancer(environmentName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['LoadBalancerApi.getLoadBalancer']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * LoadBalancerApi - factory interface
 * @export
 */
export const LoadBalancerApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = LoadBalancerApiFp(configuration)
    return {
        /**
         * 
         * @summary Check if the load balancer is available
         * @param {LoadBalancerApiCheckLoadBalancerRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        checkLoadBalancer(requestParameters: LoadBalancerApiCheckLoadBalancerRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.checkLoadBalancer(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get the load balancer info in the environment
         * @param {LoadBalancerApiGetLoadBalancerRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getLoadBalancer(requestParameters: LoadBalancerApiGetLoadBalancerRequest, options?: RawAxiosRequestConfig): AxiosPromise<LoadBalancer> {
            return localVarFp.getLoadBalancer(requestParameters.environmentName, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * LoadBalancerApi - interface
 * @export
 * @interface LoadBalancerApi
 */
export interface LoadBalancerApiInterface {
    /**
     * 
     * @summary Check if the load balancer is available
     * @param {LoadBalancerApiCheckLoadBalancerRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LoadBalancerApiInterface
     */
    checkLoadBalancer(requestParameters: LoadBalancerApiCheckLoadBalancerRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary Get the load balancer info in the environment
     * @param {LoadBalancerApiGetLoadBalancerRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LoadBalancerApiInterface
     */
    getLoadBalancer(requestParameters: LoadBalancerApiGetLoadBalancerRequest, options?: RawAxiosRequestConfig): AxiosPromise<LoadBalancer>;

}

/**
 * Request parameters for checkLoadBalancer operation in LoadBalancerApi.
 * @export
 * @interface LoadBalancerApiCheckLoadBalancerRequest
 */
export interface LoadBalancerApiCheckLoadBalancerRequest {
    /**
     * name of the environment
     * @type {string}
     * @memberof LoadBalancerApiCheckLoadBalancer
     */
    readonly environmentName: string
}

/**
 * Request parameters for getLoadBalancer operation in LoadBalancerApi.
 * @export
 * @interface LoadBalancerApiGetLoadBalancerRequest
 */
export interface LoadBalancerApiGetLoadBalancerRequest {
    /**
     * name of the environment
     * @type {string}
     * @memberof LoadBalancerApiGetLoadBalancer
     */
    readonly environmentName: string
}

/**
 * LoadBalancerApi - object-oriented interface
 * @export
 * @class LoadBalancerApi
 * @extends {BaseAPI}
 */
export class LoadBalancerApi extends BaseAPI implements LoadBalancerApiInterface {
    /**
     * 
     * @summary Check if the load balancer is available
     * @param {LoadBalancerApiCheckLoadBalancerRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LoadBalancerApi
     */
    public checkLoadBalancer(requestParameters: LoadBalancerApiCheckLoadBalancerRequest, options?: RawAxiosRequestConfig) {
        return LoadBalancerApiFp(this.configuration).checkLoadBalancer(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get the load balancer info in the environment
     * @param {LoadBalancerApiGetLoadBalancerRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof LoadBalancerApi
     */
    public getLoadBalancer(requestParameters: LoadBalancerApiGetLoadBalancerRequest, options?: RawAxiosRequestConfig) {
        return LoadBalancerApiFp(this.configuration).getLoadBalancer(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath));
    }
}

