azure-devops-extension-api 4.227.0 → 4.228.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,278 @@
1
+ /*
2
+ * ---------------------------------------------------------
3
+ * Copyright(C) Microsoft Corporation. All rights reserved.
4
+ * ---------------------------------------------------------
5
+ */
6
+ var __extends = (this && this.__extends) || (function () {
7
+ var extendStatics = Object.setPrototypeOf ||
8
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
9
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
10
+ return function (d, b) {
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (_) try {
31
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ define(["require", "exports", "../Common/RestClientBase", "../Common/Util/Serialization"], function (require, exports, RestClientBase_1, Serialization_1) {
52
+ "use strict";
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ var AlertRestClient = /** @class */ (function (_super) {
55
+ __extends(AlertRestClient, _super);
56
+ function AlertRestClient(options) {
57
+ return _super.call(this, options) || this;
58
+ }
59
+ /**
60
+ * @param project - Project ID or project name
61
+ * @param alertId -
62
+ * @param repository -
63
+ * @param ref -
64
+ */
65
+ AlertRestClient.prototype.getAlert = function (project, alertId, repository, ref) {
66
+ return __awaiter(this, void 0, void 0, function () {
67
+ var queryValues;
68
+ return __generator(this, function (_a) {
69
+ queryValues = {
70
+ ref: ref
71
+ };
72
+ return [2 /*return*/, this.beginRequest({
73
+ apiVersion: "7.2-preview.1",
74
+ routeTemplate: "{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",
75
+ routeValues: {
76
+ project: project,
77
+ alertId: alertId,
78
+ repository: repository
79
+ },
80
+ queryParams: queryValues
81
+ })];
82
+ });
83
+ });
84
+ };
85
+ /**
86
+ * Get alerts for a repository
87
+ *
88
+ * @param project - Project ID or project name
89
+ * @param repository - The name or ID of the repository
90
+ * @param top - The maximum number of alerts to return
91
+ * @param orderBy - Must be "id" "firstSeen" "lastSeen" "fixedOn" or "severity" Defaults to "id"
92
+ * @param criteria - Options to limit the alerts returned
93
+ * @param continuationToken - 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
94
+ */
95
+ AlertRestClient.prototype.getAlerts = function (project, repository, top, orderBy, criteria, continuationToken) {
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ var queryValues;
98
+ var _this = this;
99
+ return __generator(this, function (_a) {
100
+ queryValues = {
101
+ top: top,
102
+ orderBy: orderBy,
103
+ criteria: criteria,
104
+ continuationToken: continuationToken
105
+ };
106
+ return [2 /*return*/, this.beginRequest({
107
+ apiVersion: "7.2-preview.1",
108
+ routeTemplate: "{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",
109
+ routeValues: {
110
+ project: project,
111
+ repository: repository
112
+ },
113
+ queryParams: queryValues,
114
+ returnRawResponse: true
115
+ }).then(function (response) { return __awaiter(_this, void 0, void 0, function () {
116
+ var body;
117
+ return __generator(this, function (_a) {
118
+ switch (_a.label) {
119
+ case 0: return [4 /*yield*/, response.text().then(Serialization_1.deserializeVssJsonObject)];
120
+ case 1:
121
+ body = _a.sent();
122
+ body.continuationToken = response.headers.get("x-ms-continuationtoken");
123
+ return [2 /*return*/, body];
124
+ }
125
+ });
126
+ }); })];
127
+ });
128
+ });
129
+ };
130
+ /**
131
+ * @param project - Project ID or project name
132
+ * @param alertId -
133
+ * @param repository -
134
+ * @param ref -
135
+ */
136
+ AlertRestClient.prototype.getAlertSarif = function (project, alertId, repository, ref) {
137
+ return __awaiter(this, void 0, void 0, function () {
138
+ var queryValues;
139
+ return __generator(this, function (_a) {
140
+ queryValues = {
141
+ ref: ref
142
+ };
143
+ return [2 /*return*/, this.beginRequest({
144
+ apiVersion: "7.2-preview.1",
145
+ routeTemplate: "{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",
146
+ routeValues: {
147
+ project: project,
148
+ alertId: alertId,
149
+ repository: repository
150
+ },
151
+ queryParams: queryValues
152
+ })];
153
+ });
154
+ });
155
+ };
156
+ /**
157
+ * Update the status of an alert
158
+ *
159
+ * @param stateUpdate - The new status of the alert
160
+ * @param project - Project ID or project name
161
+ * @param alertId - The ID of the alert
162
+ * @param repository - The name or ID of the repository
163
+ */
164
+ AlertRestClient.prototype.updateAlert = function (stateUpdate, project, alertId, repository) {
165
+ return __awaiter(this, void 0, void 0, function () {
166
+ return __generator(this, function (_a) {
167
+ return [2 /*return*/, this.beginRequest({
168
+ apiVersion: "7.2-preview.1",
169
+ method: "PATCH",
170
+ routeTemplate: "{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",
171
+ routeValues: {
172
+ project: project,
173
+ alertId: alertId,
174
+ repository: repository
175
+ },
176
+ body: stateUpdate
177
+ })];
178
+ });
179
+ });
180
+ };
181
+ /**
182
+ * @param project - Project ID or project name
183
+ * @param alertId -
184
+ * @param repository -
185
+ * @param ref -
186
+ */
187
+ AlertRestClient.prototype.getAlertInstances = function (project, alertId, repository, ref) {
188
+ return __awaiter(this, void 0, void 0, function () {
189
+ var queryValues;
190
+ return __generator(this, function (_a) {
191
+ queryValues = {
192
+ ref: ref
193
+ };
194
+ return [2 /*return*/, this.beginRequest({
195
+ apiVersion: "7.2-preview.1",
196
+ routeTemplate: "{project}/_apis/Alert/repositories/{repository}/alerts/{alertId}/Instances",
197
+ routeValues: {
198
+ project: project,
199
+ alertId: alertId,
200
+ repository: repository
201
+ },
202
+ queryParams: queryValues
203
+ })];
204
+ });
205
+ });
206
+ };
207
+ /**
208
+ * Upload a Sarif containing security alerts
209
+ *
210
+ * @param content - Content to upload
211
+ * @param project - Project ID or project name
212
+ * @param repository - The name or ID of a repository
213
+ */
214
+ AlertRestClient.prototype.uploadSarif = function (content, project, repository) {
215
+ return __awaiter(this, void 0, void 0, function () {
216
+ return __generator(this, function (_a) {
217
+ return [2 /*return*/, this.beginRequest({
218
+ apiVersion: "7.2-preview.1",
219
+ method: "POST",
220
+ routeTemplate: "{project}/_apis/Alert/repositories/{repository}/sarifs",
221
+ routeValues: {
222
+ project: project,
223
+ repository: repository
224
+ },
225
+ customHeaders: {
226
+ "Content-Type": "application/octet-stream",
227
+ },
228
+ body: content
229
+ })];
230
+ });
231
+ });
232
+ };
233
+ /**
234
+ * @param project - Project ID or project name
235
+ * @param repository -
236
+ * @param alertType -
237
+ */
238
+ AlertRestClient.prototype.getUxFilters = function (project, repository, alertType) {
239
+ return __awaiter(this, void 0, void 0, function () {
240
+ var queryValues;
241
+ return __generator(this, function (_a) {
242
+ queryValues = {
243
+ alertType: alertType
244
+ };
245
+ return [2 /*return*/, this.beginRequest({
246
+ apiVersion: "7.2-preview.1",
247
+ routeTemplate: "{project}/_apis/Alert/repositories/{repository}/filters",
248
+ routeValues: {
249
+ project: project,
250
+ repository: repository
251
+ },
252
+ queryParams: queryValues
253
+ })];
254
+ });
255
+ });
256
+ };
257
+ /**
258
+ * Get the status of the Sarif processing job
259
+ *
260
+ * @param sarifId - Sarif ID returned when the Sarif was uploaded
261
+ */
262
+ AlertRestClient.prototype.getSarif = function (sarifId) {
263
+ return __awaiter(this, void 0, void 0, function () {
264
+ return __generator(this, function (_a) {
265
+ return [2 /*return*/, this.beginRequest({
266
+ apiVersion: "7.2-preview.1",
267
+ routeTemplate: "_apis/Alert/Sarifs/{sarifId}",
268
+ routeValues: {
269
+ sarifId: sarifId
270
+ }
271
+ })];
272
+ });
273
+ });
274
+ };
275
+ return AlertRestClient;
276
+ }(RestClientBase_1.RestClientBase));
277
+ exports.AlertRestClient = AlertRestClient;
278
+ });
@@ -0,0 +1 @@
1
+ var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))(function(i,n){function a(e){try{u(o.next(e))}catch(e){n(e)}}function s(e){try{u(o.throw(e))}catch(e){n(e)}}function u(e){e.done?i(e.value):new r(function(t){t(e.value)}).then(a,s)}u((o=o.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function r(r){return function(a){return function(r){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(n=2&r[0]?i.return:r[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,r[1])).done)return n;switch(i=0,n&&(r=[2&r[0],n.value]),r[0]){case 0:case 1:n=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,i=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(n=s.trys,!(n=n.length>0&&n[n.length-1])&&(6===r[0]||2===r[0])){s=0;continue}if(3===r[0]&&(!n||r[1]>n[0]&&r[1]<n[3])){s.label=r[1];break}if(6===r[0]&&s.label<n[1]){s.label=n[1],n=r;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(r);break}n[2]&&s.ops.pop(),s.trys.pop();continue}r=t.call(e,s)}catch(e){r=[6,e],i=0}finally{o=n=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}var o,i,n,a,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};define(["require","exports","../Common/RestClientBase","../Common/Util/Serialization"],function(e,t,r,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.getAlert=function(e,t,r,o){return __awaiter(this,void 0,void 0,function(){var i;return __generator(this,function(n){return i={ref:o},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:e,alertId:t,repository:r},queryParams:i})]})})},t.prototype.getAlerts=function(e,t,r,i,n,a){return __awaiter(this,void 0,void 0,function(){var s,u=this;return __generator(this,function(p){return s={top:r,orderBy:i,criteria:n,continuationToken:a},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:e,repository:t},queryParams:s,returnRawResponse:!0}).then(function(e){return __awaiter(u,void 0,void 0,function(){var t;return __generator(this,function(r){switch(r.label){case 0:return[4,e.text().then(o.deserializeVssJsonObject)];case 1:return t=r.sent(),t.continuationToken=e.headers.get("x-ms-continuationtoken"),[2,t]}})})})]})})},t.prototype.getAlertSarif=function(e,t,r,o){return __awaiter(this,void 0,void 0,function(){var i;return __generator(this,function(n){return i={ref:o},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:e,alertId:t,repository:r},queryParams:i})]})})},t.prototype.updateAlert=function(e,t,r,o){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(i){return[2,this.beginRequest({apiVersion:"7.2-preview.1",method:"PATCH",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/Alerts/{alertId}",routeValues:{project:t,alertId:r,repository:o},body:e})]})})},t.prototype.getAlertInstances=function(e,t,r,o){return __awaiter(this,void 0,void 0,function(){var i;return __generator(this,function(n){return i={ref:o},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/alerts/{alertId}/Instances",routeValues:{project:e,alertId:t,repository:r},queryParams:i})]})})},t.prototype.uploadSarif=function(e,t,r){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(o){return[2,this.beginRequest({apiVersion:"7.2-preview.1",method:"POST",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/sarifs",routeValues:{project:t,repository:r},customHeaders:{"Content-Type":"application/octet-stream"},body:e})]})})},t.prototype.getUxFilters=function(e,t,r){return __awaiter(this,void 0,void 0,function(){var o;return __generator(this,function(i){return o={alertType:r},[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"{project}/_apis/Alert/repositories/{repository}/filters",routeValues:{project:e,repository:t},queryParams:o})]})})},t.prototype.getSarif=function(e){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2,this.beginRequest({apiVersion:"7.2-preview.1",routeTemplate:"_apis/Alert/Sarifs/{sarifId}",routeValues:{sarifId:e}})]})})},t}(r.RestClientBase);t.AlertRestClient=i});
@@ -39,6 +39,7 @@ export declare class FileContainerRestClient extends RestClientBase {
39
39
  * @param ignoreRequestedMediaType -
40
40
  * @param includeBlobMetadata -
41
41
  * @param saveAbsolutePath -
42
+ * @param preferRedirect -
42
43
  */
43
- getItems(containerId: number, scope?: string, itemPath?: string, metadata?: boolean, format?: string, downloadFileName?: string, includeDownloadTickets?: boolean, isShallow?: boolean, ignoreRequestedMediaType?: boolean, includeBlobMetadata?: boolean, saveAbsolutePath?: boolean): Promise<FileContainer.FileContainerItem[]>;
44
+ getItems(containerId: number, scope?: string, itemPath?: string, metadata?: boolean, format?: string, downloadFileName?: string, includeDownloadTickets?: boolean, isShallow?: boolean, ignoreRequestedMediaType?: boolean, includeBlobMetadata?: boolean, saveAbsolutePath?: boolean, preferRedirect?: boolean): Promise<FileContainer.FileContainerItem[]>;
44
45
  }
@@ -144,8 +144,9 @@ define(["require", "exports", "../Common/RestClientBase"], function (require, ex
144
144
  * @param ignoreRequestedMediaType -
145
145
  * @param includeBlobMetadata -
146
146
  * @param saveAbsolutePath -
147
+ * @param preferRedirect -
147
148
  */
148
- FileContainerRestClient.prototype.getItems = function (containerId, scope, itemPath, metadata, format, downloadFileName, includeDownloadTickets, isShallow, ignoreRequestedMediaType, includeBlobMetadata, saveAbsolutePath) {
149
+ FileContainerRestClient.prototype.getItems = function (containerId, scope, itemPath, metadata, format, downloadFileName, includeDownloadTickets, isShallow, ignoreRequestedMediaType, includeBlobMetadata, saveAbsolutePath, preferRedirect) {
149
150
  return __awaiter(this, void 0, void 0, function () {
150
151
  var queryValues;
151
152
  return __generator(this, function (_a) {
@@ -159,7 +160,8 @@ define(["require", "exports", "../Common/RestClientBase"], function (require, ex
159
160
  isShallow: isShallow,
160
161
  ignoreRequestedMediaType: ignoreRequestedMediaType,
161
162
  includeBlobMetadata: includeBlobMetadata,
162
- saveAbsolutePath: saveAbsolutePath
163
+ saveAbsolutePath: saveAbsolutePath,
164
+ preferRedirect: preferRedirect
163
165
  };
164
166
  return [2 /*return*/, this.beginRequest({
165
167
  apiVersion: "7.2-preview.4",
@@ -1 +1 @@
1
- var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}s((n=n.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function r(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,o=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(i=u.trys,!(i=i.length>0&&i[i.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){u.label=r[1];break}if(6===r[0]&&u.label<i[1]){u.label=i[1],i=r;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(r);break}i[2]&&u.ops.pop(),u.trys.pop();continue}r=t.call(e,u)}catch(e){r=[6,e],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}var n,o,i,a,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};define(["require","exports","../Common/RestClientBase"],function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.createItems=function(e,t,r){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(o){return n={scope:r},[2,this.beginRequest({apiVersion:"7.2-preview.4",method:"POST",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",routeValues:{containerId:t},queryParams:n,body:e})]})})},t.prototype.deleteItem=function(e,t,r){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(o){return n={itemPath:t,scope:r},[2,this.beginRequest({apiVersion:"7.2-preview.4",method:"DELETE",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",routeValues:{containerId:e},queryParams:n})]})})},t.prototype.getContainers=function(e,t){return __awaiter(this,void 0,void 0,function(){var r;return __generator(this,function(n){return r={scope:e,artifactUris:t},[2,this.beginRequest({apiVersion:"7.2-preview.4",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",queryParams:r})]})})},t.prototype.getItems=function(e,t,r,n,o,i,a,u,s,c,l){return __awaiter(this,void 0,void 0,function(){var p;return __generator(this,function(f){return p={scope:t,itemPath:r,metadata:n,$format:o,downloadFileName:i,includeDownloadTickets:a,isShallow:u,ignoreRequestedMediaType:s,includeBlobMetadata:c,saveAbsolutePath:l},[2,this.beginRequest({apiVersion:"7.2-preview.4",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",routeValues:{containerId:e},queryParams:p})]})})},t}(r.RestClientBase);t.FileContainerRestClient=n});
1
+ var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r(function(t){t(e.value)}).then(a,u)}s((n=n.apply(e,t||[])).next())})},__generator=this&&this.__generator||function(e,t){function r(r){return function(a){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,o&&(i=2&r[0]?o.return:r[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,r[1])).done)return i;switch(o=0,i&&(r=[2&r[0],i.value]),r[0]){case 0:case 1:i=r;break;case 4:return u.label++,{value:r[1],done:!1};case 5:u.label++,o=r[1],r=[0];continue;case 7:r=u.ops.pop(),u.trys.pop();continue;default:if(i=u.trys,!(i=i.length>0&&i[i.length-1])&&(6===r[0]||2===r[0])){u=0;continue}if(3===r[0]&&(!i||r[1]>i[0]&&r[1]<i[3])){u.label=r[1];break}if(6===r[0]&&u.label<i[1]){u.label=i[1],i=r;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(r);break}i[2]&&u.ops.pop(),u.trys.pop();continue}r=t.call(e,u)}catch(e){r=[6,e],o=0}finally{n=i=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,a])}}var n,o,i,a,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:r(0),throw:r(1),return:r(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a};define(["require","exports","../Common/RestClientBase"],function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.createItems=function(e,t,r){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(o){return n={scope:r},[2,this.beginRequest({apiVersion:"7.2-preview.4",method:"POST",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",routeValues:{containerId:t},queryParams:n,body:e})]})})},t.prototype.deleteItem=function(e,t,r){return __awaiter(this,void 0,void 0,function(){var n;return __generator(this,function(o){return n={itemPath:t,scope:r},[2,this.beginRequest({apiVersion:"7.2-preview.4",method:"DELETE",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",routeValues:{containerId:e},queryParams:n})]})})},t.prototype.getContainers=function(e,t){return __awaiter(this,void 0,void 0,function(){var r;return __generator(this,function(n){return r={scope:e,artifactUris:t},[2,this.beginRequest({apiVersion:"7.2-preview.4",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",queryParams:r})]})})},t.prototype.getItems=function(e,t,r,n,o,i,a,u,s,c,l,p){return __awaiter(this,void 0,void 0,function(){var f;return __generator(this,function(h){return f={scope:t,itemPath:r,metadata:n,$format:o,downloadFileName:i,includeDownloadTickets:a,isShallow:u,ignoreRequestedMediaType:s,includeBlobMetadata:c,saveAbsolutePath:l,preferRedirect:p},[2,this.beginRequest({apiVersion:"7.2-preview.4",routeTemplate:"_apis/resources/Containers/{containerId}/{*itemPath}",routeValues:{containerId:e},queryParams:f})]})})},t}(r.RestClientBase);t.FileContainerRestClient=n});
@@ -0,0 +1,71 @@
1
+ export interface AdvSecEnablementSettings {
2
+ /**
3
+ * Automatically enable Advanced Security on newly created repositories.
4
+ */
5
+ enableOnCreate: boolean;
6
+ reposEnablementStatus: AdvSecEnablementStatus[];
7
+ }
8
+ export interface AdvSecEnablementSettingsUpdate extends AdvSecEnablementStatusUpdate {
9
+ /**
10
+ * Automatically enable Advanced Security on newly created repositories.
11
+ */
12
+ enableOnCreate: boolean;
13
+ }
14
+ export interface AdvSecEnablementStatus extends AdvSecEnablementStatusUpdate {
15
+ /**
16
+ * The last time the status of Advanced Security for this repository was updated
17
+ */
18
+ advSecEnablementLastChangedDate: Date;
19
+ projectId: string;
20
+ repositoryId: string;
21
+ }
22
+ export interface AdvSecEnablementStatusUpdate {
23
+ /**
24
+ * Enabled status False disabled, True enabled, Null never explicitly set.
25
+ */
26
+ advSecEnabled: boolean;
27
+ /**
28
+ * When true, pushes containing secrets will be blocked. \<br /\>When false, pushes are scanned for secrets and are not blocked. \<br /\>If includeAllProperties in the request if false, this value will be null.
29
+ */
30
+ blockPushes: boolean;
31
+ }
32
+ /**
33
+ * BillingInfo contains an organization, its enablement status and the Azure Subscription for it.
34
+ */
35
+ export interface BillingInfo {
36
+ advSecEnabled: boolean;
37
+ /**
38
+ * The most recent time the enablement state was modified.
39
+ */
40
+ advSecEnabledChangedOnDate: Date;
41
+ /**
42
+ * The first time the enablement state was modified.
43
+ */
44
+ advSecEnabledFirstChangedOnDate: Date;
45
+ azureSubscriptionId: string;
46
+ billingMode: BillingMode;
47
+ organizationId: string;
48
+ }
49
+ export declare enum BillingMode {
50
+ /**
51
+ * None implies the organization is not billable because no Azure Subscription has been set.
52
+ */
53
+ None = 0,
54
+ /**
55
+ * When an organization is the only organization mapped to an Azure Subscription.
56
+ */
57
+ SingleOrg = 1,
58
+ /**
59
+ * When an organization is mapped to an Azure Subscription to which at least one other org is mapped.
60
+ */
61
+ MultiOrg = 2
62
+ }
63
+ export interface MeterUsage {
64
+ accountId: string;
65
+ azureSubscriptionId: string;
66
+ billedCommitters: string[];
67
+ billingDate: Date;
68
+ isAdvSecBillable: boolean;
69
+ isAdvSecEnabled: boolean;
70
+ uniqueCommitterCount: number;
71
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * ---------------------------------------------------------
3
+ * Copyright(C) Microsoft Corporation. All rights reserved.
4
+ * ---------------------------------------------------------
5
+ */
6
+ define(["require", "exports"], function (require, exports) {
7
+ "use strict";
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ var BillingMode;
10
+ (function (BillingMode) {
11
+ /**
12
+ * None implies the organization is not billable because no Azure Subscription has been set.
13
+ */
14
+ BillingMode[BillingMode["None"] = 0] = "None";
15
+ /**
16
+ * When an organization is the only organization mapped to an Azure Subscription.
17
+ */
18
+ BillingMode[BillingMode["SingleOrg"] = 1] = "SingleOrg";
19
+ /**
20
+ * When an organization is mapped to an Azure Subscription to which at least one other org is mapped.
21
+ */
22
+ BillingMode[BillingMode["MultiOrg"] = 2] = "MultiOrg";
23
+ })(BillingMode = exports.BillingMode || (exports.BillingMode = {}));
24
+ });
@@ -0,0 +1 @@
1
+ define(["require","exports"],function(e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});!function(e){e[e.None=0]="None",e[e.SingleOrg=1]="SingleOrg",e[e.MultiOrg=2]="MultiOrg"}(i.BillingMode||(i.BillingMode={}))});
@@ -0,0 +1,98 @@
1
+ import { IVssRestClientOptions } from "../Common/Context";
2
+ import { RestClientBase } from "../Common/RestClientBase";
3
+ import * as Management from "../Management/Management";
4
+ export declare class ManagementRestClient extends RestClientBase {
5
+ constructor(options: IVssRestClientOptions);
6
+ /**
7
+ * @param organizationId -
8
+ */
9
+ deleteBillingInfo(organizationId: string): Promise<void>;
10
+ /**
11
+ * @param organizationId -
12
+ */
13
+ deleteMeterUsageHistory(organizationId: string): Promise<void>;
14
+ /**
15
+ * Get the billing info for an organization.
16
+ *
17
+ * @param organizationId - Organization ID to get billing info for.
18
+ */
19
+ getBillingInfo(organizationId: string): Promise<Management.BillingInfo>;
20
+ /**
21
+ * @param billingInfo -
22
+ * @param organizationId -
23
+ */
24
+ saveBillingInfo(billingInfo: Management.BillingInfo, organizationId: string): Promise<void>;
25
+ /**
26
+ */
27
+ getLastMeterUsage(): Promise<Management.MeterUsage>;
28
+ /**
29
+ * Get commiters used when calculating billing information.
30
+ *
31
+ * @param billingDate - The date to query, or if not provided, today
32
+ */
33
+ getMeterUsage(billingDate?: Date): Promise<Management.MeterUsage>;
34
+ /**
35
+ * @param meterUsage -
36
+ */
37
+ setBillingSnapshot(meterUsage: Management.MeterUsage): Promise<void>;
38
+ /**
39
+ * Get the current status of Advanced Security for the organization
40
+ *
41
+ * @param includeAllProperties - When true, also determine if pushes are blocked if they contain secrets
42
+ */
43
+ getOrgEnablementStatus(includeAllProperties?: boolean): Promise<Management.AdvSecEnablementSettings>;
44
+ /**
45
+ * Update the status of Advanced Security for the organization
46
+ *
47
+ * @param savedAdvSecEnablementStatus - The new status
48
+ */
49
+ updateOrgEnablementStatus(savedAdvSecEnablementStatus: Management.AdvSecEnablementSettingsUpdate): Promise<void>;
50
+ /**
51
+ * Estimate the committers that would be added to the customer's usage if Advanced Security was enabled for this organization.
52
+ *
53
+ */
54
+ getEstimatedOrgBillablePushers(): Promise<string[]>;
55
+ /**
56
+ * Get the current status of Advanced Security for a project
57
+ *
58
+ * @param project - Project ID or project name
59
+ * @param includeAllProperties - When true, also determine if pushes are blocked if they contain secrets
60
+ */
61
+ getProjectEnablementStatus(project: string, includeAllProperties?: boolean): Promise<Management.AdvSecEnablementSettings>;
62
+ /**
63
+ * Update the status of Advanced Security for the project
64
+ *
65
+ * @param savedAdvSecEnablementStatus - The new status
66
+ * @param project - Project ID or project name
67
+ */
68
+ updateProjectEnablementStatus(savedAdvSecEnablementStatus: Management.AdvSecEnablementSettingsUpdate, project: string): Promise<void>;
69
+ /**
70
+ * Estimate the number of committers that would be added to the customer's usage if Advanced Security was enabled for this project.
71
+ *
72
+ * @param project - Project ID or project name
73
+ */
74
+ getEstimatedProjectBillablePushers(project: string): Promise<string[]>;
75
+ /**
76
+ * Determine if Advanced Security is enabled for a repository
77
+ *
78
+ * @param project - Project ID or project name
79
+ * @param repository - The name or ID of the repository
80
+ * @param includeAllProperties - When true, will also determine if pushes are blocked when secrets are detected
81
+ */
82
+ getRepoEnablementStatus(project: string, repository: string, includeAllProperties?: boolean): Promise<Management.AdvSecEnablementStatus>;
83
+ /**
84
+ * Update the enablement of Advanced Security for a repository
85
+ *
86
+ * @param savedAdvSecEnablementStatus - new status
87
+ * @param project - Project ID or project name
88
+ * @param repository - Name or ID of the repository
89
+ */
90
+ updateRepoAdvSecEnablementStatus(savedAdvSecEnablementStatus: Management.AdvSecEnablementStatusUpdate, project: string, repository: string): Promise<void>;
91
+ /**
92
+ * Estimate the committers that would be added to the customer's usage if Advanced Security was enabled for this repository.
93
+ *
94
+ * @param project - Project ID or project name
95
+ * @param repository - The name or ID of the repository
96
+ */
97
+ getEstimatedRepoBillableCommitters(project: string, repository: string): Promise<string[]>;
98
+ }