/* tslint:disable */
/* eslint-disable */
/**
 * KubeBlocks Cloud Internal API
 * The Internal API is using for interaction of ApeCloud platform microservices. 
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * 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 { ImageRegistry } from '../models';
/**
 * ImagepullsecretApi - axios parameter creator
 * @export
 */
export const ImagepullsecretApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Create image pull secret for environment bootstrap. The environment\'s imageRegistry value must be a registry URL matching image_registries.url (not image_registries.name).
         * @summary Create image pull secret for environment
         * @param {string} environmentName name of the Environment
         * @param {object} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        imagePullSecret: async (environmentName: string, body?: object, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'environmentName' is not null or undefined
            assertParamExists('imagePullSecret', 'environmentName', environmentName)
            const localVarPath = `/internal/v1/environments/{environmentName}/imagepullsecret`
                .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 BasicAuth required
            // http basic authentication required
            setBasicAuthToObject(localVarRequestOptions, 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(body, localVarRequestOptions, configuration)

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

/**
 * ImagepullsecretApi - functional programming interface
 * @export
 */
export const ImagepullsecretApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = ImagepullsecretApiAxiosParamCreator(configuration)
    return {
        /**
         * Create image pull secret for environment bootstrap. The environment\'s imageRegistry value must be a registry URL matching image_registries.url (not image_registries.name).
         * @summary Create image pull secret for environment
         * @param {string} environmentName name of the Environment
         * @param {object} [body] 
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async imagePullSecret(environmentName: string, body?: object, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ImageRegistry>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.imagePullSecret(environmentName, body, options);
            const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
            const localVarOperationServerBasePath = operationServerMap['ImagepullsecretApi.imagePullSecret']?.[localVarOperationServerIndex]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
        },
    }
};

/**
 * ImagepullsecretApi - factory interface
 * @export
 */
export const ImagepullsecretApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = ImagepullsecretApiFp(configuration)
    return {
        /**
         * Create image pull secret for environment bootstrap. The environment\'s imageRegistry value must be a registry URL matching image_registries.url (not image_registries.name).
         * @summary Create image pull secret for environment
         * @param {ImagepullsecretApiImagePullSecretRequest} requestParameters Request parameters.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        imagePullSecret(requestParameters: ImagepullsecretApiImagePullSecretRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry> {
            return localVarFp.imagePullSecret(requestParameters.environmentName, requestParameters.body, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * ImagepullsecretApi - interface
 * @export
 * @interface ImagepullsecretApi
 */
export interface ImagepullsecretApiInterface {
    /**
     * Create image pull secret for environment bootstrap. The environment\'s imageRegistry value must be a registry URL matching image_registries.url (not image_registries.name).
     * @summary Create image pull secret for environment
     * @param {ImagepullsecretApiImagePullSecretRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImagepullsecretApiInterface
     */
    imagePullSecret(requestParameters: ImagepullsecretApiImagePullSecretRequest, options?: RawAxiosRequestConfig): AxiosPromise<ImageRegistry>;

}

/**
 * Request parameters for imagePullSecret operation in ImagepullsecretApi.
 * @export
 * @interface ImagepullsecretApiImagePullSecretRequest
 */
export interface ImagepullsecretApiImagePullSecretRequest {
    /**
     * name of the Environment
     * @type {string}
     * @memberof ImagepullsecretApiImagePullSecret
     */
    readonly environmentName: string

    /**
     * 
     * @type {object}
     * @memberof ImagepullsecretApiImagePullSecret
     */
    readonly body?: object
}

/**
 * ImagepullsecretApi - object-oriented interface
 * @export
 * @class ImagepullsecretApi
 * @extends {BaseAPI}
 */
export class ImagepullsecretApi extends BaseAPI implements ImagepullsecretApiInterface {
    /**
     * Create image pull secret for environment bootstrap. The environment\'s imageRegistry value must be a registry URL matching image_registries.url (not image_registries.name).
     * @summary Create image pull secret for environment
     * @param {ImagepullsecretApiImagePullSecretRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof ImagepullsecretApi
     */
    public imagePullSecret(requestParameters: ImagepullsecretApiImagePullSecretRequest, options?: RawAxiosRequestConfig) {
        return ImagepullsecretApiFp(this.configuration).imagePullSecret(requestParameters.environmentName, requestParameters.body, options).then((request) => request(this.axios, this.basePath));
    }
}

