/* 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 { PolicyExportResult, } from '../models/index'; import { PolicyExportResultFromJSON, PolicyExportResultToJSON, } from '../models/index'; export interface PolicyExportApiExportPoliciesRequest { ownerType: ExportPoliciesOwnerTypeEnum; ownerId: string; includeInherited?: boolean; } /** * PolicyExportApi - interface * * @export * @interface PolicyExportApiInterface */ export interface PolicyExportApiInterface { /** * Exports policy configurations including policy rules, conditions, labels, license threat groups, and tags for the specified owner (organization, application, or repository). Use the `includeInherited` parameter to include policies from parent levels in the hierarchy. **Permissions required**: View IQ Elements (READ permission on the specified owner) **Export scope**: - Policy rules and conditions - Policy assignments (via ownerId on each policy) - Component labels - License threat groups - Application categories (tags) for organizations **Note**: Waivers are not included in the export. * @summary Export policy configuration * @param {'application' | 'organization' | 'repository'} ownerType Type of owner (organization, application, or repository) * @param {string} ownerId Internal ID of the owner * @param {boolean} [includeInherited] If true, include policies from parent levels in the hierarchy. For repositories, includes policies from the repository, RepositoryManager, RepositoryContainer, and parent organization. For applications, includes policies from the application and parent organization(s). For organizations, includes policies from the organization and any parent organizations. Default: false (direct policies only) * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PolicyExportApiInterface */ exportPoliciesRaw(requestParameters: PolicyExportApiExportPoliciesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Exports policy configurations including policy rules, conditions, labels, license threat groups, and tags for the specified owner (organization, application, or repository). Use the `includeInherited` parameter to include policies from parent levels in the hierarchy. **Permissions required**: View IQ Elements (READ permission on the specified owner) **Export scope**: - Policy rules and conditions - Policy assignments (via ownerId on each policy) - Component labels - License threat groups - Application categories (tags) for organizations **Note**: Waivers are not included in the export. * Export policy configuration */ exportPolicies(requestParameters: PolicyExportApiExportPoliciesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class PolicyExportApi extends runtime.BaseAPI implements PolicyExportApiInterface { /** * Exports policy configurations including policy rules, conditions, labels, license threat groups, and tags for the specified owner (organization, application, or repository). Use the `includeInherited` parameter to include policies from parent levels in the hierarchy. **Permissions required**: View IQ Elements (READ permission on the specified owner) **Export scope**: - Policy rules and conditions - Policy assignments (via ownerId on each policy) - Component labels - License threat groups - Application categories (tags) for organizations **Note**: Waivers are not included in the export. * Export policy configuration */ async exportPoliciesRaw(requestParameters: PolicyExportApiExportPoliciesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling exportPolicies().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling exportPolicies().' ); } const queryParameters: any = {}; if (requestParameters['includeInherited'] != null) { queryParameters['includeInherited'] = requestParameters['includeInherited']; } 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/policy/{ownerType}/{ownerId}/export`; 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) => PolicyExportResultFromJSON(jsonValue)); } /** * Exports policy configurations including policy rules, conditions, labels, license threat groups, and tags for the specified owner (organization, application, or repository). Use the `includeInherited` parameter to include policies from parent levels in the hierarchy. **Permissions required**: View IQ Elements (READ permission on the specified owner) **Export scope**: - Policy rules and conditions - Policy assignments (via ownerId on each policy) - Component labels - License threat groups - Application categories (tags) for organizations **Note**: Waivers are not included in the export. * Export policy configuration */ async exportPolicies(requestParameters: PolicyExportApiExportPoliciesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.exportPoliciesRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const ExportPoliciesOwnerTypeEnum = { Application: 'application', Organization: 'organization', Repository: 'repository' } as const; export type ExportPoliciesOwnerTypeEnum = typeof ExportPoliciesOwnerTypeEnum[keyof typeof ExportPoliciesOwnerTypeEnum];