AlertRestClient class
Base class that should be used (derived from) to make requests to VSS REST apis
- Extends
Constructors
| Alert |
Methods
| create |
Create legal review. This creates the legal review associated with the alert. It include the review work item url. |
| get |
Get an alert. |
| get |
Get instances of an alert on a branch specified with @ref. If @ref is not provided, return instances of an alert on default branch(if the alert exist in default branch) or latest affected branch. |
| get |
Get alerts for a repository |
| get |
Get an alert. |
| get |
Returns the branches for which analysis results were submitted. |
| get |
Get alerts by their IDs at the organization level. Only retruns alerts that the user has permission to view. Only returns alerts of sku plans that are enabled. |
| get |
Get the status of the Sarif processing job |
| get |
|
| get |
Get the validity details for an alert. |
| initiate |
Initiate the validation process for a given alert |
| update |
Update the status of an alert |
| update |
Update alert metadata associations. |
| upload |
Upload a Sarif file at the organization level |
| upload |
Upload a Sarif containing security alerts |
Constructor Details
AlertRestClient(IVssRestClientOptions)
Method Details
createLegalReview(string, string, number, string)
Create legal review. This creates the legal review associated with the alert. It include the review work item url.
function createLegalReview(project: string, repository: string, alertId: number, ref?: string): Promise<LegalReview>
Parameters
- project
-
string
Project ID or project name
- repository
-
string
Name or id of a repository for the legal alert
- alertId
-
number
Advance Security alert id of the legal alert to get the legal review
- ref
-
string
Returns
Promise<LegalReview>
getAlert(string, number, string, string, ExpandOption)
Get an alert.
function getAlert(project: string, alertId: number, repository: string, ref?: string, expand?: ExpandOption): Promise<Alert>
Parameters
- project
-
string
Project ID or project name
- alertId
-
number
ID of alert to retrieve
- repository
-
string
Name or id of a repository that alert is part of
- ref
-
string
- expand
- ExpandOption
Expand attributes of a secret alert. Possible values are None and ValidationFingerprint. Defaults to None. Be aware that if expand is set to ValidationFingerprint, the response may contain the secret in its unencrypted form. Please exercise caution when using this data.
Returns
Promise<Alert>
getAlertInstances(string, number, string, string)
Get instances of an alert on a branch specified with @ref. If @ref is not provided, return instances of an alert on default branch(if the alert exist in default branch) or latest affected branch.
function getAlertInstances(project: string, alertId: number, repository: string, ref?: string): Promise<AlertAnalysisInstance[]>
Parameters
- project
-
string
Project ID or project name
- alertId
-
number
ID of alert to retrieve
- repository
-
string
Name or id of a repository that alert is part of
- ref
-
string
Returns
Promise<AlertAnalysisInstance[]>
getAlerts(string, string, number, string, SearchCriteria, AlertListExpandOption, string)
Get alerts for a repository
function getAlerts(project: string, repository: string, top?: number, orderBy?: string, criteria?: SearchCriteria, expand?: AlertListExpandOption, continuationToken?: string): Promise<PagedList<Alert>>
Parameters
- project
-
string
Project ID or project name
- repository
-
string
The name or ID of the repository
- top
-
number
The maximum number of alerts to return
- orderBy
-
string
Must be "id" "firstSeen" "lastSeen" "fixedOn" or "severity" Defaults to "id"
- criteria
- SearchCriteria
Options to limit the alerts returned
- expand
- AlertListExpandOption
- continuationToken
-
string
If there are more alerts than can be returned, a continuation token is placed in the "x-ms-continuationtoken" header. Use that token here to get the next page of alerts
Returns
getAlertSarif(string, number, string, string, ExpandOption)
Get an alert.
function getAlertSarif(project: string, alertId: number, repository: string, ref?: string, expand?: ExpandOption): Promise<string>
Parameters
- project
-
string
Project ID or project name
- alertId
-
number
ID of alert to retrieve
- repository
-
string
Name or id of a repository that alert is part of
- ref
-
string
- expand
- ExpandOption
Expand attributes of a secret alert. Possible values are None and ValidationFingerprint. Defaults to None. Be aware that if expand is set to ValidationFingerprint, the response may contain the secret in its unencrypted form. Please exercise caution when using this data.
Returns
Promise<string>
getBranches(string, string, AlertType, string, string, number, boolean)
Returns the branches for which analysis results were submitted.
function getBranches(project: string, repository: string, alertType: AlertType, continuationToken?: string, branchNameContains?: string, top?: number, includePullRequestBranches?: boolean): Promise<Branch[]>
Parameters
- project
-
string
Project ID or project name
- repository
-
string
- alertType
- AlertType
The type of alert: Dependency Scanning (1), Secret (2), Code QL (3), etc.
- continuationToken
-
string
A string variable that represents the branch name and is used to fetch branches that follow it in alphabetical order.
- branchNameContains
-
string
A string variable used to fetch branches that contain this string anywhere in the branch name, case insensitive.
- top
-
number
An int variable used to return the top k branches that satisfy the search criteria.
- includePullRequestBranches
-
boolean
A bool variable indicating whether or not to include pull request branches.
Returns
Promise<Branch[]>
getOrgLevelAlertsByIds(number[])
Get alerts by their IDs at the organization level. Only retruns alerts that the user has permission to view. Only returns alerts of sku plans that are enabled.
function getOrgLevelAlertsByIds(alertIds: number[]): Promise<Alert[]>
Parameters
- alertIds
-
number[]
List of alert IDs to retrieve
Returns
Promise<Alert[]>
getSarif(number)
Get the status of the Sarif processing job
function getSarif(sarifId: number): Promise<SarifUploadStatus>
Parameters
- sarifId
-
number
Sarif ID returned when the Sarif was uploaded
Returns
Promise<SarifUploadStatus>
getUxFilters(string, string, AlertType)
getValidityData(string, string, number)
Get the validity details for an alert.
function getValidityData(project: string, repository: string, alertId: number): Promise<ValidationRequestInfo>
Parameters
- project
-
string
Project ID or project name
- repository
-
string
The name or ID of a repository
- alertId
-
number
The ID of the alert
Returns
Promise<ValidationRequestInfo>
initiateValidation(string, string, number)
Initiate the validation process for a given alert
function initiateValidation(project: string, repository: string, alertId: number): Promise<AlertValidationRequestStatus>
Parameters
- project
-
string
Project ID or project name
- repository
-
string
The name or ID of a repository
- alertId
-
number
The ID of the alert
Returns
Promise<AlertValidationRequestStatus>
updateAlert(AlertStateUpdate, string, number, string)
Update the status of an alert
function updateAlert(stateUpdate: AlertStateUpdate, project: string, alertId: number, repository: string): Promise<Alert>
Parameters
- stateUpdate
- AlertStateUpdate
The new status of the alert
- project
-
string
Project ID or project name
- alertId
-
number
The ID of the alert
- repository
-
string
The name or ID of the repository
Returns
Promise<Alert>
updateAlertsMetadata(AlertMetadata[], string, string)
Update alert metadata associations.
function updateAlertsMetadata(alertsMetadata: AlertMetadata[], project: string, repository: string): Promise<AlertMetadataChange[]>
Parameters
- alertsMetadata
A list of metadata to associate with alerts.
- project
-
string
Project ID or project name
- repository
-
string
The name or ID of the repository.
Returns
Promise<AlertMetadataChange[]>
uploadOrgSarif(string)
Upload a Sarif file at the organization level
function uploadOrgSarif(content: string): Promise<number>
Parameters
- content
-
string
Content to upload
Returns
Promise<number>
uploadSarif(string, string, string, String)
Upload a Sarif containing security alerts
function uploadSarif(content: string, project: string, repository: string, notificationFlag?: String): Promise<number>
Parameters
- content
-
string
Content to upload
- project
-
string
Project ID or project name
- repository
-
string
The name or ID of a repository
- notificationFlag
-
String
Header to signal that this is a progress notification
Returns
Promise<number>