/* 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 { ApiPolicyWaiverRequestDTO, ApiPolicyWaiverRequestOptionsDTO, ApiPolicyWaiverRequestReviewDTO, } from '../models/index'; import { ApiPolicyWaiverRequestDTOFromJSON, ApiPolicyWaiverRequestDTOToJSON, ApiPolicyWaiverRequestOptionsDTOFromJSON, ApiPolicyWaiverRequestOptionsDTOToJSON, ApiPolicyWaiverRequestReviewDTOFromJSON, ApiPolicyWaiverRequestReviewDTOToJSON, } from '../models/index'; export interface PolicyWaiverRequestsApiAddPolicyWaiverRequestByPolicyViolationIdRequest { ownerType: AddPolicyWaiverRequestByPolicyViolationIdOwnerTypeEnum; ownerId: string; policyViolationId: string; apiPolicyWaiverRequestOptionsDTO: ApiPolicyWaiverRequestOptionsDTO; } export interface PolicyWaiverRequestsApiGetPolicyWaiverRequestRequest { ownerType: GetPolicyWaiverRequestOwnerTypeEnum; ownerId: string; policyWaiverRequestId: string; } export interface PolicyWaiverRequestsApiGetPolicyWaiverRequestsRequest { ownerType: GetPolicyWaiverRequestsOwnerTypeEnum; ownerId: string; repositoryFormat?: string; } export interface PolicyWaiverRequestsApiReviewPolicyWaiverRequestRequest { ownerType: ReviewPolicyWaiverRequestOwnerTypeEnum; ownerId: string; policyWaiverRequestId: string; apiPolicyWaiverRequestReviewDTO: ApiPolicyWaiverRequestReviewDTO; } export interface PolicyWaiverRequestsApiUpdatePolicyWaiverRequestRequest { ownerType: UpdatePolicyWaiverRequestOwnerTypeEnum; ownerId: string; policyWaiverRequestId: string; apiPolicyWaiverRequestOptionsDTO: ApiPolicyWaiverRequestOptionsDTO; } export interface PolicyWaiverRequestsApiWithdrawPolicyWaiverRequestRequest { ownerType: WithdrawPolicyWaiverRequestOwnerTypeEnum; ownerId: string; policyWaiverRequestId: string; } /** * PolicyWaiverRequestsApi - interface * * @export * @interface PolicyWaiverRequestsApiInterface */ export interface PolicyWaiverRequestsApiInterface { /** * Use this method to create a policy waiver request. Permissions required: View IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository'} ownerType The scope of the policy waiver request. Possible values are application, organization, repository, repository_manager, repository_container. * @param {string} ownerId The id for the ownerType provided above. E.g. applicationId if the ownerType is application. * @param {string} policyViolationId The policyViolationId for the policy violation on which you want to create a policy waiver request. Use the Policy Violation REST API or Reports REST API to obtain the policyViolationId. * @param {ApiPolicyWaiverRequestOptionsDTO} apiPolicyWaiverRequestOptionsDTO The request JSON can include the fields<ol><li>comment (optional, to indicate the reason of the waiver) default value is null</li><li>matcherStrategy (enumeration, required) can have values DEFAULT, EXACT_COMPONENT, ALL_COMPONENTS, ALL_VERSIONS. DEFAULT will match all components if no hash is provided.</li><li>expiryTime (default null) to set the datetime when the waiver expires.</li><li>expireWhenRemediationAvailable (default false) to expire the waiver when a remediation is available.</li><li>noteToReviewer (optional) to add a note to the reviewer</li></ol> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyWaiverRequestsApiInterface */ addPolicyWaiverRequestByPolicyViolationIdRaw(requestParameters: PolicyWaiverRequestsApiAddPolicyWaiverRequestByPolicyViolationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to create a policy waiver request. Permissions required: View IQ Elements */ addPolicyWaiverRequestByPolicyViolationId(requestParameters: PolicyWaiverRequestsApiAddPolicyWaiverRequestByPolicyViolationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve policy waiver request details for the policyWaiverRequestId specified. Permissions required: View IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository'} ownerType The scope of the policy waiver request. Possible values are application, organization, repository, repository_manager, repository_container. * @param {string} ownerId The id for the ownerType provided above. * @param {string} policyWaiverRequestId The policyWaiverRequestId for which you want to retrieve the details. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyWaiverRequestsApiInterface */ getPolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve policy waiver request details for the policyWaiverRequestId specified. Permissions required: View IQ Elements */ getPolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to list all policy waiver requests for the given owner. Permissions required: View IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository'} ownerType The owner type. Possible values are application, organization, repository, repository_manager, repository_container. * @param {string} ownerId The id for the ownerType. * @param {string} [repositoryFormat] Optional filter for repository format. Use \'docker\' to return only container repository waiver requests, or \'component\' to return only non-container repository waiver requests. Omit to return all. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyWaiverRequestsApiInterface */ getPolicyWaiverRequestsRaw(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Use this method to list all policy waiver requests for the given owner. Permissions required: View IQ Elements */ getPolicyWaiverRequests(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to approve or reject a policy waiver request. Permissions required: Waive Policy Violations * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository'} ownerType The scope of the policy waiver request. Possible values are application, organization, repository, repository_manager, repository_container. * @param {string} ownerId The id for the ownerType provided above. E.g. applicationId if the ownerType is application. * @param {string} policyWaiverRequestId The policyWaiverRequestId for the policy waiver request to be approved or rejected. * @param {ApiPolicyWaiverRequestReviewDTO} apiPolicyWaiverRequestReviewDTO The request JSON can include the fields<ol><li>status. Can be APPROVED or REJECTED</li><li>rejectionReason (optional). A text explaining the reason for the rejection., <li>comment (optional, to indicate the reason of the waiver) default value is null</li><li>matcherStrategy (enumeration, required) can have values DEFAULT, EXACT_COMPONENT, ALL_COMPONENTS, ALL_VERSIONS. DEFAULT will match all components if no hash is provided.</li><li>expiryTime (default null) to set the datetime when the waiver expires.</li></ol><li>expireWhenRemediationAvailable (default false) to expire the waiver when a remediation is available.</li> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyWaiverRequestsApiInterface */ reviewPolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiReviewPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to approve or reject a policy waiver request. Permissions required: Waive Policy Violations */ reviewPolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiReviewPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to update a policy waiver request. Permissions required: View IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository'} ownerType The scope of the policy waiver request. Possible values are application, organization, repository, repository_manager, repository_container. * @param {string} ownerId The id for the ownerType provided above. E.g. applicationId if the ownerType is application. * @param {string} policyWaiverRequestId The id of the policy waiver request to be updated. * @param {ApiPolicyWaiverRequestOptionsDTO} apiPolicyWaiverRequestOptionsDTO The request JSON can include the fields<ol><li>comment (optional, to indicate the reason of the waiver) default value is null</li><li>matcherStrategy (enumeration, required) can have values DEFAULT, EXACT_COMPONENT, ALL_COMPONENTS, ALL_VERSIONS. DEFAULT will match all components if no hash is provided.</li><li>expiryTime (default null) to set the datetime when the waiver expires.</li><li>expireWhenRemediationAvailable (default false) to expire the waiver when a remediation is available.</li><li>noteToReviewer (optional) to add a note to the reviewer</li></ol> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyWaiverRequestsApiInterface */ updatePolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiUpdatePolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to update a policy waiver request. Permissions required: View IQ Elements */ updatePolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiUpdatePolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to withdraw a pending policy waiver request that you originally submitted. The request row is removed; this is intended for cleaning up requests created by mistake (wrong scope, wrong rationale, etc.). The action is recorded in the audit log so the withdrawal remains traceable. Only the original requester may withdraw, and only while the request is in the REQUESTED state. Once a request has been APPROVED or REJECTED, withdraw is rejected — those terminal states must be handled by a reviewer through the review endpoint. Permissions required: View IQ Elements (the caller must also be the requester of the waiver request; other callers receive 404). * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository'} ownerType The scope of the policy waiver request. Possible values are application, organization, repository, repository_manager, repository_container. * @param {string} ownerId The id for the ownerType provided above. E.g. applicationId if the ownerType is application. * @param {string} policyWaiverRequestId The id of the policy waiver request to be withdrawn. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyWaiverRequestsApiInterface */ withdrawPolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiWithdrawPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to withdraw a pending policy waiver request that you originally submitted. The request row is removed; this is intended for cleaning up requests created by mistake (wrong scope, wrong rationale, etc.). The action is recorded in the audit log so the withdrawal remains traceable. Only the original requester may withdraw, and only while the request is in the REQUESTED state. Once a request has been APPROVED or REJECTED, withdraw is rejected — those terminal states must be handled by a reviewer through the review endpoint. Permissions required: View IQ Elements (the caller must also be the requester of the waiver request; other callers receive 404). */ withdrawPolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiWithdrawPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class PolicyWaiverRequestsApi extends runtime.BaseAPI implements PolicyWaiverRequestsApiInterface { /** * Use this method to create a policy waiver request. Permissions required: View IQ Elements */ async addPolicyWaiverRequestByPolicyViolationIdRaw(requestParameters: PolicyWaiverRequestsApiAddPolicyWaiverRequestByPolicyViolationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling addPolicyWaiverRequestByPolicyViolationId().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling addPolicyWaiverRequestByPolicyViolationId().' ); } if (requestParameters['policyViolationId'] == null) { throw new runtime.RequiredError( 'policyViolationId', 'Required parameter "policyViolationId" was null or undefined when calling addPolicyWaiverRequestByPolicyViolationId().' ); } if (requestParameters['apiPolicyWaiverRequestOptionsDTO'] == null) { throw new runtime.RequiredError( 'apiPolicyWaiverRequestOptionsDTO', 'Required parameter "apiPolicyWaiverRequestOptionsDTO" was null or undefined when calling addPolicyWaiverRequestByPolicyViolationId().' ); } 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/policyWaiverRequests/{ownerType}/{ownerId}/policyViolation/{policyViolationId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"policyViolationId"}}`, encodeURIComponent(String(requestParameters['policyViolationId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiPolicyWaiverRequestOptionsDTOToJSON(requestParameters['apiPolicyWaiverRequestOptionsDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiPolicyWaiverRequestDTOFromJSON(jsonValue)); } /** * Use this method to create a policy waiver request. Permissions required: View IQ Elements */ async addPolicyWaiverRequestByPolicyViolationId(requestParameters: PolicyWaiverRequestsApiAddPolicyWaiverRequestByPolicyViolationIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addPolicyWaiverRequestByPolicyViolationIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve policy waiver request details for the policyWaiverRequestId specified. Permissions required: View IQ Elements */ async getPolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getPolicyWaiverRequest().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getPolicyWaiverRequest().' ); } if (requestParameters['policyWaiverRequestId'] == null) { throw new runtime.RequiredError( 'policyWaiverRequestId', 'Required parameter "policyWaiverRequestId" was null or undefined when calling getPolicyWaiverRequest().' ); } 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/policyWaiverRequests/{ownerType}/{ownerId}/{policyWaiverRequestId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"policyWaiverRequestId"}}`, encodeURIComponent(String(requestParameters['policyWaiverRequestId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiPolicyWaiverRequestDTOFromJSON(jsonValue)); } /** * Use this method to retrieve policy waiver request details for the policyWaiverRequestId specified. Permissions required: View IQ Elements */ async getPolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getPolicyWaiverRequestRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to list all policy waiver requests for the given owner. Permissions required: View IQ Elements */ async getPolicyWaiverRequestsRaw(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getPolicyWaiverRequests().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getPolicyWaiverRequests().' ); } const queryParameters: any = {}; if (requestParameters['repositoryFormat'] != null) { queryParameters['repositoryFormat'] = requestParameters['repositoryFormat']; } 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/policyWaiverRequests/{ownerType}/{ownerId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ApiPolicyWaiverRequestDTOFromJSON)); } /** * Use this method to list all policy waiver requests for the given owner. Permissions required: View IQ Elements */ async getPolicyWaiverRequests(requestParameters: PolicyWaiverRequestsApiGetPolicyWaiverRequestsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getPolicyWaiverRequestsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to approve or reject a policy waiver request. Permissions required: Waive Policy Violations */ async reviewPolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiReviewPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling reviewPolicyWaiverRequest().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling reviewPolicyWaiverRequest().' ); } if (requestParameters['policyWaiverRequestId'] == null) { throw new runtime.RequiredError( 'policyWaiverRequestId', 'Required parameter "policyWaiverRequestId" was null or undefined when calling reviewPolicyWaiverRequest().' ); } if (requestParameters['apiPolicyWaiverRequestReviewDTO'] == null) { throw new runtime.RequiredError( 'apiPolicyWaiverRequestReviewDTO', 'Required parameter "apiPolicyWaiverRequestReviewDTO" was null or undefined when calling reviewPolicyWaiverRequest().' ); } 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/policyWaiverRequests/{ownerType}/{ownerId}/review/{policyWaiverRequestId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"policyWaiverRequestId"}}`, encodeURIComponent(String(requestParameters['policyWaiverRequestId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiPolicyWaiverRequestReviewDTOToJSON(requestParameters['apiPolicyWaiverRequestReviewDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiPolicyWaiverRequestDTOFromJSON(jsonValue)); } /** * Use this method to approve or reject a policy waiver request. Permissions required: Waive Policy Violations */ async reviewPolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiReviewPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.reviewPolicyWaiverRequestRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to update a policy waiver request. Permissions required: View IQ Elements */ async updatePolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiUpdatePolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling updatePolicyWaiverRequest().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling updatePolicyWaiverRequest().' ); } if (requestParameters['policyWaiverRequestId'] == null) { throw new runtime.RequiredError( 'policyWaiverRequestId', 'Required parameter "policyWaiverRequestId" was null or undefined when calling updatePolicyWaiverRequest().' ); } if (requestParameters['apiPolicyWaiverRequestOptionsDTO'] == null) { throw new runtime.RequiredError( 'apiPolicyWaiverRequestOptionsDTO', 'Required parameter "apiPolicyWaiverRequestOptionsDTO" was null or undefined when calling updatePolicyWaiverRequest().' ); } 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/policyWaiverRequests/{ownerType}/{ownerId}/{policyWaiverRequestId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"policyWaiverRequestId"}}`, encodeURIComponent(String(requestParameters['policyWaiverRequestId']))); const response = await this.request({ path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: ApiPolicyWaiverRequestOptionsDTOToJSON(requestParameters['apiPolicyWaiverRequestOptionsDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiPolicyWaiverRequestDTOFromJSON(jsonValue)); } /** * Use this method to update a policy waiver request. Permissions required: View IQ Elements */ async updatePolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiUpdatePolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updatePolicyWaiverRequestRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to withdraw a pending policy waiver request that you originally submitted. The request row is removed; this is intended for cleaning up requests created by mistake (wrong scope, wrong rationale, etc.). The action is recorded in the audit log so the withdrawal remains traceable. Only the original requester may withdraw, and only while the request is in the REQUESTED state. Once a request has been APPROVED or REJECTED, withdraw is rejected — those terminal states must be handled by a reviewer through the review endpoint. Permissions required: View IQ Elements (the caller must also be the requester of the waiver request; other callers receive 404). */ async withdrawPolicyWaiverRequestRaw(requestParameters: PolicyWaiverRequestsApiWithdrawPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling withdrawPolicyWaiverRequest().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling withdrawPolicyWaiverRequest().' ); } if (requestParameters['policyWaiverRequestId'] == null) { throw new runtime.RequiredError( 'policyWaiverRequestId', 'Required parameter "policyWaiverRequestId" was null or undefined when calling withdrawPolicyWaiverRequest().' ); } 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/policyWaiverRequests/{ownerType}/{ownerId}/{policyWaiverRequestId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"policyWaiverRequestId"}}`, encodeURIComponent(String(requestParameters['policyWaiverRequestId']))); const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to withdraw a pending policy waiver request that you originally submitted. The request row is removed; this is intended for cleaning up requests created by mistake (wrong scope, wrong rationale, etc.). The action is recorded in the audit log so the withdrawal remains traceable. Only the original requester may withdraw, and only while the request is in the REQUESTED state. Once a request has been APPROVED or REJECTED, withdraw is rejected — those terminal states must be handled by a reviewer through the review endpoint. Permissions required: View IQ Elements (the caller must also be the requester of the waiver request; other callers receive 404). */ async withdrawPolicyWaiverRequest(requestParameters: PolicyWaiverRequestsApiWithdrawPolicyWaiverRequestRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.withdrawPolicyWaiverRequestRaw(requestParameters, initOverrides); } } /** * @export */ export const AddPolicyWaiverRequestByPolicyViolationIdOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository' } as const; export type AddPolicyWaiverRequestByPolicyViolationIdOwnerTypeEnum = typeof AddPolicyWaiverRequestByPolicyViolationIdOwnerTypeEnum[keyof typeof AddPolicyWaiverRequestByPolicyViolationIdOwnerTypeEnum]; /** * @export */ export const GetPolicyWaiverRequestOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository' } as const; export type GetPolicyWaiverRequestOwnerTypeEnum = typeof GetPolicyWaiverRequestOwnerTypeEnum[keyof typeof GetPolicyWaiverRequestOwnerTypeEnum]; /** * @export */ export const GetPolicyWaiverRequestsOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository' } as const; export type GetPolicyWaiverRequestsOwnerTypeEnum = typeof GetPolicyWaiverRequestsOwnerTypeEnum[keyof typeof GetPolicyWaiverRequestsOwnerTypeEnum]; /** * @export */ export const ReviewPolicyWaiverRequestOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository' } as const; export type ReviewPolicyWaiverRequestOwnerTypeEnum = typeof ReviewPolicyWaiverRequestOwnerTypeEnum[keyof typeof ReviewPolicyWaiverRequestOwnerTypeEnum]; /** * @export */ export const UpdatePolicyWaiverRequestOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository' } as const; export type UpdatePolicyWaiverRequestOwnerTypeEnum = typeof UpdatePolicyWaiverRequestOwnerTypeEnum[keyof typeof UpdatePolicyWaiverRequestOwnerTypeEnum]; /** * @export */ export const WithdrawPolicyWaiverRequestOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository' } as const; export type WithdrawPolicyWaiverRequestOwnerTypeEnum = typeof WithdrawPolicyWaiverRequestOwnerTypeEnum[keyof typeof WithdrawPolicyWaiverRequestOwnerTypeEnum];