/* 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 { InternalTask } from '../models'; // @ts-ignore import type { InternalTaskList } from '../models'; // @ts-ignore import type { TaskRetryMode } from '../models'; /** * TaskApi - axios parameter creator * @export */ export const TaskApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Get task status independently of the resource lifecycle * @param {string} taskId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getInternalTask: async (taskId: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'taskId' is not null or undefined assertParamExists('getInternalTask', 'taskId', taskId) const localVarPath = `/internal/v1/tasks/{taskId}` .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); // 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 BasicAuth required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary List tasks, newest first, optionally filtered by resource and task type * @param {string} [resourceType] * @param {string} [resourceId] * @param {string} [taskType] Comma-separated task types. * @param {number} [pageSize] * @param {number} [pageNumber] * @param {*} [options] Override http request option. * @throws {RequiredError} */ listInternalTasks: async (resourceType?: string, resourceId?: string, taskType?: string, pageSize?: number, pageNumber?: number, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/internal/v1/tasks`; // 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 BasicAuth required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) if (resourceType !== undefined) { localVarQueryParameter['resourceType'] = resourceType; } if (resourceId !== undefined) { localVarQueryParameter['resourceId'] = resourceId; } if (taskType !== undefined) { localVarQueryParameter['taskType'] = taskType; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (pageNumber !== undefined) { localVarQueryParameter['pageNumber'] = pageNumber; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Retry a failed or stopped task using the existing task retry policy * @param {string} taskId * @param {TaskRetryMode} [mode] * @param {*} [options] Override http request option. * @throws {RequiredError} */ retryInternalTask: async (taskId: string, mode?: TaskRetryMode, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'taskId' is not null or undefined assertParamExists('retryInternalTask', 'taskId', taskId) const localVarPath = `/internal/v1/tasks/{taskId}/retry` .replace(`{${"taskId"}}`, encodeURIComponent(String(taskId))); // 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 BasicAuth required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration) if (mode !== undefined) { localVarQueryParameter['mode'] = mode; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * TaskApi - functional programming interface * @export */ export const TaskApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = TaskApiAxiosParamCreator(configuration) return { /** * * @summary Get task status independently of the resource lifecycle * @param {string} taskId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getInternalTask(taskId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getInternalTask(taskId, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['TaskApi.getInternalTask']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary List tasks, newest first, optionally filtered by resource and task type * @param {string} [resourceType] * @param {string} [resourceId] * @param {string} [taskType] Comma-separated task types. * @param {number} [pageSize] * @param {number} [pageNumber] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listInternalTasks(resourceType?: string, resourceId?: string, taskType?: string, pageSize?: number, pageNumber?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listInternalTasks(resourceType, resourceId, taskType, pageSize, pageNumber, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['TaskApi.listInternalTasks']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Retry a failed or stopped task using the existing task retry policy * @param {string} taskId * @param {TaskRetryMode} [mode] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async retryInternalTask(taskId: string, mode?: TaskRetryMode, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.retryInternalTask(taskId, mode, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['TaskApi.retryInternalTask']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * TaskApi - factory interface * @export */ export const TaskApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = TaskApiFp(configuration) return { /** * * @summary Get task status independently of the resource lifecycle * @param {TaskApiGetInternalTaskRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getInternalTask(requestParameters: TaskApiGetInternalTaskRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getInternalTask(requestParameters.taskId, options).then((request) => request(axios, basePath)); }, /** * * @summary List tasks, newest first, optionally filtered by resource and task type * @param {TaskApiListInternalTasksRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listInternalTasks(requestParameters: TaskApiListInternalTasksRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.listInternalTasks(requestParameters.resourceType, requestParameters.resourceId, requestParameters.taskType, requestParameters.pageSize, requestParameters.pageNumber, options).then((request) => request(axios, basePath)); }, /** * * @summary Retry a failed or stopped task using the existing task retry policy * @param {TaskApiRetryInternalTaskRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ retryInternalTask(requestParameters: TaskApiRetryInternalTaskRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.retryInternalTask(requestParameters.taskId, requestParameters.mode, options).then((request) => request(axios, basePath)); }, }; }; /** * TaskApi - interface * @export * @interface TaskApi */ export interface TaskApiInterface { /** * * @summary Get task status independently of the resource lifecycle * @param {TaskApiGetInternalTaskRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TaskApiInterface */ getInternalTask(requestParameters: TaskApiGetInternalTaskRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * * @summary List tasks, newest first, optionally filtered by resource and task type * @param {TaskApiListInternalTasksRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TaskApiInterface */ listInternalTasks(requestParameters?: TaskApiListInternalTasksRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * * @summary Retry a failed or stopped task using the existing task retry policy * @param {TaskApiRetryInternalTaskRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TaskApiInterface */ retryInternalTask(requestParameters: TaskApiRetryInternalTaskRequest, options?: RawAxiosRequestConfig): AxiosPromise; } /** * Request parameters for getInternalTask operation in TaskApi. * @export * @interface TaskApiGetInternalTaskRequest */ export interface TaskApiGetInternalTaskRequest { /** * * @type {string} * @memberof TaskApiGetInternalTask */ readonly taskId: string } /** * Request parameters for listInternalTasks operation in TaskApi. * @export * @interface TaskApiListInternalTasksRequest */ export interface TaskApiListInternalTasksRequest { /** * * @type {string} * @memberof TaskApiListInternalTasks */ readonly resourceType?: string /** * * @type {string} * @memberof TaskApiListInternalTasks */ readonly resourceId?: string /** * Comma-separated task types. * @type {string} * @memberof TaskApiListInternalTasks */ readonly taskType?: string /** * * @type {number} * @memberof TaskApiListInternalTasks */ readonly pageSize?: number /** * * @type {number} * @memberof TaskApiListInternalTasks */ readonly pageNumber?: number } /** * Request parameters for retryInternalTask operation in TaskApi. * @export * @interface TaskApiRetryInternalTaskRequest */ export interface TaskApiRetryInternalTaskRequest { /** * * @type {string} * @memberof TaskApiRetryInternalTask */ readonly taskId: string /** * * @type {TaskRetryMode} * @memberof TaskApiRetryInternalTask */ readonly mode?: TaskRetryMode } /** * TaskApi - object-oriented interface * @export * @class TaskApi * @extends {BaseAPI} */ export class TaskApi extends BaseAPI implements TaskApiInterface { /** * * @summary Get task status independently of the resource lifecycle * @param {TaskApiGetInternalTaskRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TaskApi */ public getInternalTask(requestParameters: TaskApiGetInternalTaskRequest, options?: RawAxiosRequestConfig) { return TaskApiFp(this.configuration).getInternalTask(requestParameters.taskId, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary List tasks, newest first, optionally filtered by resource and task type * @param {TaskApiListInternalTasksRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TaskApi */ public listInternalTasks(requestParameters: TaskApiListInternalTasksRequest = {}, options?: RawAxiosRequestConfig) { return TaskApiFp(this.configuration).listInternalTasks(requestParameters.resourceType, requestParameters.resourceId, requestParameters.taskType, requestParameters.pageSize, requestParameters.pageNumber, options).then((request) => request(this.axios, this.basePath)); } /** * * @summary Retry a failed or stopped task using the existing task retry policy * @param {TaskApiRetryInternalTaskRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TaskApi */ public retryInternalTask(requestParameters: TaskApiRetryInternalTaskRequest, options?: RawAxiosRequestConfig) { return TaskApiFp(this.configuration).retryInternalTask(requestParameters.taskId, requestParameters.mode, options).then((request) => request(this.axios, this.basePath)); } }