/* 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 { EnableServiceVersion200Response } from '../models';
// @ts-ignore
import type { EnableServiceVersionRequest } from '../models';
// @ts-ignore
import type { EnableServiceVersionRequest1 } from '../models';
/**
 * EnableServiceVersionApi - axios parameter creator
 * @export
 */
export const EnableServiceVersionApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * enable the service version of the engine and create related resources
         * @summary enable the service version of the engine
         * @param {string} environmentName environment name
         * @param {string} engineName Name of the engine
         * @param {EnableServiceVersionRequest} enableServiceVersionRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        enableServiceVersion: async (environmentName: string, engineName: string, enableServiceVersionRequest: EnableServiceVersionRequest, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'environmentName' is not null or undefined
            assertParamExists('enableServiceVersion', 'environmentName', environmentName)
            // verify required parameter 'engineName' is not null or undefined
            assertParamExists('enableServiceVersion', 'engineName', engineName)
            // verify required parameter 'enableServiceVersionRequest' is not null or undefined
            assertParamExists('enableServiceVersion', 'enableServiceVersionRequest', enableServiceVersionRequest)
            const localVarPath = `/admin/v1/environments/{environmentName}/engines/{engineName}/serviceVersion`
                .replace(`{${"environmentName"}}`, encodeURIComponent(String(environmentName)))
                .replace(`{${"engineName"}}`, encodeURIComponent(String(engineName)));
            // 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)


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

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

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

/**
 * EnableServiceVersionApi - functional programming interface
 * @export
 */
export const EnableServiceVersionApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = EnableServiceVersionApiAxiosParamCreator(configuration)
    return {
        /**
         * enable the service version of the engine and create related resources
         * @summary enable the service version of the engine
         * @param {string} environmentName environment name
         * @param {string} engineName Name of the engine
         * @param {EnableServiceVersionRequest} enableServiceVersionRequest 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async enableServiceVersion(environmentName: string, engineName: string, enableServiceVersionRequest: EnableServiceVersionRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<EnableServiceVersion200Response>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.enableServiceVersion(environmentName, engineName, enableServiceVersionRequest, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['EnableServiceVersionApi.enableServiceVersion']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * EnableServiceVersionApi - factory interface
 * @export
 */
export const EnableServiceVersionApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = EnableServiceVersionApiFp(configuration)
    return {
        /**
         * enable the service version of the engine and create related resources
         * @summary enable the service version of the engine
         * @param {EnableServiceVersionApiEnableServiceVersionRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        enableServiceVersion(requestParameters: EnableServiceVersionApiEnableServiceVersionRequest, options?: RawAxiosRequestConfig): AxiosPromise<EnableServiceVersion200Response> {
            return localVarFp.enableServiceVersion(requestParameters.environmentName, requestParameters.engineName, requestParameters.enableServiceVersionRequest, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * EnableServiceVersionApi - interface
 * @export
 * @interface EnableServiceVersionApi
 */
export interface EnableServiceVersionApiInterface {
    /**
     * enable the service version of the engine and create related resources
     * @summary enable the service version of the engine
     * @param {EnableServiceVersionApiEnableServiceVersionRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EnableServiceVersionApiInterface
     */
    enableServiceVersion(requestParameters: EnableServiceVersionApiEnableServiceVersionRequest, options?: RawAxiosRequestConfig): AxiosPromise<EnableServiceVersion200Response>;

}

/**
 * Request parameters for enableServiceVersion operation in EnableServiceVersionApi.
 * @export
 * @interface EnableServiceVersionApiEnableServiceVersionRequest
 */
export interface EnableServiceVersionApiEnableServiceVersionRequest {
    /**
     * environment name
     * @type {string}
     * @memberof EnableServiceVersionApiEnableServiceVersion
     */
    readonly environmentName: string

    /**
     * Name of the engine
     * @type {string}
     * @memberof EnableServiceVersionApiEnableServiceVersion
     */
    readonly engineName: string

    /**
     * 
     * @type {EnableServiceVersionRequest}
     * @memberof EnableServiceVersionApiEnableServiceVersion
     */
    readonly enableServiceVersionRequest: EnableServiceVersionRequest
}

/**
 * EnableServiceVersionApi - object-oriented interface
 * @export
 * @class EnableServiceVersionApi
 * @extends {BaseAPI}
 */
export class EnableServiceVersionApi extends BaseAPI implements EnableServiceVersionApiInterface {
    /**
     * enable the service version of the engine and create related resources
     * @summary enable the service version of the engine
     * @param {EnableServiceVersionApiEnableServiceVersionRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof EnableServiceVersionApi
     */
    public enableServiceVersion(requestParameters: EnableServiceVersionApiEnableServiceVersionRequest, options?: RawAxiosRequestConfig) {
        return EnableServiceVersionApiFp(this.configuration).enableServiceVersion(requestParameters.environmentName, requestParameters.engineName, requestParameters.enableServiceVersionRequest, options).then((request) => request(this.axios, this.basePath));
    }
}

