/* 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 { PostableAlert } from '../models'; /** * AlertApi - axios parameter creator * @export */ export const AlertApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary Proxy alert webhook * @param {string} strategyId id of the alert strategyId * @param {string} orgName name of the org * @param {PostableAlert} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ alertWebhookProxy: async (strategyId: string, orgName: string, body: PostableAlert, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'strategyId' is not null or undefined assertParamExists('alertWebhookProxy', 'strategyId', strategyId) // verify required parameter 'orgName' is not null or undefined assertParamExists('alertWebhookProxy', 'orgName', orgName) // verify required parameter 'body' is not null or undefined assertParamExists('alertWebhookProxy', 'body', body) const localVarPath = `/internal/v1/alertWebhook/{orgName}/{strategyId}` .replace(`{${"strategyId"}}`, encodeURIComponent(String(strategyId))) .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName))); // 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, }; }, /** * Get alert config * @summary Get internal alert config * @param {*} [options] Override http request option. * @throws {RequiredError} */ getInternalAlertConfig: async (options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/internal/v1/alerts/rules/config`; // 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, }; }, /** * Record alert webhook * @summary Record alert webhook * @param {PostableAlert} postableAlert * @param {*} [options] Override http request option. * @throws {RequiredError} */ recordAlertWebhook: async (postableAlert: PostableAlert, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'postableAlert' is not null or undefined assertParamExists('recordAlertWebhook', 'postableAlert', postableAlert) const localVarPath = `/internal/v1/alertWebhook/record`; // 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(postableAlert, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * AlertApi - functional programming interface * @export */ export const AlertApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = AlertApiAxiosParamCreator(configuration) return { /** * * @summary Proxy alert webhook * @param {string} strategyId id of the alert strategyId * @param {string} orgName name of the org * @param {PostableAlert} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ async alertWebhookProxy(strategyId: string, orgName: string, body: PostableAlert, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.alertWebhookProxy(strategyId, orgName, body, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['AlertApi.alertWebhookProxy']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Get alert config * @summary Get internal alert config * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getInternalAlertConfig(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getInternalAlertConfig(options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['AlertApi.getInternalAlertConfig']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Record alert webhook * @summary Record alert webhook * @param {PostableAlert} postableAlert * @param {*} [options] Override http request option. * @throws {RequiredError} */ async recordAlertWebhook(postableAlert: PostableAlert, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.recordAlertWebhook(postableAlert, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['AlertApi.recordAlertWebhook']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * AlertApi - factory interface * @export */ export const AlertApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = AlertApiFp(configuration) return { /** * * @summary Proxy alert webhook * @param {AlertApiAlertWebhookProxyRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ alertWebhookProxy(requestParameters: AlertApiAlertWebhookProxyRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.alertWebhookProxy(requestParameters.strategyId, requestParameters.orgName, requestParameters.body, options).then((request) => request(axios, basePath)); }, /** * Get alert config * @summary Get internal alert config * @param {*} [options] Override http request option. * @throws {RequiredError} */ getInternalAlertConfig(options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getInternalAlertConfig(options).then((request) => request(axios, basePath)); }, /** * Record alert webhook * @summary Record alert webhook * @param {AlertApiRecordAlertWebhookRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ recordAlertWebhook(requestParameters: AlertApiRecordAlertWebhookRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.recordAlertWebhook(requestParameters.postableAlert, options).then((request) => request(axios, basePath)); }, }; }; /** * AlertApi - interface * @export * @interface AlertApi */ export interface AlertApiInterface { /** * * @summary Proxy alert webhook * @param {AlertApiAlertWebhookProxyRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlertApiInterface */ alertWebhookProxy(requestParameters: AlertApiAlertWebhookProxyRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * Get alert config * @summary Get internal alert config * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlertApiInterface */ getInternalAlertConfig(options?: RawAxiosRequestConfig): AxiosPromise; /** * Record alert webhook * @summary Record alert webhook * @param {AlertApiRecordAlertWebhookRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlertApiInterface */ recordAlertWebhook(requestParameters: AlertApiRecordAlertWebhookRequest, options?: RawAxiosRequestConfig): AxiosPromise; } /** * Request parameters for alertWebhookProxy operation in AlertApi. * @export * @interface AlertApiAlertWebhookProxyRequest */ export interface AlertApiAlertWebhookProxyRequest { /** * id of the alert strategyId * @type {string} * @memberof AlertApiAlertWebhookProxy */ readonly strategyId: string /** * name of the org * @type {string} * @memberof AlertApiAlertWebhookProxy */ readonly orgName: string /** * * @type {PostableAlert} * @memberof AlertApiAlertWebhookProxy */ readonly body: PostableAlert } /** * Request parameters for recordAlertWebhook operation in AlertApi. * @export * @interface AlertApiRecordAlertWebhookRequest */ export interface AlertApiRecordAlertWebhookRequest { /** * * @type {PostableAlert} * @memberof AlertApiRecordAlertWebhook */ readonly postableAlert: PostableAlert } /** * AlertApi - object-oriented interface * @export * @class AlertApi * @extends {BaseAPI} */ export class AlertApi extends BaseAPI implements AlertApiInterface { /** * * @summary Proxy alert webhook * @param {AlertApiAlertWebhookProxyRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlertApi */ public alertWebhookProxy(requestParameters: AlertApiAlertWebhookProxyRequest, options?: RawAxiosRequestConfig) { return AlertApiFp(this.configuration).alertWebhookProxy(requestParameters.strategyId, requestParameters.orgName, requestParameters.body, options).then((request) => request(this.axios, this.basePath)); } /** * Get alert config * @summary Get internal alert config * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlertApi */ public getInternalAlertConfig(options?: RawAxiosRequestConfig) { return AlertApiFp(this.configuration).getInternalAlertConfig(options).then((request) => request(this.axios, this.basePath)); } /** * Record alert webhook * @summary Record alert webhook * @param {AlertApiRecordAlertWebhookRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AlertApi */ public recordAlertWebhook(requestParameters: AlertApiRecordAlertWebhookRequest, options?: RawAxiosRequestConfig) { return AlertApiFp(this.configuration).recordAlertWebhook(requestParameters.postableAlert, options).then((request) => request(this.axios, this.basePath)); } }