/* 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 { AlertCluster } from '../models';
/**
 * ClusterAlertSwitchApi - axios parameter creator
 * @export
 */
export const ClusterAlertSwitchApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary Check if cluster alert is disabled
         * @param {string} orgName name of the Org
         * @param {string} clusterName clusterName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getClusterAlertDisabled: async (orgName: string, clusterName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('getClusterAlertDisabled', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('getClusterAlertDisabled', 'clusterName', clusterName)
            const localVarPath = `/admin/v1/organizations/{orgName}/alerts/cluster/{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 Set cluster alert disabled or enabled
         * @param {string} orgName name of the Org
         * @param {string} clusterName clusterName
         * @param {AlertCluster} [alertCluster] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setClusterAlertDisabled: async (orgName: string, clusterName: string, alertCluster?: AlertCluster, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('setClusterAlertDisabled', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('setClusterAlertDisabled', 'clusterName', clusterName)
            const localVarPath = `/admin/v1/organizations/{orgName}/alerts/cluster/{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: '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(alertCluster, localVarRequestOptions, configuration)

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

/**
 * ClusterAlertSwitchApi - functional programming interface
 * @export
 */
export const ClusterAlertSwitchApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ClusterAlertSwitchApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary Check if cluster alert is disabled
         * @param {string} orgName name of the Org
         * @param {string} clusterName clusterName
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getClusterAlertDisabled(orgName: string, clusterName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertCluster>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getClusterAlertDisabled(orgName, clusterName, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ClusterAlertSwitchApi.getClusterAlertDisabled']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary Set cluster alert disabled or enabled
         * @param {string} orgName name of the Org
         * @param {string} clusterName clusterName
         * @param {AlertCluster} [alertCluster] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async setClusterAlertDisabled(orgName: string, clusterName: string, alertCluster?: AlertCluster, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AlertCluster>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.setClusterAlertDisabled(orgName, clusterName, alertCluster, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ClusterAlertSwitchApi.setClusterAlertDisabled']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * ClusterAlertSwitchApi - factory interface
 * @export
 */
export const ClusterAlertSwitchApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ClusterAlertSwitchApiFp(configuration)
    return {
        /**
         * 
         * @summary Check if cluster alert is disabled
         * @param {ClusterAlertSwitchApiGetClusterAlertDisabledRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getClusterAlertDisabled(requestParameters: ClusterAlertSwitchApiGetClusterAlertDisabledRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertCluster> {
            return localVarFp.getClusterAlertDisabled(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Set cluster alert disabled or enabled
         * @param {ClusterAlertSwitchApiSetClusterAlertDisabledRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        setClusterAlertDisabled(requestParameters: ClusterAlertSwitchApiSetClusterAlertDisabledRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertCluster> {
            return localVarFp.setClusterAlertDisabled(requestParameters.orgName, requestParameters.clusterName, requestParameters.alertCluster, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ClusterAlertSwitchApi - interface
 * @export
 * @interface ClusterAlertSwitchApi
 */
export interface ClusterAlertSwitchApiInterface {
    /**
     * 
     * @summary Check if cluster alert is disabled
     * @param {ClusterAlertSwitchApiGetClusterAlertDisabledRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClusterAlertSwitchApiInterface
     */
    getClusterAlertDisabled(requestParameters: ClusterAlertSwitchApiGetClusterAlertDisabledRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertCluster>;

    /**
     * 
     * @summary Set cluster alert disabled or enabled
     * @param {ClusterAlertSwitchApiSetClusterAlertDisabledRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClusterAlertSwitchApiInterface
     */
    setClusterAlertDisabled(requestParameters: ClusterAlertSwitchApiSetClusterAlertDisabledRequest, options?: RawAxiosRequestConfig): AxiosPromise<AlertCluster>;

}

/**
 * Request parameters for getClusterAlertDisabled operation in ClusterAlertSwitchApi.
 * @export
 * @interface ClusterAlertSwitchApiGetClusterAlertDisabledRequest
 */
export interface ClusterAlertSwitchApiGetClusterAlertDisabledRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof ClusterAlertSwitchApiGetClusterAlertDisabled
     */
    readonly orgName: string

    /**
     * clusterName
     * @type {string}
     * @memberof ClusterAlertSwitchApiGetClusterAlertDisabled
     */
    readonly clusterName: string
}

/**
 * Request parameters for setClusterAlertDisabled operation in ClusterAlertSwitchApi.
 * @export
 * @interface ClusterAlertSwitchApiSetClusterAlertDisabledRequest
 */
export interface ClusterAlertSwitchApiSetClusterAlertDisabledRequest {
    /**
     * name of the Org
     * @type {string}
     * @memberof ClusterAlertSwitchApiSetClusterAlertDisabled
     */
    readonly orgName: string

    /**
     * clusterName
     * @type {string}
     * @memberof ClusterAlertSwitchApiSetClusterAlertDisabled
     */
    readonly clusterName: string

    /**
     * 
     * @type {AlertCluster}
     * @memberof ClusterAlertSwitchApiSetClusterAlertDisabled
     */
    readonly alertCluster?: AlertCluster
}

/**
 * ClusterAlertSwitchApi - object-oriented interface
 * @export
 * @class ClusterAlertSwitchApi
 * @extends {BaseAPI}
 */
export class ClusterAlertSwitchApi extends BaseAPI implements ClusterAlertSwitchApiInterface {
    /**
     * 
     * @summary Check if cluster alert is disabled
     * @param {ClusterAlertSwitchApiGetClusterAlertDisabledRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClusterAlertSwitchApi
     */
    public getClusterAlertDisabled(requestParameters: ClusterAlertSwitchApiGetClusterAlertDisabledRequest, options?: RawAxiosRequestConfig) {
        return ClusterAlertSwitchApiFp(this.configuration).getClusterAlertDisabled(requestParameters.orgName, requestParameters.clusterName, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Set cluster alert disabled or enabled
     * @param {ClusterAlertSwitchApiSetClusterAlertDisabledRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ClusterAlertSwitchApi
     */
    public setClusterAlertDisabled(requestParameters: ClusterAlertSwitchApiSetClusterAlertDisabledRequest, options?: RawAxiosRequestConfig) {
        return ClusterAlertSwitchApiFp(this.configuration).setClusterAlertDisabled(requestParameters.orgName, requestParameters.clusterName, requestParameters.alertCluster, options).then((request) => request(this.axios, this.basePath));
    }
}

