/* 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 { Account } from '../models';
// @ts-ignore
import type { DbTDERequest } from '../models';
/**
 * MssqlApi - axios parameter creator
 * @export
 */
export const MssqlApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary delete mssql account compatible with windows account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} account name of the account
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteMssqlAccount: async (orgName: string, clusterName: string, account: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('deleteMssqlAccount', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('deleteMssqlAccount', 'clusterName', clusterName)
            // verify required parameter 'account' is not null or undefined
            assertParamExists('deleteMssqlAccount', 'account', account)
            const localVarPath = `/admin/v1/data/mssql/organizations/{orgName}/clusters/{clusterName}/accounts`
                .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 (account !== undefined) {
                localVarQueryParameter['account'] = account;
            }


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

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary batch modify database tde status
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {DbTDERequest} [dbTDERequest] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        manageMssqlTDEDatabase: async (orgName: string, clusterName: string, dbTDERequest?: DbTDERequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('manageMssqlTDEDatabase', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('manageMssqlTDEDatabase', 'clusterName', clusterName)
            const localVarPath = `/admin/v1/data/mssql/organizations/{orgName}/clusters/{clusterName}/tde`
                .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(dbTDERequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary update mssql account compatible with windows account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {Account} [account] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateMssqlAccount: async (orgName: string, clusterName: string, account?: Account, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'orgName' is not null or undefined
            assertParamExists('updateMssqlAccount', 'orgName', orgName)
            // verify required parameter 'clusterName' is not null or undefined
            assertParamExists('updateMssqlAccount', 'clusterName', clusterName)
            const localVarPath = `/admin/v1/data/mssql/organizations/{orgName}/clusters/{clusterName}/accounts`
                .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(account, localVarRequestOptions, configuration)

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

/**
 * MssqlApi - functional programming interface
 * @export
 */
export const MssqlApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = MssqlApiAxiosParamCreator(configuration)
    return {
        /**
         * 
         * @summary delete mssql account compatible with windows account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {string} account name of the account
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteMssqlAccount(orgName: string, clusterName: string, account: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteMssqlAccount(orgName, clusterName, account, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['MssqlApi.deleteMssqlAccount']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary batch modify database tde status
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {DbTDERequest} [dbTDERequest] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async manageMssqlTDEDatabase(orgName: string, clusterName: string, dbTDERequest?: DbTDERequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.manageMssqlTDEDatabase(orgName, clusterName, dbTDERequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['MssqlApi.manageMssqlTDEDatabase']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
        /**
         * 
         * @summary update mssql account compatible with windows account
         * @param {string} orgName name of the organization
         * @param {string} clusterName name of the cluster
         * @param {Account} [account] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateMssqlAccount(orgName: string, clusterName: string, account?: Account, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateMssqlAccount(orgName, clusterName, account, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['MssqlApi.updateMssqlAccount']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * MssqlApi - factory interface
 * @export
 */
export const MssqlApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = MssqlApiFp(configuration)
    return {
        /**
         * 
         * @summary delete mssql account compatible with windows account
         * @param {MssqlApiDeleteMssqlAccountRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteMssqlAccount(requestParameters: MssqlApiDeleteMssqlAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.deleteMssqlAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.account, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary batch modify database tde status
         * @param {MssqlApiManageMssqlTDEDatabaseRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        manageMssqlTDEDatabase(requestParameters: MssqlApiManageMssqlTDEDatabaseRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.manageMssqlTDEDatabase(requestParameters.orgName, requestParameters.clusterName, requestParameters.dbTDERequest, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary update mssql account compatible with windows account
         * @param {MssqlApiUpdateMssqlAccountRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateMssqlAccount(requestParameters: MssqlApiUpdateMssqlAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void> {
            return localVarFp.updateMssqlAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.account, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * MssqlApi - interface
 * @export
 * @interface MssqlApi
 */
export interface MssqlApiInterface {
    /**
     * 
     * @summary delete mssql account compatible with windows account
     * @param {MssqlApiDeleteMssqlAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MssqlApiInterface
     */
    deleteMssqlAccount(requestParameters: MssqlApiDeleteMssqlAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary batch modify database tde status
     * @param {MssqlApiManageMssqlTDEDatabaseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MssqlApiInterface
     */
    manageMssqlTDEDatabase(requestParameters: MssqlApiManageMssqlTDEDatabaseRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

    /**
     * 
     * @summary update mssql account compatible with windows account
     * @param {MssqlApiUpdateMssqlAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MssqlApiInterface
     */
    updateMssqlAccount(requestParameters: MssqlApiUpdateMssqlAccountRequest, options?: RawAxiosRequestConfig): AxiosPromise<void>;

}

/**
 * Request parameters for deleteMssqlAccount operation in MssqlApi.
 * @export
 * @interface MssqlApiDeleteMssqlAccountRequest
 */
export interface MssqlApiDeleteMssqlAccountRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof MssqlApiDeleteMssqlAccount
     */
    readonly orgName: string

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

    /**
     * name of the account
     * @type {string}
     * @memberof MssqlApiDeleteMssqlAccount
     */
    readonly account: string
}

/**
 * Request parameters for manageMssqlTDEDatabase operation in MssqlApi.
 * @export
 * @interface MssqlApiManageMssqlTDEDatabaseRequest
 */
export interface MssqlApiManageMssqlTDEDatabaseRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof MssqlApiManageMssqlTDEDatabase
     */
    readonly orgName: string

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

    /**
     * 
     * @type {DbTDERequest}
     * @memberof MssqlApiManageMssqlTDEDatabase
     */
    readonly dbTDERequest?: DbTDERequest
}

/**
 * Request parameters for updateMssqlAccount operation in MssqlApi.
 * @export
 * @interface MssqlApiUpdateMssqlAccountRequest
 */
export interface MssqlApiUpdateMssqlAccountRequest {
    /**
     * name of the organization
     * @type {string}
     * @memberof MssqlApiUpdateMssqlAccount
     */
    readonly orgName: string

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

    /**
     * 
     * @type {Account}
     * @memberof MssqlApiUpdateMssqlAccount
     */
    readonly account?: Account
}

/**
 * MssqlApi - object-oriented interface
 * @export
 * @class MssqlApi
 * @extends {BaseAPI}
 */
export class MssqlApi extends BaseAPI implements MssqlApiInterface {
    /**
     * 
     * @summary delete mssql account compatible with windows account
     * @param {MssqlApiDeleteMssqlAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MssqlApi
     */
    public deleteMssqlAccount(requestParameters: MssqlApiDeleteMssqlAccountRequest, options?: RawAxiosRequestConfig) {
        return MssqlApiFp(this.configuration).deleteMssqlAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.account, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary batch modify database tde status
     * @param {MssqlApiManageMssqlTDEDatabaseRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MssqlApi
     */
    public manageMssqlTDEDatabase(requestParameters: MssqlApiManageMssqlTDEDatabaseRequest, options?: RawAxiosRequestConfig) {
        return MssqlApiFp(this.configuration).manageMssqlTDEDatabase(requestParameters.orgName, requestParameters.clusterName, requestParameters.dbTDERequest, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary update mssql account compatible with windows account
     * @param {MssqlApiUpdateMssqlAccountRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof MssqlApi
     */
    public updateMssqlAccount(requestParameters: MssqlApiUpdateMssqlAccountRequest, options?: RawAxiosRequestConfig) {
        return MssqlApiFp(this.configuration).updateMssqlAccount(requestParameters.orgName, requestParameters.clusterName, requestParameters.account, options).then((request) => request(this.axios, this.basePath));
    }
}

