/* 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 { ClusterBackupMethod } from '../models'; /** * BackupMethodApi - axios parameter creator * @export */ export const BackupMethodApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * * @summary get backup method * @param {string} orgName name of the org * @param {string} engineName engine name * @param {string} [clusterID] clusterID is required when you want to get the backup method of a existing cluster * @param {boolean} [enablePITR] define whether to enable PITR (Point-In-Time Recovery). This setting is required when clusterId is not empty. * @param {boolean} [withRebuildInstance] defined whether to search for rebuilding instance. * @param {boolean} [withRestoreCluster] defined whether to search for restoring cluster. * @param {boolean} [withHScale] defined whether to search for rebuilding instance. * @param {string} [component] The component type is required when withRebuildInstance/withHScale is true. * @param {string} [mode] The cluster mode, used to filter out unsupported backup methods. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBackupMethod: async (orgName: string, engineName: string, clusterID?: string, enablePITR?: boolean, withRebuildInstance?: boolean, withRestoreCluster?: boolean, withHScale?: boolean, component?: string, mode?: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'orgName' is not null or undefined assertParamExists('getBackupMethod', 'orgName', orgName) // verify required parameter 'engineName' is not null or undefined assertParamExists('getBackupMethod', 'engineName', engineName) const localVarPath = `/admin/v1/organizations/{orgName}/{engineName}/clusterBackupMethod` .replace(`{${"orgName"}}`, encodeURIComponent(String(orgName))) .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: 'GET', ...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) if (clusterID !== undefined) { localVarQueryParameter['clusterID'] = clusterID; } if (enablePITR !== undefined) { localVarQueryParameter['enablePITR'] = enablePITR; } if (withRebuildInstance !== undefined) { localVarQueryParameter['withRebuildInstance'] = withRebuildInstance; } if (withRestoreCluster !== undefined) { localVarQueryParameter['withRestoreCluster'] = withRestoreCluster; } if (withHScale !== undefined) { localVarQueryParameter['withHScale'] = withHScale; } if (component !== undefined) { localVarQueryParameter['component'] = component; } 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, }; }, } }; /** * BackupMethodApi - functional programming interface * @export */ export const BackupMethodApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = BackupMethodApiAxiosParamCreator(configuration) return { /** * * @summary get backup method * @param {string} orgName name of the org * @param {string} engineName engine name * @param {string} [clusterID] clusterID is required when you want to get the backup method of a existing cluster * @param {boolean} [enablePITR] define whether to enable PITR (Point-In-Time Recovery). This setting is required when clusterId is not empty. * @param {boolean} [withRebuildInstance] defined whether to search for rebuilding instance. * @param {boolean} [withRestoreCluster] defined whether to search for restoring cluster. * @param {boolean} [withHScale] defined whether to search for rebuilding instance. * @param {string} [component] The component type is required when withRebuildInstance/withHScale is true. * @param {string} [mode] The cluster mode, used to filter out unsupported backup methods. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBackupMethod(orgName: string, engineName: string, clusterID?: string, enablePITR?: boolean, withRebuildInstance?: boolean, withRestoreCluster?: boolean, withHScale?: boolean, component?: string, mode?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getBackupMethod(orgName, engineName, clusterID, enablePITR, withRebuildInstance, withRestoreCluster, withHScale, component, mode, options); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['BackupMethodApi.getBackupMethod']?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }, } }; /** * BackupMethodApi - factory interface * @export */ export const BackupMethodApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = BackupMethodApiFp(configuration) return { /** * * @summary get backup method * @param {BackupMethodApiGetBackupMethodRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBackupMethod(requestParameters: BackupMethodApiGetBackupMethodRequest, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getBackupMethod(requestParameters.orgName, requestParameters.engineName, requestParameters.clusterID, requestParameters.enablePITR, requestParameters.withRebuildInstance, requestParameters.withRestoreCluster, requestParameters.withHScale, requestParameters.component, requestParameters.mode, options).then((request) => request(axios, basePath)); }, }; }; /** * BackupMethodApi - interface * @export * @interface BackupMethodApi */ export interface BackupMethodApiInterface { /** * * @summary get backup method * @param {BackupMethodApiGetBackupMethodRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BackupMethodApiInterface */ getBackupMethod(requestParameters: BackupMethodApiGetBackupMethodRequest, options?: RawAxiosRequestConfig): AxiosPromise; } /** * Request parameters for getBackupMethod operation in BackupMethodApi. * @export * @interface BackupMethodApiGetBackupMethodRequest */ export interface BackupMethodApiGetBackupMethodRequest { /** * name of the org * @type {string} * @memberof BackupMethodApiGetBackupMethod */ readonly orgName: string /** * engine name * @type {string} * @memberof BackupMethodApiGetBackupMethod */ readonly engineName: string /** * clusterID is required when you want to get the backup method of a existing cluster * @type {string} * @memberof BackupMethodApiGetBackupMethod */ readonly clusterID?: string /** * define whether to enable PITR (Point-In-Time Recovery). This setting is required when clusterId is not empty. * @type {boolean} * @memberof BackupMethodApiGetBackupMethod */ readonly enablePITR?: boolean /** * defined whether to search for rebuilding instance. * @type {boolean} * @memberof BackupMethodApiGetBackupMethod */ readonly withRebuildInstance?: boolean /** * defined whether to search for restoring cluster. * @type {boolean} * @memberof BackupMethodApiGetBackupMethod */ readonly withRestoreCluster?: boolean /** * defined whether to search for rebuilding instance. * @type {boolean} * @memberof BackupMethodApiGetBackupMethod */ readonly withHScale?: boolean /** * The component type is required when withRebuildInstance/withHScale is true. * @type {string} * @memberof BackupMethodApiGetBackupMethod */ readonly component?: string /** * The cluster mode, used to filter out unsupported backup methods. * @type {string} * @memberof BackupMethodApiGetBackupMethod */ readonly mode?: string } /** * BackupMethodApi - object-oriented interface * @export * @class BackupMethodApi * @extends {BaseAPI} */ export class BackupMethodApi extends BaseAPI implements BackupMethodApiInterface { /** * * @summary get backup method * @param {BackupMethodApiGetBackupMethodRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof BackupMethodApi */ public getBackupMethod(requestParameters: BackupMethodApiGetBackupMethodRequest, options?: RawAxiosRequestConfig) { return BackupMethodApiFp(this.configuration).getBackupMethod(requestParameters.orgName, requestParameters.engineName, requestParameters.clusterID, requestParameters.enablePITR, requestParameters.withRebuildInstance, requestParameters.withRestoreCluster, requestParameters.withHScale, requestParameters.component, requestParameters.mode, options).then((request) => request(this.axios, this.basePath)); } }