/* 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 { ApiApplicationReportDTOV2, ApiComponentWaiversDTO, ApiComponentsInQuarantineDTO, ApiMetricsReportingDTOV2, ApiMetricsReportingQueryDTOV2, ApiReportHistoryDTO, ApiStaleWaiversResponseDTO, } from '../models/index'; import { ApiApplicationReportDTOV2FromJSON, ApiApplicationReportDTOV2ToJSON, ApiComponentWaiversDTOFromJSON, ApiComponentWaiversDTOToJSON, ApiComponentsInQuarantineDTOFromJSON, ApiComponentsInQuarantineDTOToJSON, ApiMetricsReportingDTOV2FromJSON, ApiMetricsReportingDTOV2ToJSON, ApiMetricsReportingQueryDTOV2FromJSON, ApiMetricsReportingQueryDTOV2ToJSON, ApiReportHistoryDTOFromJSON, ApiReportHistoryDTOToJSON, ApiStaleWaiversResponseDTOFromJSON, ApiStaleWaiversResponseDTOToJSON, } from '../models/index'; export interface ReportsApiGetByApplicationIdRequest { applicationId: string; } export interface ReportsApiGetComponentsWithWaiversRequest { format?: string; } export interface ReportsApiGetMetricsRequest { apiMetricsReportingQueryDTOV2?: ApiMetricsReportingQueryDTOV2; } export interface ReportsApiGetReportHistoryForApplicationRequest { applicationId: string; stage?: string; limit?: number; } /** * ReportsApi - interface * * @export * @interface ReportsApiInterface */ export interface ReportsApiInterface { /** * Use this method to view all application reports for applications to which you have access. Permissions required: View IQ Elements * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApiInterface */ getAll1Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Use this method to view all application reports for applications to which you have access. Permissions required: View IQ Elements */ getAll1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the application reports for the specified application Id. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements * @param {string} applicationId Enter the internal application Id. You can use the Applications REST API to get the internal application Id. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApiInterface */ getByApplicationIdRaw(requestParameters: ReportsApiGetByApplicationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Use this method to retrieve the application reports for the specified application Id. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements */ getByApplicationId(requestParameters: ReportsApiGetByApplicationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve all repository components that are quarantined. The response contains violation details and the quarantine Id of the component. Use the quarantine Id, to release the component from quarantine, using the Release from Quarantine REST API. Permissions required: View IQ Elements and access to the specific repository. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApiInterface */ getComponentsInQuarantineRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve all repository components that are quarantined. The response contains violation details and the quarantine Id of the component. Use the quarantine Id, to release the component from quarantine, using the Release from Quarantine REST API. Permissions required: View IQ Elements and access to the specific repository. */ getComponentsInQuarantine(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve existing policy waivers by components. For an up-to-date response, ensure that all application and repository reports are current and contain the most recent re-evaluation data.

You can specify the format/ecosystem of the component for a filtered result.

Permissions required: View IQ Elements and access to the specific applications and repositories * @param {string} [format] Enter the format/ecosystem of the component * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApiInterface */ getComponentsWithWaiversRaw(requestParameters: ReportsApiGetComponentsWithWaiversRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve existing policy waivers by components. For an up-to-date response, ensure that all application and repository reports are current and contain the most recent re-evaluation data.

You can specify the format/ecosystem of the component for a filtered result.

Permissions required: View IQ Elements and access to the specific applications and repositories */ getComponentsWithWaivers(requestParameters: ReportsApiGetComponentsWithWaiversRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve metrics data such as policy evaluation metrics, violation and remediation metrics aggregated monthly or weekly. Permissions required: View IQ Elements * @param {ApiMetricsReportingQueryDTOV2} [apiMetricsReportingQueryDTOV2] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApiInterface */ getMetricsRaw(requestParameters: ReportsApiGetMetricsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Use this method to retrieve metrics data such as policy evaluation metrics, violation and remediation metrics aggregated monthly or weekly. Permissions required: View IQ Elements */ getMetrics(requestParameters: ReportsApiGetMetricsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve previous application scan reports (100 max.) for the specified application. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements * @param {string} applicationId Enter the internal application Id. You can use the Applications REST API to get the internal application Id. * @param {string} [stage] Enter the specific stage, for which you want retrieve the scan history, e.g. \'build\' * @param {number} [limit] Enter the exact no. of most recent reports to retrieve (maximum 100; larger values are clamped). * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApiInterface */ getReportHistoryForApplicationRaw(requestParameters: ReportsApiGetReportHistoryForApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve previous application scan reports (100 max.) for the specified application. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements */ getReportHistoryForApplication(requestParameters: ReportsApiGetReportHistoryForApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Stale waivers pose a risk because they could be applied unintentionally. Use this method to retrieve stale waivers to eliminate this risk for future application evaluations. Permissions required: View IQ Elements. You can view stale waivers only for applications/repositories to which you have access. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ReportsApiInterface */ getStaleWaiversRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Stale waivers pose a risk because they could be applied unintentionally. Use this method to retrieve stale waivers to eliminate this risk for future application evaluations. Permissions required: View IQ Elements. You can view stale waivers only for applications/repositories to which you have access. */ getStaleWaivers(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class ReportsApi extends runtime.BaseAPI implements ReportsApiInterface { /** * Use this method to view all application reports for applications to which you have access. Permissions required: View IQ Elements */ async getAll1Raw(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/reports/applications`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ApiApplicationReportDTOV2FromJSON)); } /** * Use this method to view all application reports for applications to which you have access. Permissions required: View IQ Elements */ async getAll1(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getAll1Raw(initOverrides); return await response.value(); } /** * Use this method to retrieve the application reports for the specified application Id. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements */ async getByApplicationIdRaw(requestParameters: ReportsApiGetByApplicationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters['applicationId'] == null) { throw new runtime.RequiredError( 'applicationId', 'Required parameter "applicationId" was null or undefined when calling getByApplicationId().' ); } 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/reports/applications/{applicationId}`; urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ApiApplicationReportDTOV2FromJSON)); } /** * Use this method to retrieve the application reports for the specified application Id. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements */ async getByApplicationId(requestParameters: ReportsApiGetByApplicationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getByApplicationIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve all repository components that are quarantined. The response contains violation details and the quarantine Id of the component. Use the quarantine Id, to release the component from quarantine, using the Release from Quarantine REST API. Permissions required: View IQ Elements and access to the specific repository. */ async getComponentsInQuarantineRaw(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/reports/components/quarantined`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiComponentsInQuarantineDTOFromJSON(jsonValue)); } /** * Use this method to retrieve all repository components that are quarantined. The response contains violation details and the quarantine Id of the component. Use the quarantine Id, to release the component from quarantine, using the Release from Quarantine REST API. Permissions required: View IQ Elements and access to the specific repository. */ async getComponentsInQuarantine(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getComponentsInQuarantineRaw(initOverrides); return await response.value(); } /** * Use this method to retrieve existing policy waivers by components. For an up-to-date response, ensure that all application and repository reports are current and contain the most recent re-evaluation data.

You can specify the format/ecosystem of the component for a filtered result.

Permissions required: View IQ Elements and access to the specific applications and repositories */ async getComponentsWithWaiversRaw(requestParameters: ReportsApiGetComponentsWithWaiversRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters['format'] != null) { queryParameters['format'] = requestParameters['format']; } 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/reports/components/waivers`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiComponentWaiversDTOFromJSON(jsonValue)); } /** * Use this method to retrieve existing policy waivers by components. For an up-to-date response, ensure that all application and repository reports are current and contain the most recent re-evaluation data.

You can specify the format/ecosystem of the component for a filtered result.

Permissions required: View IQ Elements and access to the specific applications and repositories */ async getComponentsWithWaivers(requestParameters: ReportsApiGetComponentsWithWaiversRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getComponentsWithWaiversRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve metrics data such as policy evaluation metrics, violation and remediation metrics aggregated monthly or weekly. Permissions required: View IQ Elements */ async getMetricsRaw(requestParameters: ReportsApiGetMetricsRequest, 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/reports/metrics`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiMetricsReportingQueryDTOV2ToJSON(requestParameters['apiMetricsReportingQueryDTOV2']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ApiMetricsReportingDTOV2FromJSON)); } /** * Use this method to retrieve metrics data such as policy evaluation metrics, violation and remediation metrics aggregated monthly or weekly. Permissions required: View IQ Elements */ async getMetrics(requestParameters: ReportsApiGetMetricsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getMetricsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve previous application scan reports (100 max.) for the specified application. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements */ async getReportHistoryForApplicationRaw(requestParameters: ReportsApiGetReportHistoryForApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationId'] == null) { throw new runtime.RequiredError( 'applicationId', 'Required parameter "applicationId" was null or undefined when calling getReportHistoryForApplication().' ); } const queryParameters: any = {}; if (requestParameters['stage'] != null) { queryParameters['stage'] = requestParameters['stage']; } 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/reports/applications/{applicationId}/history`; urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiReportHistoryDTOFromJSON(jsonValue)); } /** * Use this method to retrieve previous application scan reports (100 max.) for the specified application. You can view application reports only for applications to which you have access. Permissions required: View IQ Elements */ async getReportHistoryForApplication(requestParameters: ReportsApiGetReportHistoryForApplicationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getReportHistoryForApplicationRaw(requestParameters, initOverrides); return await response.value(); } /** * Stale waivers pose a risk because they could be applied unintentionally. Use this method to retrieve stale waivers to eliminate this risk for future application evaluations. Permissions required: View IQ Elements. You can view stale waivers only for applications/repositories to which you have access. */ async getStaleWaiversRaw(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/reports/waivers/stale`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiStaleWaiversResponseDTOFromJSON(jsonValue)); } /** * Stale waivers pose a risk because they could be applied unintentionally. Use this method to retrieve stale waivers to eliminate this risk for future application evaluations. Permissions required: View IQ Elements. You can view stale waivers only for applications/repositories to which you have access. */ async getStaleWaivers(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getStaleWaiversRaw(initOverrides); return await response.value(); } }