Skip to content

Commit bf07d23

Browse files
Update Advanced Security API clients (#582)
* Update Advanced Security API clients * Bump version from `12.2.0` to `12.3.0`
1 parent 3d89f1a commit bf07d23

File tree

4 files changed

+67
-11
lines changed

4 files changed

+67
-11
lines changed

api/AlertApi.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface IAlertApi extends basem.ClientApiBase {
2525
getAlertInstances(project: string, alertId: number, repository: string, ref?: string): Promise<AlertInterfaces.AlertAnalysisInstance[]>;
2626
uploadSarif(customHeaders: any, contentStream: NodeJS.ReadableStream, project: string, repository: string): Promise<number>;
2727
getUxFilters(project: string, repository: string, alertType: AlertInterfaces.AlertType): Promise<AlertInterfaces.UxFilters>;
28-
getSarif(sarifId: number): Promise<boolean>;
28+
getSarif(sarifId: number): Promise<AlertInterfaces.SarifUploadStatus>;
2929
}
3030

3131
export class AlertApi extends basem.ClientApiBase implements IAlertApi {
@@ -257,9 +257,11 @@ export class AlertApi extends basem.ClientApiBase implements IAlertApi {
257257
}
258258

259259
/**
260+
* Get instances of an alert.
261+
*
260262
* @param {string} project - Project ID or project name
261-
* @param {number} alertId
262-
* @param {string} repository
263+
* @param {number} alertId - ID of alert to retrieve
264+
* @param {string} repository - Name or id of a repository that alert is part of
263265
* @param {string} ref
264266
*/
265267
public async getAlertInstances(
@@ -418,16 +420,16 @@ export class AlertApi extends basem.ClientApiBase implements IAlertApi {
418420
*/
419421
public async getSarif(
420422
sarifId: number
421-
): Promise<boolean> {
423+
): Promise<AlertInterfaces.SarifUploadStatus> {
422424

423-
return new Promise<boolean>(async (resolve, reject) => {
425+
return new Promise<AlertInterfaces.SarifUploadStatus>(async (resolve, reject) => {
424426
let routeValues: any = {
425427
sarifId: sarifId
426428
};
427429

428430
try {
429431
let verData: vsom.ClientVersioningData = await this.vsoClient.getVersioningData(
430-
"7.2-preview.1",
432+
"7.2-preview.2",
431433
"Alert",
432434
"a04689e7-0f81-48a2-8d18-40654c47494c",
433435
routeValues);
@@ -436,11 +438,11 @@ export class AlertApi extends basem.ClientApiBase implements IAlertApi {
436438
let options: restm.IRequestOptions = this.createRequestOptions('application/json',
437439
verData.apiVersion);
438440

439-
let res: restm.IRestResponse<boolean>;
440-
res = await this.rest.get<boolean>(url, options);
441+
let res: restm.IRestResponse<AlertInterfaces.SarifUploadStatus>;
442+
res = await this.rest.get<AlertInterfaces.SarifUploadStatus>(url, options);
441443

442444
let ret = this.formatResponse(res.result,
443-
null,
445+
AlertInterfaces.TypeInfo.SarifUploadStatus,
444446
false);
445447

446448
resolve(ret);

api/ManagementApi.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ export class ManagementApi extends basem.ClientApiBase implements IManagementApi
4242
}
4343

4444
/**
45+
* Delete the billing info for an organization.
46+
*
4547
* @param {string} organizationId
4648
*/
4749
public async deleteBillingInfo(
@@ -82,6 +84,8 @@ export class ManagementApi extends basem.ClientApiBase implements IManagementApi
8284
}
8385

8486
/**
87+
* Delete the meter usage history from Primary SU for an organization.
88+
*
8589
* @param {string} organizationId
8690
*/
8791
public async deleteMeterUsageHistory(
@@ -164,6 +168,8 @@ export class ManagementApi extends basem.ClientApiBase implements IManagementApi
164168
}
165169

166170
/**
171+
* Save the billing info for an organization.
172+
*
167173
* @param {ManagementInterfaces.BillingInfo} billingInfo
168174
* @param {string} organizationId
169175
*/

api/interfaces/AlertInterfaces.ts

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export interface Alert {
7979
*/
8080
truncatedSecret?: string;
8181
/**
82-
* ValidationFingerprints for the secret liveness check. Only return on demanded
82+
* ValidationFingerprints for the secret liveness check. Only returned on demand in Get API with Expand parameter set to be ValidationFingerprint (not returned in List API)
8383
*/
8484
validationFingerprints?: ValidationFingerprint[];
8585
}
@@ -287,6 +287,9 @@ export enum ComponentType {
287287
* Indicates the component is a loose file. Not a package as understood by different package managers.
288288
*/
289289
File = 9,
290+
/**
291+
* Indicates the component is a Go package.
292+
*/
290293
Go = 10,
291294
/**
292295
* Indicates the component is a Docker Image
@@ -578,6 +581,35 @@ export interface Rule {
578581
tags?: string[];
579582
}
580583

584+
export enum SarifJobStatus {
585+
/**
586+
* The job type when it is new
587+
*/
588+
New = 0,
589+
/**
590+
* The job type when it is queued
591+
*/
592+
Queued = 1,
593+
/**
594+
* The job type when it is completed
595+
*/
596+
Completed = 2,
597+
/**
598+
* The job type when it fails
599+
*/
600+
Failed = 3,
601+
}
602+
603+
export interface SarifUploadStatus {
604+
errors?: SarifValidationError[];
605+
processingStatus?: SarifJobStatus;
606+
}
607+
608+
export interface SarifValidationError {
609+
nodePointer?: string;
610+
validationError?: string;
611+
}
612+
581613
export interface SearchCriteria {
582614
/**
583615
* If provided, only return alerts of this type. Otherwise, return alerts of all types.
@@ -877,6 +909,16 @@ export var TypeInfo = {
877909
"versionControl": 2
878910
}
879911
},
912+
SarifJobStatus: {
913+
enumValues: {
914+
"new": 0,
915+
"queued": 1,
916+
"completed": 2,
917+
"failed": 3
918+
}
919+
},
920+
SarifUploadStatus: <any>{
921+
},
880922
SearchCriteria: <any>{
881923
},
882924
Severity: {
@@ -1027,6 +1069,12 @@ TypeInfo.Result.fields = {
10271069
}
10281070
};
10291071

1072+
TypeInfo.SarifUploadStatus.fields = {
1073+
processingStatus: {
1074+
enumType: TypeInfo.SarifJobStatus
1075+
}
1076+
};
1077+
10301078
TypeInfo.SearchCriteria.fields = {
10311079
alertType: {
10321080
enumType: TypeInfo.AlertType

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "azure-devops-node-api",
33
"description": "Node client for Azure DevOps and TFS REST APIs",
4-
"version": "12.3.0",
4+
"version": "12.4.0",
55
"main": "./WebApi.js",
66
"types": "./WebApi.d.ts",
77
"scripts": {

0 commit comments

Comments
 (0)