/* tslint:disable */ /* eslint-disable */ /** * Sonatype Lifecycle Public REST API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.207.0-01 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { ApiSearchIndexAnalyzeDTO, ApiSearchIndexJobRequestDTO, SearchIndexJob, SearchIndexJobEvent, } from '../models/index'; import { ApiSearchIndexAnalyzeDTOFromJSON, ApiSearchIndexAnalyzeDTOToJSON, ApiSearchIndexJobRequestDTOFromJSON, ApiSearchIndexJobRequestDTOToJSON, SearchIndexJobFromJSON, SearchIndexJobToJSON, SearchIndexJobEventFromJSON, SearchIndexJobEventToJSON, } from '../models/index'; export interface AdvancedSearchIndexHealthApiGetJobRequest { jobId: string; } export interface AdvancedSearchIndexHealthApiGetJobEventsRequest { jobId: string; limit?: number; } export interface AdvancedSearchIndexHealthApiStartJobRequest { apiSearchIndexJobRequestDTO?: ApiSearchIndexJobRequestDTO; } /** * AdvancedSearchIndexHealthApi - interface * * @export * @interface AdvancedSearchIndexHealthApiInterface */ export interface AdvancedSearchIndexHealthApiInterface { /** * Return current index health (green/yellow/red), recommendation, and estate snapshot. Works on precomputed CURRENT rows in a constant number of round trips, refreshing the stored derived status as it goes. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchIndexHealthApiInterface */ analyzeRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Return current index health (green/yellow/red), recommendation, and estate snapshot. Works on precomputed CURRENT rows in a constant number of round trips, refreshing the stored derived status as it goes. */ analyze(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Cancel the active job; Lucene keeps serving the blue index. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchIndexHealthApiInterface */ cancelActiveJobRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Cancel the active job; Lucene keeps serving the blue index. */ cancelActiveJob(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Return the active index job, if any. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchIndexHealthApiInterface */ getActiveJobRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Return the active index job, if any. */ getActiveJob(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Return a job by id. * @param {string} jobId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchIndexHealthApiInterface */ getJobRaw(requestParameters: AdvancedSearchIndexHealthApiGetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Return a job by id. */ getJob(requestParameters: AdvancedSearchIndexHealthApiGetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Return structured job events (activity log). * @param {string} jobId * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchIndexHealthApiInterface */ getJobEventsRaw(requestParameters: AdvancedSearchIndexHealthApiGetJobEventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Return structured job events (activity log). */ getJobEvents(requestParameters: AdvancedSearchIndexHealthApiGetJobEventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Start an index job (FULL_REBUILD or FIRST_TIME_INDEX). * @param {ApiSearchIndexJobRequestDTO} [apiSearchIndexJobRequestDTO] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchIndexHealthApiInterface */ startJobRaw(requestParameters: AdvancedSearchIndexHealthApiStartJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Start an index job (FULL_REBUILD or FIRST_TIME_INDEX). */ startJob(requestParameters: AdvancedSearchIndexHealthApiStartJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class AdvancedSearchIndexHealthApi extends runtime.BaseAPI implements AdvancedSearchIndexHealthApiInterface { /** * Return current index health (green/yellow/red), recommendation, and estate snapshot. Works on precomputed CURRENT rows in a constant number of round trips, refreshing the stored derived status as it goes. */ async analyzeRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v2/search/advanced/index/analyze`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiSearchIndexAnalyzeDTOFromJSON(jsonValue)); } /** * Return current index health (green/yellow/red), recommendation, and estate snapshot. Works on precomputed CURRENT rows in a constant number of round trips, refreshing the stored derived status as it goes. */ async analyze(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.analyzeRaw(initOverrides); return await response.value(); } /** * Cancel the active job; Lucene keeps serving the blue index. */ async cancelActiveJobRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v2/search/advanced/index/jobs/cancel`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SearchIndexJobFromJSON(jsonValue)); } /** * Cancel the active job; Lucene keeps serving the blue index. */ async cancelActiveJob(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.cancelActiveJobRaw(initOverrides); return await response.value(); } /** * Return the active index job, if any. */ async getActiveJobRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v2/search/advanced/index/jobs/active`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SearchIndexJobFromJSON(jsonValue)); } /** * Return the active index job, if any. */ async getActiveJob(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getActiveJobRaw(initOverrides); return await response.value(); } /** * Return a job by id. */ async getJobRaw(requestParameters: AdvancedSearchIndexHealthApiGetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['jobId'] == null) { throw new runtime.RequiredError( 'jobId', 'Required parameter "jobId" was null or undefined when calling getJob().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v2/search/advanced/index/jobs/{jobId}`; urlPath = urlPath.replace(`{${"jobId"}}`, encodeURIComponent(String(requestParameters['jobId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SearchIndexJobFromJSON(jsonValue)); } /** * Return a job by id. */ async getJob(requestParameters: AdvancedSearchIndexHealthApiGetJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getJobRaw(requestParameters, initOverrides); return await response.value(); } /** * Return structured job events (activity log). */ async getJobEventsRaw(requestParameters: AdvancedSearchIndexHealthApiGetJobEventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters['jobId'] == null) { throw new runtime.RequiredError( 'jobId', 'Required parameter "jobId" was null or undefined when calling getJobEvents().' ); } const queryParameters: any = {}; if (requestParameters['limit'] != null) { queryParameters['limit'] = requestParameters['limit']; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v2/search/advanced/index/jobs/{jobId}/events`; urlPath = urlPath.replace(`{${"jobId"}}`, encodeURIComponent(String(requestParameters['jobId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(SearchIndexJobEventFromJSON)); } /** * Return structured job events (activity log). */ async getJobEvents(requestParameters: AdvancedSearchIndexHealthApiGetJobEventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getJobEventsRaw(requestParameters, initOverrides); return await response.value(); } /** * Start an index job (FULL_REBUILD or FIRST_TIME_INDEX). */ async startJobRaw(requestParameters: AdvancedSearchIndexHealthApiStartJobRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v2/search/advanced/index/jobs`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiSearchIndexJobRequestDTOToJSON(requestParameters['apiSearchIndexJobRequestDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SearchIndexJobFromJSON(jsonValue)); } /** * Start an index job (FULL_REBUILD or FIRST_TIME_INDEX). */ async startJob(requestParameters: AdvancedSearchIndexHealthApiStartJobRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.startJobRaw(requestParameters, initOverrides); return await response.value(); } }