/* 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 { OutageRecord } from '../models'; /** * SLAApi - axios parameter creator * @export */ export const SLAApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Check SLA config in a environment * @summary Check SLA config in env * @param {string} environmentName name of the environment * @param {*} [options] Override http request option. * @throws {RequiredError} */ checkSLAConfigInEnv: async (environmentName: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'environmentName' is not null or undefined assertParamExists('checkSLAConfigInEnv', 'environmentName', environmentName) const localVarPath = `/internal/v1/environments/{environmentName}/sla` .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: '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, }; }, /** * Batch create or update cluster outage record * @summary Batch create or update cluster outage record * @param {string} environmentName name of the environment * @param {Array} outageRecord * @param {*} [options] Override http request option. * @throws {RequiredError} */ createOrUpdateClusterOutages: async (environmentName: string, outageRecord: Array, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'environmentName' is not null or undefined assertParamExists('createOrUpdateClusterOutages', 'environmentName', environmentName) // verify required parameter 'outageRecord' is not null or undefined assertParamExists('createOrUpdateClusterOutages', 'outageRecord', outageRecord) const localVarPath = `/internal/v1/environments/{environmentName}/outages` .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(outageRecord, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * List outage record for environments * @summary List outage record for environments * @param {string} [environmentName] name of the environment, if not specified, return all environments * @param {string} [orgName] name of the organization * @param {string} [clusterID] id of the cluster * @param {boolean} [activeOnly] whether to return only active outage records * @param {*} [options] Override http request option. * @throws {RequiredError} */ listEnvironmentOutageRecord: async (environmentName?: string, orgName?: string, clusterID?: string, activeOnly?: boolean, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/internal/v1/sla/outages`; // 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 (environmentName !== undefined) { localVarQueryParameter['environmentName'] = environmentName; } if (orgName !== undefined) { localVarQueryParameter['orgName'] = orgName; } if (clusterID !== undefined) { localVarQueryParameter['clusterID'] = clusterID; } if (activeOnly !== undefined) { localVarQueryParameter['activeOnly'] = activeOnly; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * SLAApi - functional programming interface * @export */ export const SLAApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = SLAApiAxiosParamCreator(configuration) return { /** * Check SLA config in a environment * @summary Check SLA config in env * @param {string} environmentName name of the environment * @param {*} [options] Override http request option. * @throws {RequiredError} */ async checkSLAConfigInEnv(environmentName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.checkSLAConfigInEnv(environmentName, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['SLAApi.checkSLAConfigInEnv']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * Batch create or update cluster outage record * @summary Batch create or update cluster outage record * @param {string} environmentName name of the environment * @param {Array} outageRecord * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createOrUpdateClusterOutages(environmentName: string, outageRecord: Array, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.createOrUpdateClusterOutages(environmentName, outageRecord, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['SLAApi.createOrUpdateClusterOutages']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, /** * List outage record for environments * @summary List outage record for environments * @param {string} [environmentName] name of the environment, if not specified, return all environments * @param {string} [orgName] name of the organization * @param {string} [clusterID] id of the cluster * @param {boolean} [activeOnly] whether to return only active outage records * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listEnvironmentOutageRecord(environmentName?: string, orgName?: string, clusterID?: string, activeOnly?: boolean, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { const localVarAxiosArgs = await localVarAxiosParamCreator.listEnvironmentOutageRecord(environmentName, orgName, clusterID, activeOnly, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['SLAApi.listEnvironmentOutageRecord']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * SLAApi - factory interface * @export */ export const SLAApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = SLAApiFp(configuration) return { /** * Check SLA config in a environment * @summary Check SLA config in env * @param {SLAApiCheckSLAConfigInEnvRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ checkSLAConfigInEnv(requestParameters: SLAApiCheckSLAConfigInEnvRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.checkSLAConfigInEnv(requestParameters.environmentName, options).then((request) => request(axios, basePath)); }, /** * Batch create or update cluster outage record * @summary Batch create or update cluster outage record * @param {SLAApiCreateOrUpdateClusterOutagesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createOrUpdateClusterOutages(requestParameters: SLAApiCreateOrUpdateClusterOutagesRequest, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.createOrUpdateClusterOutages(requestParameters.environmentName, requestParameters.outageRecord, options).then((request) => request(axios, basePath)); }, /** * List outage record for environments * @summary List outage record for environments * @param {SLAApiListEnvironmentOutageRecordRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listEnvironmentOutageRecord(requestParameters: SLAApiListEnvironmentOutageRecordRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise> { return localVarFp.listEnvironmentOutageRecord(requestParameters.environmentName, requestParameters.orgName, requestParameters.clusterID, requestParameters.activeOnly, options).then((request) => request(axios, basePath)); }, }; }; /** * SLAApi - interface * @export * @interface SLAApi */ export interface SLAApiInterface { /** * Check SLA config in a environment * @summary Check SLA config in env * @param {SLAApiCheckSLAConfigInEnvRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SLAApiInterface */ checkSLAConfigInEnv(requestParameters: SLAApiCheckSLAConfigInEnvRequest, options?: RawAxiosRequestConfig): AxiosPromise; /** * Batch create or update cluster outage record * @summary Batch create or update cluster outage record * @param {SLAApiCreateOrUpdateClusterOutagesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SLAApiInterface */ createOrUpdateClusterOutages(requestParameters: SLAApiCreateOrUpdateClusterOutagesRequest, options?: RawAxiosRequestConfig): AxiosPromise>; /** * List outage record for environments * @summary List outage record for environments * @param {SLAApiListEnvironmentOutageRecordRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SLAApiInterface */ listEnvironmentOutageRecord(requestParameters?: SLAApiListEnvironmentOutageRecordRequest, options?: RawAxiosRequestConfig): AxiosPromise>; } /** * Request parameters for checkSLAConfigInEnv operation in SLAApi. * @export * @interface SLAApiCheckSLAConfigInEnvRequest */ export interface SLAApiCheckSLAConfigInEnvRequest { /** * name of the environment * @type {string} * @memberof SLAApiCheckSLAConfigInEnv */ readonly environmentName: string } /** * Request parameters for createOrUpdateClusterOutages operation in SLAApi. * @export * @interface SLAApiCreateOrUpdateClusterOutagesRequest */ export interface SLAApiCreateOrUpdateClusterOutagesRequest { /** * name of the environment * @type {string} * @memberof SLAApiCreateOrUpdateClusterOutages */ readonly environmentName: string /** * * @type {Array} * @memberof SLAApiCreateOrUpdateClusterOutages */ readonly outageRecord: Array } /** * Request parameters for listEnvironmentOutageRecord operation in SLAApi. * @export * @interface SLAApiListEnvironmentOutageRecordRequest */ export interface SLAApiListEnvironmentOutageRecordRequest { /** * name of the environment, if not specified, return all environments * @type {string} * @memberof SLAApiListEnvironmentOutageRecord */ readonly environmentName?: string /** * name of the organization * @type {string} * @memberof SLAApiListEnvironmentOutageRecord */ readonly orgName?: string /** * id of the cluster * @type {string} * @memberof SLAApiListEnvironmentOutageRecord */ readonly clusterID?: string /** * whether to return only active outage records * @type {boolean} * @memberof SLAApiListEnvironmentOutageRecord */ readonly activeOnly?: boolean } /** * SLAApi - object-oriented interface * @export * @class SLAApi * @extends {BaseAPI} */ export class SLAApi extends BaseAPI implements SLAApiInterface { /** * Check SLA config in a environment * @summary Check SLA config in env * @param {SLAApiCheckSLAConfigInEnvRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SLAApi */ public checkSLAConfigInEnv(requestParameters: SLAApiCheckSLAConfigInEnvRequest, options?: RawAxiosRequestConfig) { return SLAApiFp(this.configuration).checkSLAConfigInEnv(requestParameters.environmentName, options).then((request) => request(this.axios, this.basePath)); } /** * Batch create or update cluster outage record * @summary Batch create or update cluster outage record * @param {SLAApiCreateOrUpdateClusterOutagesRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SLAApi */ public createOrUpdateClusterOutages(requestParameters: SLAApiCreateOrUpdateClusterOutagesRequest, options?: RawAxiosRequestConfig) { return SLAApiFp(this.configuration).createOrUpdateClusterOutages(requestParameters.environmentName, requestParameters.outageRecord, options).then((request) => request(this.axios, this.basePath)); } /** * List outage record for environments * @summary List outage record for environments * @param {SLAApiListEnvironmentOutageRecordRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SLAApi */ public listEnvironmentOutageRecord(requestParameters: SLAApiListEnvironmentOutageRecordRequest = {}, options?: RawAxiosRequestConfig) { return SLAApiFp(this.configuration).listEnvironmentOutageRecord(requestParameters.environmentName, requestParameters.orgName, requestParameters.clusterID, requestParameters.activeOnly, options).then((request) => request(this.axios, this.basePath)); } }