/* 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 { ApiThirdPartyScanResultDTO, ApiThirdPartyScanTicketDTO, } from '../models/index'; import { ApiThirdPartyScanResultDTOFromJSON, ApiThirdPartyScanResultDTOToJSON, ApiThirdPartyScanTicketDTOFromJSON, ApiThirdPartyScanTicketDTOToJSON, } from '../models/index'; export interface ThirdPartyAnalysisApiGetScanStatusRequest { applicationId: string; scanRequestId: string; } export interface ThirdPartyAnalysisApiScanComponentsRequest { applicationId: string; source: string; stageId?: string; body?: string; } /** * ThirdPartyAnalysisApi - interface * * @export * @interface ThirdPartyAnalysisApiInterface */ export interface ThirdPartyAnalysisApiInterface { /** * SBOM evaluation is an asynchronous operation. Use this method to check on the status of the SBOM evaluation. Permissions required: Evaluate Applications * @param {string} applicationId Enter the application internal id for the SBOM to be evaluated. * @param {string} scanRequestId Enter the statusId from the statusUrl generated as a response to the POST request to perform the evaluation. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ThirdPartyAnalysisApiInterface */ getScanStatusRaw(requestParameters: ThirdPartyAnalysisApiGetScanStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * SBOM evaluation is an asynchronous operation. Use this method to check on the status of the SBOM evaluation. Permissions required: Evaluate Applications */ getScanStatus(requestParameters: ThirdPartyAnalysisApiGetScanStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to perform an analysis of an SBOM. Permissions required: Evaluate Applications * @param {string} applicationId Enter the application internal id. Use the Applications REST API to retrieve theapplication internal id. * @param {string} source Specify the specification name of the SBOM to be evaluated. Allowed values are `cyclonedx` and `spdx` * @param {string} [stageId] Enter the stageId to run the evaluation for. The policy actions will be determined by the stage selected. Allowed values are `develop`, `build`, `stage-release`, `release` and `operate` * @param {string} [body] Select the request header content-type from the dropdown, depending on whether the SBOM is in XML or JSON format. Embed the contents of the SBOM here or enter the file path for the SBOM. A component in the SBOM can be identified by: <ol><li>packageUrl</li><li>Component hash</li><li>Component name and version</li></ol> Any SPE and SWID tags for the component will be preserved in the evaluation report. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ThirdPartyAnalysisApiInterface */ scanComponentsRaw(requestParameters: ThirdPartyAnalysisApiScanComponentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to perform an analysis of an SBOM. Permissions required: Evaluate Applications */ scanComponents(requestParameters: ThirdPartyAnalysisApiScanComponentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class ThirdPartyAnalysisApi extends runtime.BaseAPI implements ThirdPartyAnalysisApiInterface { /** * SBOM evaluation is an asynchronous operation. Use this method to check on the status of the SBOM evaluation. Permissions required: Evaluate Applications */ async getScanStatusRaw(requestParameters: ThirdPartyAnalysisApiGetScanStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationId'] == null) { throw new runtime.RequiredError( 'applicationId', 'Required parameter "applicationId" was null or undefined when calling getScanStatus().' ); } if (requestParameters['scanRequestId'] == null) { throw new runtime.RequiredError( 'scanRequestId', 'Required parameter "scanRequestId" was null or undefined when calling getScanStatus().' ); } 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/scan/applications/{applicationId}/status/{scanRequestId}`; urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId']))); urlPath = urlPath.replace(`{${"scanRequestId"}}`, encodeURIComponent(String(requestParameters['scanRequestId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiThirdPartyScanResultDTOFromJSON(jsonValue)); } /** * SBOM evaluation is an asynchronous operation. Use this method to check on the status of the SBOM evaluation. Permissions required: Evaluate Applications */ async getScanStatus(requestParameters: ThirdPartyAnalysisApiGetScanStatusRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getScanStatusRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to perform an analysis of an SBOM. Permissions required: Evaluate Applications */ async scanComponentsRaw(requestParameters: ThirdPartyAnalysisApiScanComponentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationId'] == null) { throw new runtime.RequiredError( 'applicationId', 'Required parameter "applicationId" was null or undefined when calling scanComponents().' ); } if (requestParameters['source'] == null) { throw new runtime.RequiredError( 'source', 'Required parameter "source" was null or undefined when calling scanComponents().' ); } const queryParameters: any = {}; if (requestParameters['stageId'] != null) { queryParameters['stageId'] = requestParameters['stageId']; } 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/scan/applications/{applicationId}/sources/{source}`; urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId']))); urlPath = urlPath.replace(`{${"source"}}`, encodeURIComponent(String(requestParameters['source']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['body'] as any, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiThirdPartyScanTicketDTOFromJSON(jsonValue)); } /** * Use this method to perform an analysis of an SBOM. Permissions required: Evaluate Applications */ async scanComponents(requestParameters: ThirdPartyAnalysisApiScanComponentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.scanComponentsRaw(requestParameters, initOverrides); return await response.value(); } }