/* 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 { ApiSourceControlDTO, RelayRegisterAdminRequest, SCMUserMappingsDTO, SCMUserMappingsResponseDTO, SCMUserMatchingResultDTO, } from '../models/index'; import { ApiSourceControlDTOFromJSON, ApiSourceControlDTOToJSON, RelayRegisterAdminRequestFromJSON, RelayRegisterAdminRequestToJSON, SCMUserMappingsDTOFromJSON, SCMUserMappingsDTOToJSON, SCMUserMappingsResponseDTOFromJSON, SCMUserMappingsResponseDTOToJSON, SCMUserMatchingResultDTOFromJSON, SCMUserMatchingResultDTOToJSON, } from '../models/index'; export interface SourceControlApiAddSourceControlRequest { ownerType: AddSourceControlOwnerTypeEnum; internalOwnerId: string; apiSourceControlDTO?: ApiSourceControlDTO; } export interface SourceControlApiAddUserMappingsRequest { organizationId: string; sCMUserMappingsDTO?: SCMUserMappingsDTO; } export interface SourceControlApiAutomaticRoleAssignmentRequest { publicId: string; sCMUserMappingsDTO?: SCMUserMappingsDTO; } export interface SourceControlApiDeleteSourceControlRequest { ownerType: DeleteSourceControlOwnerTypeEnum; internalOwnerId: string; } export interface SourceControlApiDeleteUserMappingsRequest { organizationId: string; } export interface SourceControlApiGetSourceControl1Request { ownerType: GetSourceControl1OwnerTypeEnum; internalOwnerId: string; } export interface SourceControlApiGetUserMappingsByOwnerRequest { ownerType: GetUserMappingsByOwnerOwnerTypeEnum; internalOwnerId: string; } export interface SourceControlApiRegisterWithRelayRequest { relayRegisterAdminRequest?: RelayRegisterAdminRequest; } export interface SourceControlApiUpdateSourceControlRequest { ownerType: UpdateSourceControlOwnerTypeEnum; internalOwnerId: string; apiSourceControlDTO?: ApiSourceControlDTO; } /** * SourceControlApi - interface * * @export * @interface SourceControlApiInterface */ export interface SourceControlApiInterface { /** * Use this method to create a source control configuration setting. Permissions required: Edit IQ Elements * @param {'application' | 'organization'} ownerType Enter the value for ownerType. * @param {string} internalOwnerId Enter the value for internal ownerId. Use ROOT_ORGANIZATION_ID for root organization. * @param {ApiSourceControlDTO} [apiSourceControlDTO] Specify the SCM settings for the ownerId specified above in the request JSON.<ul><li><code>id</code> is the internal owner ID.</li><li><code>repositoryUrl</code> is the http(s) and ssh urls for the application specified in the ownerId.</li><li><code>username</code> is optional, can be provided for Bitbucket Server and Cloud.</li><li><code>token</code> is optional,if inherited. If provided, this value will override the value inherited from the root organization, organization or application level.<li><code>provider</code> is the name of of the SCM system. Allowed values are <code>azure</code>, <code>github</code>, <code>gitlab</code>, and <code>bitbucket</code>.</li><li><code>baseBranch</code> is required for the root organization. Organizations and applications inherit from the root unless overridden.</li><li><code>enablePullRequests</code> has been deprecated in version 124.</li><li><code>remediationPullRequestsEnabled</code> is optional. Set it to `true` to enable the Automated Pull Requests.</li><li><code>enableStatusChecks</code> has been deprecated in version 124.</li><li><code>statusChecksEnabled</code> is an internal field.</li><li><code>pullRequestCommentingEnabled</code> is optional. Set it to `true` to enable the Pull Request Commenting feature.</li><li><code>sourceControlEvaluationsEnabled</code> is set to `true` to enable source control evaluations for the continuous risk profile feature.</li><li><code>sourceControlScanTarget</code> is the path inside the repository.</li><li><code>sshEnabled</code> is set to `true` to enable ssh.</li><li><code>commitStatusEnabled</code> is set to `true` if interaction with the commit statuses on the SCM is enabled.</li></ul> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ addSourceControlRaw(requestParameters: SourceControlApiAddSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to create a source control configuration setting. Permissions required: Edit IQ Elements */ addSourceControl(requestParameters: SourceControlApiAddSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to apply user mappings from SCM (GitHub) to Lifecycle. The user mappings will be inherited by all child organizations and applications in the organization hierarchy. If a user mapping for an organization already exists, it will be replaced with new mappings provided here. Permissions required: Edit IQ Elements * @param {string} organizationId Enter the organizationId. Use `ROOT_ORGANIZATION_ID` for the root organization * @param {SCMUserMappingsDTO} [sCMUserMappingsDTO] <ul><li>Specify the `role` in lowercase, without whitespaces.</li><li>`mappings` is an array of objects consisting of `from` and `to` fields.</li><li>Allowed values for the `from` field are `SCM_USERNAME`, `SCM_EMAIL`, `SCM_FULLNAME`, `GITLOG_EMAIL`, `GITLOG_FULLNAME`.</li><li>Allowed values for `to` field are `IQ_USERNAME`, `IQ_EMAIL`, `IQ_FULLNAME`.</li><li>Any combination of `from` and `to` fields can be used.</li></ul> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ addUserMappingsRaw(requestParameters: SourceControlApiAddUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to apply user mappings from SCM (GitHub) to Lifecycle. The user mappings will be inherited by all child organizations and applications in the organization hierarchy. If a user mapping for an organization already exists, it will be replaced with new mappings provided here. Permissions required: Edit IQ Elements */ addUserMappings(requestParameters: SourceControlApiAddUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to automatically grant the supplied role to all contributors of a repository on a given application. Prerequisites for automatic role assignment are:
  1. SCM configuration for the application and authentication token should exist.
  2. The contributors to the repository should match a user in IQ based on the supplied mappings.
  3. Either user mapping strategies have been configured for your organization, or they are provided in the request
Permissions required: Edit access control on the application. * @param {string} publicId Enter the public applicationId for automatic role assignment. * @param {SCMUserMappingsDTO} [sCMUserMappingsDTO] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ automaticRoleAssignmentRaw(requestParameters: SourceControlApiAutomaticRoleAssignmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to automatically grant the supplied role to all contributors of a repository on a given application. Prerequisites for automatic role assignment are:
  1. SCM configuration for the application and authentication token should exist.
  2. The contributors to the repository should match a user in IQ based on the supplied mappings.
  3. Either user mapping strategies have been configured for your organization, or they are provided in the request
Permissions required: Edit access control on the application. */ automaticRoleAssignment(requestParameters: SourceControlApiAutomaticRoleAssignmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to delete a SCM setting for the specified ownerType/ownerId. Permissions required: Edit IQ Elements * @param {'application' | 'organization'} ownerType Enter the value for ownerType. * @param {string} internalOwnerId Enter the value for internal ownerId. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ deleteSourceControlRaw(requestParameters: SourceControlApiDeleteSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to delete a SCM setting for the specified ownerType/ownerId. Permissions required: Edit IQ Elements */ deleteSourceControl(requestParameters: SourceControlApiDeleteSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to delete existing SCM user mappings for an organization. Permissions required: Edit IQ Elements * @param {string} organizationId Enter the organizationId. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ deleteUserMappingsRaw(requestParameters: SourceControlApiDeleteUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to delete existing SCM user mappings for an organization. Permissions required: Edit IQ Elements */ deleteUserMappings(requestParameters: SourceControlApiDeleteUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Deregister this IQ Server from the SCM webhook relay. Drops the local relay_configuration row and asks the relay to delete the customer record (SQS queue + DynamoDB row). Required before switching auth modes (PAT ↔ GitHub App) since the relay rejects cross-mode switching of an existing customer. Permissions required: System Configuration. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ deregisterFromRelayRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Deregister this IQ Server from the SCM webhook relay. Drops the local relay_configuration row and asks the relay to delete the customer record (SQS queue + DynamoDB row). Required before switching auth modes (PAT ↔ GitHub App) since the relay rejects cross-mode switching of an existing customer. Permissions required: System Configuration. */ deregisterFromRelay(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Returns the App-level webhook URL the customer must paste into the GitHub App configuration. Same value for every customer; available before any registration exists because the URL is needed when creating the App. Permissions required: Manage Automatic SCM Configuration. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ getGitHubAppWebhookUrlRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Returns the App-level webhook URL the customer must paste into the GitHub App configuration. Same value for every customer; available before any registration exists because the URL is needed when creating the App. Permissions required: Manage Automatic SCM Configuration. */ getGitHubAppWebhookUrl(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Returns the per-customer HMAC signing secret used to verify webhook deliveries from the SCM provider, when a PAT-mode relay registration exists. GitHub App registrations have no per-customer secret and return 404. Permissions required: Manage Automatic SCM Configuration. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ getRelayWebhookSecretRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Returns the per-customer HMAC signing secret used to verify webhook deliveries from the SCM provider, when a PAT-mode relay registration exists. GitHub App registrations have no per-customer secret and return 404. Permissions required: Manage Automatic SCM Configuration. */ getRelayWebhookSecret(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Returns the SCM webhook URL the IQ Server is registered against, when the relay integration is enabled and registered. Permissions required: Manage Automatic SCM Configuration. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ getRelayWebhookUrlRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Returns the SCM webhook URL the IQ Server is registered against, when the relay integration is enabled and registered. Permissions required: Manage Automatic SCM Configuration. */ getRelayWebhookUrl(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the source control configuration settings for an organization or an application. Permissions required: View IQ Elements * @param {'application' | 'organization'} ownerType Enter the value for ownerType. * @param {string} internalOwnerId Enter the value for internal ownerId. Use ROOT_ORGANIZATION_ID for the root organization * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ getSourceControl1Raw(requestParameters: SourceControlApiGetSourceControl1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the source control configuration settings for an organization or an application. Permissions required: View IQ Elements */ getSourceControl1(requestParameters: SourceControlApiGetSourceControl1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve SCM user mappings for an organization or application. Permissions required: View IQ Elements * @param {'application' | 'organization'} ownerType Enter the value for ownerType. * @param {string} internalOwnerId Enter the value for internal ownerId. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ getUserMappingsByOwnerRaw(requestParameters: SourceControlApiGetUserMappingsByOwnerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve SCM user mappings for an organization or application. Permissions required: View IQ Elements */ getUserMappingsByOwner(requestParameters: SourceControlApiGetUserMappingsByOwnerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Re-register this IQ Server with the SCM webhook relay. An optional JSON body with installationId and webhookSecret routes the call to the GitHub App registration path; an empty/missing body uses the PAT path. Permissions required: System Configuration. * @param {RelayRegisterAdminRequest} [relayRegisterAdminRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ registerWithRelayRaw(requestParameters: SourceControlApiRegisterWithRelayRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Re-register this IQ Server with the SCM webhook relay. An optional JSON body with installationId and webhookSecret routes the call to the GitHub App registration path; an empty/missing body uses the PAT path. Permissions required: System Configuration. */ registerWithRelay(requestParameters: SourceControlApiRegisterWithRelayRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Rotate the IQ→relay API key. The relay generates a fresh key and keeps the previous key valid for a 5-minute grace window so in-flight polls do not fail. The new plaintext is returned exactly once. Permissions required: System Configuration. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ rotateRelayApiKeyRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Rotate the IQ→relay API key. The relay generates a fresh key and keeps the previous key valid for a 5-minute grace window so in-flight polls do not fail. The new plaintext is returned exactly once. Permissions required: System Configuration. */ rotateRelayApiKey(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Rotate the per-customer PAT webhook signing secret. The relay accepts both old and new signatures during a 5-minute grace window so the SCM provider\'s webhook configuration can be updated without dropping deliveries. The new plaintext is returned exactly once — paste it into the SCM provider\'s webhook secret field. Permissions required: System Configuration. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ rotateRelayWebhookSecretRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Rotate the per-customer PAT webhook signing secret. The relay accepts both old and new signatures during a 5-minute grace window so the SCM provider\'s webhook configuration can be updated without dropping deliveries. The new plaintext is returned exactly once — paste it into the SCM provider\'s webhook secret field. Permissions required: System Configuration. */ rotateRelayWebhookSecret(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to update an existing SCM setting. Permissions required: Edit IQ Elements * @param {'application' | 'organization'} ownerType Enter the value for ownerType. * @param {string} internalOwnerId Enter the internal ownerId. Use ROOT_ORGANIZATION_ID for the root organization. * @param {ApiSourceControlDTO} [apiSourceControlDTO] Specify the SCM settings for the ownerId specified above in the request JSON.<ul><li><code>id</code> is the internal owner ID.</li><li><code>repositoryUrl</code> is the http(s) and ssh urls for the application specified in the ownerId.</li><li><code>username</code> is optional, can be provided for Bitbucket Server and Cloud.</li><li><code>token</code> is optional if inherited. If provided, this value will override the value inherited from the root organization, organization or application level.<li><code>provider</code> is the name of of the SCM system. Allowed values are <code>azure</code>, <code>github</code>, <code>gitlab</code>, and <code>bitbucket</code>.</li><li><code>baseBranch</code> is required for the root organization. Organizations and applications inherit from the root unless overridden.</li><li><code>enablePullRequests</code> has been deprecated in version 124.</li><li><code>remediationPullRequestsEnabled</code> is optional. Set it to `true` to enable the Automated Pull Requests.</li><li><code>enableStatusChecks</code> has been deprecated in version 124.</li><li><code>statusChecksEnabled</code> is an internal field.</li><li><code>pullRequestCommentingEnabled</code> is optional. Set it to `true` to enable the Pull Request Commenting feature.</li><li><code>sourceControlEvaluationsEnabled</code> is set to `true` to enable source control evaluations for the continuous risk profile feature.</li><li><code>sourceControlScanTarget</code> is the path inside the repository.</li><li><code>sshEnabled</code> is set to `true` to enable ssh.</li><li><code>commitStatusEnabled</code> is set to `true` if interaction with the commit statuses on the SCM is enabled.</li></ul> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlApiInterface */ updateSourceControlRaw(requestParameters: SourceControlApiUpdateSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to update an existing SCM setting. Permissions required: Edit IQ Elements */ updateSourceControl(requestParameters: SourceControlApiUpdateSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class SourceControlApi extends runtime.BaseAPI implements SourceControlApiInterface { /** * Use this method to create a source control configuration setting. Permissions required: Edit IQ Elements */ async addSourceControlRaw(requestParameters: SourceControlApiAddSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling addSourceControl().' ); } if (requestParameters['internalOwnerId'] == null) { throw new runtime.RequiredError( 'internalOwnerId', 'Required parameter "internalOwnerId" was null or undefined when calling addSourceControl().' ); } 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/sourceControl/{ownerType}/{internalOwnerId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"internalOwnerId"}}`, encodeURIComponent(String(requestParameters['internalOwnerId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiSourceControlDTOToJSON(requestParameters['apiSourceControlDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiSourceControlDTOFromJSON(jsonValue)); } /** * Use this method to create a source control configuration setting. Permissions required: Edit IQ Elements */ async addSourceControl(requestParameters: SourceControlApiAddSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addSourceControlRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to apply user mappings from SCM (GitHub) to Lifecycle. The user mappings will be inherited by all child organizations and applications in the organization hierarchy. If a user mapping for an organization already exists, it will be replaced with new mappings provided here. Permissions required: Edit IQ Elements */ async addUserMappingsRaw(requestParameters: SourceControlApiAddUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['organizationId'] == null) { throw new runtime.RequiredError( 'organizationId', 'Required parameter "organizationId" was null or undefined when calling addUserMappings().' ); } 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/sourceControl/automaticRoleAssignment/userMappings/{organizationId}`; urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: SCMUserMappingsDTOToJSON(requestParameters['sCMUserMappingsDTO']), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to apply user mappings from SCM (GitHub) to Lifecycle. The user mappings will be inherited by all child organizations and applications in the organization hierarchy. If a user mapping for an organization already exists, it will be replaced with new mappings provided here. Permissions required: Edit IQ Elements */ async addUserMappings(requestParameters: SourceControlApiAddUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.addUserMappingsRaw(requestParameters, initOverrides); } /** * Use this method to automatically grant the supplied role to all contributors of a repository on a given application. Prerequisites for automatic role assignment are:
  1. SCM configuration for the application and authentication token should exist.
  2. The contributors to the repository should match a user in IQ based on the supplied mappings.
  3. Either user mapping strategies have been configured for your organization, or they are provided in the request
Permissions required: Edit access control on the application. */ async automaticRoleAssignmentRaw(requestParameters: SourceControlApiAutomaticRoleAssignmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['publicId'] == null) { throw new runtime.RequiredError( 'publicId', 'Required parameter "publicId" was null or undefined when calling automaticRoleAssignment().' ); } 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/sourceControl/automaticRoleAssignment/{publicId}`; urlPath = urlPath.replace(`{${"publicId"}}`, encodeURIComponent(String(requestParameters['publicId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: SCMUserMappingsDTOToJSON(requestParameters['sCMUserMappingsDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SCMUserMatchingResultDTOFromJSON(jsonValue)); } /** * Use this method to automatically grant the supplied role to all contributors of a repository on a given application. Prerequisites for automatic role assignment are:
  1. SCM configuration for the application and authentication token should exist.
  2. The contributors to the repository should match a user in IQ based on the supplied mappings.
  3. Either user mapping strategies have been configured for your organization, or they are provided in the request
Permissions required: Edit access control on the application. */ async automaticRoleAssignment(requestParameters: SourceControlApiAutomaticRoleAssignmentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.automaticRoleAssignmentRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to delete a SCM setting for the specified ownerType/ownerId. Permissions required: Edit IQ Elements */ async deleteSourceControlRaw(requestParameters: SourceControlApiDeleteSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling deleteSourceControl().' ); } if (requestParameters['internalOwnerId'] == null) { throw new runtime.RequiredError( 'internalOwnerId', 'Required parameter "internalOwnerId" was null or undefined when calling deleteSourceControl().' ); } 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/sourceControl/{ownerType}/{internalOwnerId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"internalOwnerId"}}`, encodeURIComponent(String(requestParameters['internalOwnerId']))); const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to delete a SCM setting for the specified ownerType/ownerId. Permissions required: Edit IQ Elements */ async deleteSourceControl(requestParameters: SourceControlApiDeleteSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteSourceControlRaw(requestParameters, initOverrides); } /** * Use this method to delete existing SCM user mappings for an organization. Permissions required: Edit IQ Elements */ async deleteUserMappingsRaw(requestParameters: SourceControlApiDeleteUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['organizationId'] == null) { throw new runtime.RequiredError( 'organizationId', 'Required parameter "organizationId" was null or undefined when calling deleteUserMappings().' ); } 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/sourceControl/automaticRoleAssignment/userMappings/{organizationId}`; urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))); const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to delete existing SCM user mappings for an organization. Permissions required: Edit IQ Elements */ async deleteUserMappings(requestParameters: SourceControlApiDeleteUserMappingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteUserMappingsRaw(requestParameters, initOverrides); } /** * Deregister this IQ Server from the SCM webhook relay. Drops the local relay_configuration row and asks the relay to delete the customer record (SQS queue + DynamoDB row). Required before switching auth modes (PAT ↔ GitHub App) since the relay rejects cross-mode switching of an existing customer. Permissions required: System Configuration. */ async deregisterFromRelayRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/sourceControl/relay/deregister`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Deregister this IQ Server from the SCM webhook relay. Drops the local relay_configuration row and asks the relay to delete the customer record (SQS queue + DynamoDB row). Required before switching auth modes (PAT ↔ GitHub App) since the relay rejects cross-mode switching of an existing customer. Permissions required: System Configuration. */ async deregisterFromRelay(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deregisterFromRelayRaw(initOverrides); } /** * Returns the App-level webhook URL the customer must paste into the GitHub App configuration. Same value for every customer; available before any registration exists because the URL is needed when creating the App. Permissions required: Manage Automatic SCM Configuration. */ async getGitHubAppWebhookUrlRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/sourceControl/githubAppWebhookUrl`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Returns the App-level webhook URL the customer must paste into the GitHub App configuration. Same value for every customer; available before any registration exists because the URL is needed when creating the App. Permissions required: Manage Automatic SCM Configuration. */ async getGitHubAppWebhookUrl(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.getGitHubAppWebhookUrlRaw(initOverrides); } /** * Returns the per-customer HMAC signing secret used to verify webhook deliveries from the SCM provider, when a PAT-mode relay registration exists. GitHub App registrations have no per-customer secret and return 404. Permissions required: Manage Automatic SCM Configuration. */ async getRelayWebhookSecretRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/sourceControl/relayWebhookSecret`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Returns the per-customer HMAC signing secret used to verify webhook deliveries from the SCM provider, when a PAT-mode relay registration exists. GitHub App registrations have no per-customer secret and return 404. Permissions required: Manage Automatic SCM Configuration. */ async getRelayWebhookSecret(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.getRelayWebhookSecretRaw(initOverrides); } /** * Returns the SCM webhook URL the IQ Server is registered against, when the relay integration is enabled and registered. Permissions required: Manage Automatic SCM Configuration. */ async getRelayWebhookUrlRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/sourceControl/relayWebhookUrl`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Returns the SCM webhook URL the IQ Server is registered against, when the relay integration is enabled and registered. Permissions required: Manage Automatic SCM Configuration. */ async getRelayWebhookUrl(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.getRelayWebhookUrlRaw(initOverrides); } /** * Use this method to retrieve the source control configuration settings for an organization or an application. Permissions required: View IQ Elements */ async getSourceControl1Raw(requestParameters: SourceControlApiGetSourceControl1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getSourceControl1().' ); } if (requestParameters['internalOwnerId'] == null) { throw new runtime.RequiredError( 'internalOwnerId', 'Required parameter "internalOwnerId" was null or undefined when calling getSourceControl1().' ); } 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/sourceControl/{ownerType}/{internalOwnerId}`; 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.JSONApiResponse(response, (jsonValue) => ApiSourceControlDTOFromJSON(jsonValue)); } /** * Use this method to retrieve the source control configuration settings for an organization or an application. Permissions required: View IQ Elements */ async getSourceControl1(requestParameters: SourceControlApiGetSourceControl1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getSourceControl1Raw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve SCM user mappings for an organization or application. Permissions required: View IQ Elements */ async getUserMappingsByOwnerRaw(requestParameters: SourceControlApiGetUserMappingsByOwnerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getUserMappingsByOwner().' ); } if (requestParameters['internalOwnerId'] == null) { throw new runtime.RequiredError( 'internalOwnerId', 'Required parameter "internalOwnerId" was null or undefined when calling getUserMappingsByOwner().' ); } 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/sourceControl/automaticRoleAssignment/userMappings/{ownerType}/{internalOwnerId}`; 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.JSONApiResponse(response, (jsonValue) => SCMUserMappingsResponseDTOFromJSON(jsonValue)); } /** * Use this method to retrieve SCM user mappings for an organization or application. Permissions required: View IQ Elements */ async getUserMappingsByOwner(requestParameters: SourceControlApiGetUserMappingsByOwnerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getUserMappingsByOwnerRaw(requestParameters, initOverrides); return await response.value(); } /** * Re-register this IQ Server with the SCM webhook relay. An optional JSON body with installationId and webhookSecret routes the call to the GitHub App registration path; an empty/missing body uses the PAT path. Permissions required: System Configuration. */ async registerWithRelayRaw(requestParameters: SourceControlApiRegisterWithRelayRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/sourceControl/relay/register`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: RelayRegisterAdminRequestToJSON(requestParameters['relayRegisterAdminRequest']), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Re-register this IQ Server with the SCM webhook relay. An optional JSON body with installationId and webhookSecret routes the call to the GitHub App registration path; an empty/missing body uses the PAT path. Permissions required: System Configuration. */ async registerWithRelay(requestParameters: SourceControlApiRegisterWithRelayRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.registerWithRelayRaw(requestParameters, initOverrides); } /** * Rotate the IQ→relay API key. The relay generates a fresh key and keeps the previous key valid for a 5-minute grace window so in-flight polls do not fail. The new plaintext is returned exactly once. Permissions required: System Configuration. */ async rotateRelayApiKeyRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/sourceControl/relay/rotate-key`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Rotate the IQ→relay API key. The relay generates a fresh key and keeps the previous key valid for a 5-minute grace window so in-flight polls do not fail. The new plaintext is returned exactly once. Permissions required: System Configuration. */ async rotateRelayApiKey(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.rotateRelayApiKeyRaw(initOverrides); } /** * Rotate the per-customer PAT webhook signing secret. The relay accepts both old and new signatures during a 5-minute grace window so the SCM provider\'s webhook configuration can be updated without dropping deliveries. The new plaintext is returned exactly once — paste it into the SCM provider\'s webhook secret field. Permissions required: System Configuration. */ async rotateRelayWebhookSecretRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/sourceControl/relay/rotate-webhook-secret`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Rotate the per-customer PAT webhook signing secret. The relay accepts both old and new signatures during a 5-minute grace window so the SCM provider\'s webhook configuration can be updated without dropping deliveries. The new plaintext is returned exactly once — paste it into the SCM provider\'s webhook secret field. Permissions required: System Configuration. */ async rotateRelayWebhookSecret(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.rotateRelayWebhookSecretRaw(initOverrides); } /** * Use this method to update an existing SCM setting. Permissions required: Edit IQ Elements */ async updateSourceControlRaw(requestParameters: SourceControlApiUpdateSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling updateSourceControl().' ); } if (requestParameters['internalOwnerId'] == null) { throw new runtime.RequiredError( 'internalOwnerId', 'Required parameter "internalOwnerId" was null or undefined when calling updateSourceControl().' ); } 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/sourceControl/{ownerType}/{internalOwnerId}`; 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: ApiSourceControlDTOToJSON(requestParameters['apiSourceControlDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiSourceControlDTOFromJSON(jsonValue)); } /** * Use this method to update an existing SCM setting. Permissions required: Edit IQ Elements */ async updateSourceControl(requestParameters: SourceControlApiUpdateSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateSourceControlRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const AddSourceControlOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type AddSourceControlOwnerTypeEnum = typeof AddSourceControlOwnerTypeEnum[keyof typeof AddSourceControlOwnerTypeEnum]; /** * @export */ export const DeleteSourceControlOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type DeleteSourceControlOwnerTypeEnum = typeof DeleteSourceControlOwnerTypeEnum[keyof typeof DeleteSourceControlOwnerTypeEnum]; /** * @export */ export const GetSourceControl1OwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type GetSourceControl1OwnerTypeEnum = typeof GetSourceControl1OwnerTypeEnum[keyof typeof GetSourceControl1OwnerTypeEnum]; /** * @export */ export const GetUserMappingsByOwnerOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type GetUserMappingsByOwnerOwnerTypeEnum = typeof GetUserMappingsByOwnerOwnerTypeEnum[keyof typeof GetUserMappingsByOwnerOwnerTypeEnum]; /** * @export */ export const UpdateSourceControlOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type UpdateSourceControlOwnerTypeEnum = typeof UpdateSourceControlOwnerTypeEnum[keyof typeof UpdateSourceControlOwnerTypeEnum];