/* 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 { ApiLegacyViolationChangeResponseDTO, ApiPolicyViolationDTOV2, } from '../models/index'; import { ApiLegacyViolationChangeResponseDTOFromJSON, ApiLegacyViolationChangeResponseDTOToJSON, ApiPolicyViolationDTOV2FromJSON, ApiPolicyViolationDTOV2ToJSON, } from '../models/index'; export interface LegacyViolationsApiGrantRequest { applicationPublicId: string; } export interface LegacyViolationsApiListLegacyViolationsRequest { applicationPublicId: string; policyId?: string; componentIdentifier?: string; } export interface LegacyViolationsApiRevokeRequest { applicationPublicId: string; } /** * LegacyViolationsApi - interface * * @export * @interface LegacyViolationsApiInterface */ export interface LegacyViolationsApiInterface { /** * Use this method to grant legacy status to all eligible policy violations of an application. Permissions required: Edit IQ Elements * @param {string} applicationPublicId The public id of the application. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LegacyViolationsApiInterface */ grantRaw(requestParameters: LegacyViolationsApiGrantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to grant legacy status to all eligible policy violations of an application. Permissions required: Edit IQ Elements */ grant(requestParameters: LegacyViolationsApiGrantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve all legacy policy violations for an application. Permissions required: View IQ Elements * @param {string} applicationPublicId The public id of the application. * @param {string} [policyId] Optional policy id filter. * @param {string} [componentIdentifier] Optional component identifier filter, expressed as a package URL (purl). * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LegacyViolationsApiInterface */ listLegacyViolationsRaw(requestParameters: LegacyViolationsApiListLegacyViolationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Use this method to retrieve all legacy policy violations for an application. Permissions required: View IQ Elements */ listLegacyViolations(requestParameters: LegacyViolationsApiListLegacyViolationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to revoke legacy status from all legacy policy violations of an application. Permissions required: Edit IQ Elements * @param {string} applicationPublicId The public id of the application. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LegacyViolationsApiInterface */ revokeRaw(requestParameters: LegacyViolationsApiRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to revoke legacy status from all legacy policy violations of an application. Permissions required: Edit IQ Elements */ revoke(requestParameters: LegacyViolationsApiRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class LegacyViolationsApi extends runtime.BaseAPI implements LegacyViolationsApiInterface { /** * Use this method to grant legacy status to all eligible policy violations of an application. Permissions required: Edit IQ Elements */ async grantRaw(requestParameters: LegacyViolationsApiGrantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling grant().' ); } 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/legacyViolations/application/{applicationPublicId}/grant`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiLegacyViolationChangeResponseDTOFromJSON(jsonValue)); } /** * Use this method to grant legacy status to all eligible policy violations of an application. Permissions required: Edit IQ Elements */ async grant(requestParameters: LegacyViolationsApiGrantRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.grantRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve all legacy policy violations for an application. Permissions required: View IQ Elements */ async listLegacyViolationsRaw(requestParameters: LegacyViolationsApiListLegacyViolationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling listLegacyViolations().' ); } const queryParameters: any = {}; if (requestParameters['policyId'] != null) { queryParameters['policyId'] = requestParameters['policyId']; } if (requestParameters['componentIdentifier'] != null) { queryParameters['componentIdentifier'] = requestParameters['componentIdentifier']; } 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/legacyViolations/application/{applicationPublicId}`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ApiPolicyViolationDTOV2FromJSON)); } /** * Use this method to retrieve all legacy policy violations for an application. Permissions required: View IQ Elements */ async listLegacyViolations(requestParameters: LegacyViolationsApiListLegacyViolationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.listLegacyViolationsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to revoke legacy status from all legacy policy violations of an application. Permissions required: Edit IQ Elements */ async revokeRaw(requestParameters: LegacyViolationsApiRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling revoke().' ); } 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/legacyViolations/application/{applicationPublicId}/revoke`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiLegacyViolationChangeResponseDTOFromJSON(jsonValue)); } /** * Use this method to revoke legacy status from all legacy policy violations of an application. Permissions required: Edit IQ Elements */ async revoke(requestParameters: LegacyViolationsApiRevokeRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.revokeRaw(requestParameters, initOverrides); return await response.value(); } }