/* 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';
export interface CycloneDXApiGetByReportIdRequest {
applicationId: string;
reportId: string;
cdxVersion: string;
}
export interface CycloneDXApiGetLatestRequest {
applicationId: string;
stageId: string;
cdxVersion: string;
}
/**
* CycloneDXApi - interface
*
* @export
* @interface CycloneDXApiInterface
*/
export interface CycloneDXApiInterface {
/**
* Use this method to generate a CycloneDX SBOM for an application.
Permissions Required: View IQ Elements
* @param {string} applicationId Enter the internal applicationId for the application you want to generate the SBOM. You can also retrieve the applicationId using the Application REST API.
* @param {string} reportId Enter the reportId to generate the SBOM for the application for a specific scan report.
* @param {string} cdxVersion Possible values are 1.1|1.2|1.3|1.4|1.5|1.6|1.7.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CycloneDXApiInterface
*/
getByReportIdRaw(requestParameters: CycloneDXApiGetByReportIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>;
/**
* Use this method to generate a CycloneDX SBOM for an application.Permissions Required: View IQ Elements
*/
getByReportId(requestParameters: CycloneDXApiGetByReportIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise;
/**
* Use this method to generate a CycloneDX SBOM for an application.Permissions Required: View IQ Elements
* @param {string} applicationId Enter the internal applicationId for the application you want to generate the SBOM. You can also retrieve the applicationId using the Application REST API.
* @param {string} stageId Enter the stageId to generate the SBOM based on the latest application policy evaluation at that stage. Allowed values for stageId are \'develop\', \'source\', \'build\', \'stage-release\', \'release\', and, \'operate\'.
* @param {string} cdxVersion Possible values are 1.1|1.2|1.3|1.4|1.5|1.6|1.7.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CycloneDXApiInterface
*/
getLatestRaw(requestParameters: CycloneDXApiGetLatestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>;
/**
* Use this method to generate a CycloneDX SBOM for an application.Permissions Required: View IQ Elements
*/
getLatest(requestParameters: CycloneDXApiGetLatestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise;
}
/**
*
*/
export class CycloneDXApi extends runtime.BaseAPI implements CycloneDXApiInterface {
/**
* Use this method to generate a CycloneDX SBOM for an application.Permissions Required: View IQ Elements
*/
async getByReportIdRaw(requestParameters: CycloneDXApiGetByReportIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> {
if (requestParameters['applicationId'] == null) {
throw new runtime.RequiredError(
'applicationId',
'Required parameter "applicationId" was null or undefined when calling getByReportId().'
);
}
if (requestParameters['reportId'] == null) {
throw new runtime.RequiredError(
'reportId',
'Required parameter "reportId" was null or undefined when calling getByReportId().'
);
}
if (requestParameters['cdxVersion'] == null) {
throw new runtime.RequiredError(
'cdxVersion',
'Required parameter "cdxVersion" was null or undefined when calling getByReportId().'
);
}
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/cycloneDx/{cdxVersion}/{applicationId}/reports/{reportId}`;
urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
urlPath = urlPath.replace(`{${"reportId"}}`, encodeURIComponent(String(requestParameters['reportId'])));
urlPath = urlPath.replace(`{${"cdxVersion"}}`, encodeURIComponent(String(requestParameters['cdxVersion'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Use this method to generate a CycloneDX SBOM for an application.Permissions Required: View IQ Elements
*/
async getByReportId(requestParameters: CycloneDXApiGetByReportIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise {
await this.getByReportIdRaw(requestParameters, initOverrides);
}
/**
* Use this method to generate a CycloneDX SBOM for an application.Permissions Required: View IQ Elements
*/
async getLatestRaw(requestParameters: CycloneDXApiGetLatestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> {
if (requestParameters['applicationId'] == null) {
throw new runtime.RequiredError(
'applicationId',
'Required parameter "applicationId" was null or undefined when calling getLatest().'
);
}
if (requestParameters['stageId'] == null) {
throw new runtime.RequiredError(
'stageId',
'Required parameter "stageId" was null or undefined when calling getLatest().'
);
}
if (requestParameters['cdxVersion'] == null) {
throw new runtime.RequiredError(
'cdxVersion',
'Required parameter "cdxVersion" was null or undefined when calling getLatest().'
);
}
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/cycloneDx/{cdxVersion}/{applicationId}/stages/{stageId}`;
urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId'])));
urlPath = urlPath.replace(`{${"stageId"}}`, encodeURIComponent(String(requestParameters['stageId'])));
urlPath = urlPath.replace(`{${"cdxVersion"}}`, encodeURIComponent(String(requestParameters['cdxVersion'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Use this method to generate a CycloneDX SBOM for an application.Permissions Required: View IQ Elements
*/
async getLatest(requestParameters: CycloneDXApiGetLatestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise {
await this.getLatestRaw(requestParameters, initOverrides);
}
}