/* 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 {
CpeMatchingConfigurationRequest,
} from '../models/index';
import {
CpeMatchingConfigurationRequestFromJSON,
CpeMatchingConfigurationRequestToJSON,
} from '../models/index';
export interface CPEMatchingConfigurationApiGetCpeMatchingConfigurationRequest {
ownerType: GetCpeMatchingConfigurationOwnerTypeEnum;
internalOwnerId: string;
}
export interface CPEMatchingConfigurationApiUpdateCpeMatchingConfigurationRequest {
ownerType: UpdateCpeMatchingConfigurationOwnerTypeEnum;
internalOwnerId: string;
cpeMatchingConfigurationRequest?: CpeMatchingConfigurationRequest;
}
/**
* CPEMatchingConfigurationApi - interface
*
* @export
* @interface CPEMatchingConfigurationApiInterface
*/
export interface CPEMatchingConfigurationApiInterface {
/**
* This method allows to retrieve the applicable cpe matching configuration of a given organization or application.
Permissions Required: View IQ Elements
* @param {'application' | 'organization'} ownerType
* @param {string} internalOwnerId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CPEMatchingConfigurationApiInterface
*/
getCpeMatchingConfigurationRaw(requestParameters: CPEMatchingConfigurationApiGetCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>;
/**
* This method allows to retrieve the applicable cpe matching configuration of a given organization or application.Permissions Required: View IQ Elements
*/
getCpeMatchingConfiguration(requestParameters: CPEMatchingConfigurationApiGetCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise;
/**
* Use this method to apply a given cpe matching configuration to an organization or application.Permissions Required: Edit IQ Elements
* @param {'application' | 'organization'} ownerType
* @param {string} internalOwnerId
* @param {CpeMatchingConfigurationRequest} [cpeMatchingConfigurationRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CPEMatchingConfigurationApiInterface
*/
updateCpeMatchingConfigurationRaw(requestParameters: CPEMatchingConfigurationApiUpdateCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>;
/**
* Use this method to apply a given cpe matching configuration to an organization or application.Permissions Required: Edit IQ Elements
*/
updateCpeMatchingConfiguration(requestParameters: CPEMatchingConfigurationApiUpdateCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise;
}
/**
*
*/
export class CPEMatchingConfigurationApi extends runtime.BaseAPI implements CPEMatchingConfigurationApiInterface {
/**
* This method allows to retrieve the applicable cpe matching configuration of a given organization or application.Permissions Required: View IQ Elements
*/
async getCpeMatchingConfigurationRaw(requestParameters: CPEMatchingConfigurationApiGetCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> {
if (requestParameters['ownerType'] == null) {
throw new runtime.RequiredError(
'ownerType',
'Required parameter "ownerType" was null or undefined when calling getCpeMatchingConfiguration().'
);
}
if (requestParameters['internalOwnerId'] == null) {
throw new runtime.RequiredError(
'internalOwnerId',
'Required parameter "internalOwnerId" was null or undefined when calling getCpeMatchingConfiguration().'
);
}
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/{ownerType}/{internalOwnerId}/configuration/publicSource/cpe`;
urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType'])));
urlPath = urlPath.replace(`{${"internalOwnerId"}}`, encodeURIComponent(String(requestParameters['internalOwnerId'])));
const response = await this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* This method allows to retrieve the applicable cpe matching configuration of a given organization or application.Permissions Required: View IQ Elements
*/
async getCpeMatchingConfiguration(requestParameters: CPEMatchingConfigurationApiGetCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise {
await this.getCpeMatchingConfigurationRaw(requestParameters, initOverrides);
}
/**
* Use this method to apply a given cpe matching configuration to an organization or application.Permissions Required: Edit IQ Elements
*/
async updateCpeMatchingConfigurationRaw(requestParameters: CPEMatchingConfigurationApiUpdateCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> {
if (requestParameters['ownerType'] == null) {
throw new runtime.RequiredError(
'ownerType',
'Required parameter "ownerType" was null or undefined when calling updateCpeMatchingConfiguration().'
);
}
if (requestParameters['internalOwnerId'] == null) {
throw new runtime.RequiredError(
'internalOwnerId',
'Required parameter "internalOwnerId" was null or undefined when calling updateCpeMatchingConfiguration().'
);
}
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/{ownerType}/{internalOwnerId}/configuration/publicSource/cpe`;
urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType'])));
urlPath = urlPath.replace(`{${"internalOwnerId"}}`, encodeURIComponent(String(requestParameters['internalOwnerId'])));
const response = await this.request({
path: urlPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: CpeMatchingConfigurationRequestToJSON(requestParameters['cpeMatchingConfigurationRequest']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Use this method to apply a given cpe matching configuration to an organization or application.Permissions Required: Edit IQ Elements
*/
async updateCpeMatchingConfiguration(requestParameters: CPEMatchingConfigurationApiUpdateCpeMatchingConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise {
await this.updateCpeMatchingConfigurationRaw(requestParameters, initOverrides);
}
}
/**
* @export
*/
export const GetCpeMatchingConfigurationOwnerTypeEnum = {
Application: 'application',
Organization: 'organization'
} as const;
export type GetCpeMatchingConfigurationOwnerTypeEnum = typeof GetCpeMatchingConfigurationOwnerTypeEnum[keyof typeof GetCpeMatchingConfigurationOwnerTypeEnum];
/**
* @export
*/
export const UpdateCpeMatchingConfigurationOwnerTypeEnum = {
Application: 'application',
Organization: 'organization'
} as const;
export type UpdateCpeMatchingConfigurationOwnerTypeEnum = typeof UpdateCpeMatchingConfigurationOwnerTypeEnum[keyof typeof UpdateCpeMatchingConfigurationOwnerTypeEnum];