AlertRestClient class

应使用基类(派生自)向 VSS REST API 发出请求

扩展

构造函数

AlertRestClient(IVssRestClientOptions)

方法

createLegalReview(string, string, number, string)

创建法律审核。 这将创建与警报关联的法律审核。 它包括评审工作项 URL。

getAlert(string, number, string, string, ExpandOption)

获取警报。

getAlertInstances(string, number, string, string)

获取使用 @ref指定的分支上的警报实例。如果未提供 @ref,则返回默认分支(如果默认分支中存在警报)或最新受影响的分支上的警报实例。

getAlerts(string, string, number, string, SearchCriteria, AlertListExpandOption, string)

获取存储库的警报

getAlertSarif(string, number, string, string, ExpandOption)

获取警报。

getBranches(string, string, AlertType, string, string, number, boolean)

返回提交分析结果的分支。

getSarif(number)

获取 Sarif 处理作业的状态

getUxFilters(string, string, AlertType)
getValidityData(string, string, number)

获取警报的有效性详细信息。

initiateValidation(string, string, number)

启动给定警报的验证过程

updateAlert(AlertStateUpdate, string, number, string)

更新警报的状态

updateAlertsMetadata(AlertMetadata[], string, string)

更新警报元数据关联。

uploadSarif(string, string, string, String)

上传包含安全警报的 Sarif

构造函数详细信息

AlertRestClient(IVssRestClientOptions)

new AlertRestClient(options: IVssRestClientOptions)

参数

方法详细信息

createLegalReview(string, string, number, string)

创建法律审核。 这将创建与警报关联的法律审核。 它包括评审工作项 URL。

function createLegalReview(project: string, repository: string, alertId: number, ref?: string): Promise<LegalReview>

参数

project

string

项目 ID 或项目名称

repository

string

法律警报的存储库的名称或 ID

alertId

number

高级安全警报 ID 法律警报以获取法律审查

ref

string

返回

Promise<LegalReview>

getAlert(string, number, string, string, ExpandOption)

获取警报。

function getAlert(project: string, alertId: number, repository: string, ref?: string, expand?: ExpandOption): Promise<Alert>

参数

project

string

项目 ID 或项目名称

alertId

number

要检索的警报的 ID

repository

string

警报所属存储库的名称或 ID

ref

string

expand
ExpandOption

展开警报属性。 可能的选项为 {ValidationFingerprint, None}

返回

Promise<Alert>

getAlertInstances(string, number, string, string)

获取使用 @ref指定的分支上的警报实例。如果未提供 @ref,则返回默认分支(如果默认分支中存在警报)或最新受影响的分支上的警报实例。

function getAlertInstances(project: string, alertId: number, repository: string, ref?: string): Promise<AlertAnalysisInstance[]>

参数

project

string

项目 ID 或项目名称

alertId

number

要检索的警报的 ID

repository

string

警报所属存储库的名称或 ID

ref

string

返回

getAlerts(string, string, number, string, SearchCriteria, AlertListExpandOption, string)

获取存储库的警报

function getAlerts(project: string, repository: string, top?: number, orderBy?: string, criteria?: SearchCriteria, expand?: AlertListExpandOption, continuationToken?: string): Promise<PagedList<Alert>>

参数

project

string

项目 ID 或项目名称

repository

string

存储库的名称或 ID

top

number

要返回的最大警报数

orderBy

string

必须是“id” “firstSeen” “lastSeen” “fixedOn” 或 “severity” 默认值为“id”

criteria
SearchCriteria

用于限制返回的警报的选项

continuationToken

string

如果警报多于可以返回,则延续标记将放置在“x-ms-continuationtoken”标头中。 在此处使用该令牌获取下一页警报

返回

Promise<PagedList<Alert>>

getAlertSarif(string, number, string, string, ExpandOption)

获取警报。

function getAlertSarif(project: string, alertId: number, repository: string, ref?: string, expand?: ExpandOption): Promise<string>

参数

project

string

项目 ID 或项目名称

alertId

number

要检索的警报的 ID

repository

string

警报所属存储库的名称或 ID

ref

string

expand
ExpandOption

展开警报属性。 可能的选项为 {ValidationFingerprint, None}

返回

Promise<string>

getBranches(string, string, AlertType, string, string, number, boolean)

返回提交分析结果的分支。

function getBranches(project: string, repository: string, alertType: AlertType, continuationToken?: string, branchNameContains?: string, top?: number, includePullRequestBranches?: boolean): Promise<Branch[]>

参数

project

string

项目 ID 或项目名称

repository

string

alertType
AlertType

警报类型:依赖项扫描(1)、机密(2)、代码 QL(3)等。

continuationToken

string

表示分支名称的字符串变量,用于提取按字母顺序排列的分支。

branchNameContains

string

一个字符串变量,用于提取分支名称中的任何位置包含此字符串的分支,不区分大小写。

top

number

用于返回满足搜索条件的前 k 分支的 int 变量。

includePullRequestBranches

boolean

一个布尔变量,指示是否包含拉取请求分支。

返回

Promise<Branch[]>

getSarif(number)

获取 Sarif 处理作业的状态

function getSarif(sarifId: number): Promise<SarifUploadStatus>

参数

sarifId

number

在上传 Sarif 时返回 Sarif ID

返回

getUxFilters(string, string, AlertType)

function getUxFilters(project: string, repository: string, alertType: AlertType): Promise<UxFilters>

参数

project

string

项目 ID 或项目名称

repository

string

alertType
AlertType

返回

Promise<UxFilters>

getValidityData(string, string, number)

获取警报的有效性详细信息。

function getValidityData(project: string, repository: string, alertId: number): Promise<ValidationRequestInfo>

参数

project

string

项目 ID 或项目名称

repository

string

存储库的名称或 ID

alertId

number

警报的 ID

返回

initiateValidation(string, string, number)

启动给定警报的验证过程

function initiateValidation(project: string, repository: string, alertId: number): Promise<AlertValidationRequestStatus>

参数

project

string

项目 ID 或项目名称

repository

string

存储库的名称或 ID

alertId

number

警报的 ID

返回

updateAlert(AlertStateUpdate, string, number, string)

更新警报的状态

function updateAlert(stateUpdate: AlertStateUpdate, project: string, alertId: number, repository: string): Promise<Alert>

参数

stateUpdate
AlertStateUpdate

警报的新状态

project

string

项目 ID 或项目名称

alertId

number

警报的 ID

repository

string

存储库的名称或 ID

返回

Promise<Alert>

updateAlertsMetadata(AlertMetadata[], string, string)

更新警报元数据关联。

function updateAlertsMetadata(alertsMetadata: AlertMetadata[], project: string, repository: string): Promise<AlertMetadataChange[]>

参数

alertsMetadata

AlertMetadata[]

要与警报关联的元数据列表。

project

string

项目 ID 或项目名称

repository

string

存储库的名称或 ID。

返回

Promise<AlertMetadataChange[]>

uploadSarif(string, string, string, String)

上传包含安全警报的 Sarif

function uploadSarif(content: string, project: string, repository: string, notificationFlag?: String): Promise<number>

参数

content

string

要上传的内容

project

string

项目 ID 或项目名称

repository

string

存储库的名称或 ID

notificationFlag

String

指示这是进度通知的标头

返回

Promise<number>