/* 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 { ApiComponentReleasedFromQuarantineDTO, ApiRepositoryPathResponseDTO, } from '../models/index'; import { ApiComponentReleasedFromQuarantineDTOFromJSON, ApiComponentReleasedFromQuarantineDTOToJSON, ApiRepositoryPathResponseDTOFromJSON, ApiRepositoryPathResponseDTOToJSON, } from '../models/index'; export interface RepositoriesApiGetQuarantinedByPathRequest { repositoryManagerInstanceId: string; repositoryPublicId: string; requestBody: Array; } export interface RepositoriesApiReleaseQuarantineWithoutReEvalRequest { quarantineId: string; body: string; } export interface RepositoriesApiUploadScanRequest { repositoryManagerId: string; repositoryId: string; componentId?: string; policyEvaluationStage?: string; scanFile?: Blob; } /** * RepositoriesApi - interface * * @export * @interface RepositoriesApiInterface */ export interface RepositoriesApiInterface { /** * Use this method to retrieve the pathnames of the repository components and the corresponding quarantine status. Permissions required: View IQ Elements * @param {string} repositoryManagerInstanceId Enter the repository manager instance ID. * @param {string} repositoryPublicId Enter the repository public ID. * @param {Array} requestBody Specify the pathnames. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RepositoriesApiInterface */ getQuarantinedByPathRaw(requestParameters: RepositoriesApiGetQuarantinedByPathRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the pathnames of the repository components and the corresponding quarantine status. Permissions required: View IQ Elements */ getQuarantinedByPath(requestParameters: RepositoriesApiGetQuarantinedByPathRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to release a component from quarantine by providing the `quarantineId`. Use the GET method of the Reports REST API to retrieve the `quarantineId` for the quarantined component. Permissions required: Edit IQ Elements * @param {string} quarantineId Enter the component `quarantineId`. * @param {string} body Enter a waiver comment for releasing the component from quarantine. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RepositoriesApiInterface */ releaseQuarantineWithoutReEvalRaw(requestParameters: RepositoriesApiReleaseQuarantineWithoutReEvalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to release a component from quarantine by providing the `quarantineId`. Use the GET method of the Reports REST API to retrieve the `quarantineId` for the quarantined component. Permissions required: Edit IQ Elements */ releaseQuarantineWithoutReEval(requestParameters: RepositoriesApiReleaseQuarantineWithoutReEvalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * * @param {string} repositoryManagerId * @param {string} repositoryId * @param {string} [componentId] * @param {string} [policyEvaluationStage] * @param {Blob} [scanFile] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RepositoriesApiInterface */ uploadScanRaw(requestParameters: RepositoriesApiUploadScanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** */ uploadScan(requestParameters: RepositoriesApiUploadScanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class RepositoriesApi extends runtime.BaseAPI implements RepositoriesApiInterface { /** * Use this method to retrieve the pathnames of the repository components and the corresponding quarantine status. Permissions required: View IQ Elements */ async getQuarantinedByPathRaw(requestParameters: RepositoriesApiGetQuarantinedByPathRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['repositoryManagerInstanceId'] == null) { throw new runtime.RequiredError( 'repositoryManagerInstanceId', 'Required parameter "repositoryManagerInstanceId" was null or undefined when calling getQuarantinedByPath().' ); } if (requestParameters['repositoryPublicId'] == null) { throw new runtime.RequiredError( 'repositoryPublicId', 'Required parameter "repositoryPublicId" was null or undefined when calling getQuarantinedByPath().' ); } if (requestParameters['requestBody'] == null) { throw new runtime.RequiredError( 'requestBody', 'Required parameter "requestBody" was null or undefined when calling getQuarantinedByPath().' ); } 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/repositories/{repositoryManagerInstanceId}/{repositoryPublicId}/components/quarantined/pathnames`; urlPath = urlPath.replace(`{${"repositoryManagerInstanceId"}}`, encodeURIComponent(String(requestParameters['repositoryManagerInstanceId']))); urlPath = urlPath.replace(`{${"repositoryPublicId"}}`, encodeURIComponent(String(requestParameters['repositoryPublicId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: requestParameters['requestBody'], }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiRepositoryPathResponseDTOFromJSON(jsonValue)); } /** * Use this method to retrieve the pathnames of the repository components and the corresponding quarantine status. Permissions required: View IQ Elements */ async getQuarantinedByPath(requestParameters: RepositoriesApiGetQuarantinedByPathRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getQuarantinedByPathRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to release a component from quarantine by providing the `quarantineId`. Use the GET method of the Reports REST API to retrieve the `quarantineId` for the quarantined component. Permissions required: Edit IQ Elements */ async releaseQuarantineWithoutReEvalRaw(requestParameters: RepositoriesApiReleaseQuarantineWithoutReEvalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['quarantineId'] == null) { throw new runtime.RequiredError( 'quarantineId', 'Required parameter "quarantineId" was null or undefined when calling releaseQuarantineWithoutReEval().' ); } if (requestParameters['body'] == null) { throw new runtime.RequiredError( 'body', 'Required parameter "body" was null or undefined when calling releaseQuarantineWithoutReEval().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'text/plain'; 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/repositories/quarantine/{quarantineId}/release`; urlPath = urlPath.replace(`{${"quarantineId"}}`, encodeURIComponent(String(requestParameters['quarantineId']))); 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) => ApiComponentReleasedFromQuarantineDTOFromJSON(jsonValue)); } /** * Use this method to release a component from quarantine by providing the `quarantineId`. Use the GET method of the Reports REST API to retrieve the `quarantineId` for the quarantined component. Permissions required: Edit IQ Elements */ async releaseQuarantineWithoutReEval(requestParameters: RepositoriesApiReleaseQuarantineWithoutReEvalRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.releaseQuarantineWithoutReEvalRaw(requestParameters, initOverrides); return await response.value(); } /** */ async uploadScanRaw(requestParameters: RepositoriesApiUploadScanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['repositoryManagerId'] == null) { throw new runtime.RequiredError( 'repositoryManagerId', 'Required parameter "repositoryManagerId" was null or undefined when calling uploadScan().' ); } if (requestParameters['repositoryId'] == null) { throw new runtime.RequiredError( 'repositoryId', 'Required parameter "repositoryId" was null or undefined when calling uploadScan().' ); } 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}`; } } const consumes: runtime.Consume[] = [ { contentType: 'multipart/form-data' }, ]; // @ts-ignore: canConsumeForm may be unused const canConsumeForm = runtime.canConsumeForm(consumes); let formParams: { append(param: string, value: any): any }; let useForm = false; // use FormData to transmit files using content-type "multipart/form-data" useForm = canConsumeForm; if (useForm) { formParams = new FormData(); } else { formParams = new URLSearchParams(); } if (requestParameters['componentId'] != null) { formParams.append('componentId', requestParameters['componentId'] as any); } if (requestParameters['policyEvaluationStage'] != null) { formParams.append('policyEvaluationStage', requestParameters['policyEvaluationStage'] as any); } if (requestParameters['scanFile'] != null) { formParams.append('scanFile', requestParameters['scanFile'] as any); } let urlPath = `/api/v2/repositories/{repositoryManagerId}/{repositoryId}/components`; urlPath = urlPath.replace(`{${"repositoryManagerId"}}`, encodeURIComponent(String(requestParameters['repositoryManagerId']))); urlPath = urlPath.replace(`{${"repositoryId"}}`, encodeURIComponent(String(requestParameters['repositoryId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: formParams, }, initOverrides); return new runtime.VoidApiResponse(response); } /** */ async uploadScan(requestParameters: RepositoriesApiUploadScanRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.uploadScanRaw(requestParameters, initOverrides); } }